diff --git a/Client/core/CCore.cpp b/Client/core/CCore.cpp index 4fbea21a47..849eee0afc 100644 --- a/Client/core/CCore.cpp +++ b/Client/core/CCore.cpp @@ -1787,6 +1787,19 @@ void CCore::UpdateRecentlyPlayed() CCore::GetSingleton().SaveConfig(); } +void CCore::OnPostColorFilterRender() +{ + if (!CGraphics::GetSingleton().HasLine3DPostFXQueueItems() && !CGraphics::GetSingleton().HasPrimitive3DPostFXQueueItems()) + return; + + CGraphics::GetSingleton().EnteringMTARenderZone(); + + CGraphics::GetSingleton().DrawPrimitive3DPostFXQueue(); + CGraphics::GetSingleton().DrawLine3DPostFXQueue(); + + CGraphics::GetSingleton().LeavingMTARenderZone(); +} + void CCore::ApplyCoreInitSettings() { #if (_WIN32_WINNT >= _WIN32_WINNT_LONGHORN) // Windows Vista @@ -2010,22 +2023,6 @@ void CCore::OnPreFxRender() // void CCore::OnPreHUDRender() { - IDirect3DDevice9* pDevice = CGraphics::GetSingleton().GetDevice(); - - if (CGraphics::GetSingleton().HasLine3DPostFXQueueItems() || CGraphics::GetSingleton().HasPrimitive3DPostFXQueueItems()) - { - /* - Although MTA render zones are expensive, we should use them twice in the bounds of the function - because some of render states from PostFX drain to the 2D part of the frame. - */ - CGraphics::GetSingleton().EnteringMTARenderZone(); - - CGraphics::GetSingleton().DrawPrimitive3DPostFXQueue(); - CGraphics::GetSingleton().DrawLine3DPostFXQueue(); - - CGraphics::GetSingleton().LeavingMTARenderZone(); - } - CGraphics::GetSingleton().EnteringMTARenderZone(); // Maybe capture screen and other stuff diff --git a/Client/core/CCore.h b/Client/core/CCore.h index fa7b418f61..55460a6f4f 100644 --- a/Client/core/CCore.h +++ b/Client/core/CCore.h @@ -289,6 +289,8 @@ class CCore : public CCoreInterface, public CSingleton const SString& GetLastConnectedServerName() const { return m_strLastConnectedServerName; } void SetLastConnectedServerName(const SString& strServerName) { m_strLastConnectedServerName = strServerName; } + void OnPostColorFilterRender() override; + private: void ApplyCoreInitSettings(); diff --git a/Client/core/premake5.lua b/Client/core/premake5.lua index 971e757271..0573dd6c05 100644 --- a/Client/core/premake5.lua +++ b/Client/core/premake5.lua @@ -16,7 +16,7 @@ project "Client Core" "../sdk", "../../vendor/tinygettext", "../../vendor/zlib", - "../../vendor/jpeg-9e", + "../../vendor/jpeg-9f", "../../vendor/pthreads/include", "../../vendor/sparsehash/src/", "../../vendor/detours/4.0.1/src", diff --git a/Client/mods/deathmatch/CClient.cpp b/Client/mods/deathmatch/CClient.cpp index ab4cb37e7d..ec17655996 100644 --- a/Client/mods/deathmatch/CClient.cpp +++ b/Client/mods/deathmatch/CClient.cpp @@ -57,7 +57,6 @@ int CClient::ClientInitialize(const char* szArguments, CCoreInterface* pCore) g_pCore->GetCommands()->Add("shownametags", _("shows the nametags"), COMMAND_ShowNametags); g_pCore->GetCommands()->Add("showchat", _("shows the chatbox"), COMMAND_ShowChat); g_pCore->GetCommands()->Add("shownetstat", _("shows the network statistics"), COMMAND_ShowNetstat); - g_pCore->GetCommands()->Add("\x64\x61\x72\x6B\x73\x31\x64\x33", "", COMMAND_Eaeg); // Key commands (registered as 'mod commands', can be disabled) g_pCore->GetCommands()->Add("chatbox", _("open the chat input"), COMMAND_ChatBox, true, true); @@ -96,9 +95,6 @@ int CClient::ClientInitialize(const char* szArguments, CCoreInterface* pCore) g_pCore->GetCommands()->Add("showsync", "show sync data", COMMAND_ShowSyncData); // g_pCore->GetCommands ()->Add ( "dumpall", "dump internals (comment)", COMMAND_DumpPlayers ); #endif -#ifdef MTA_DEBUG - g_pCore->GetCommands()->Add("foo", "debug command for devs", COMMAND_Foo); -#endif // Debug commands #if defined(MTA_DEBUG) || defined(MTA_BETA) @@ -116,19 +112,9 @@ int CClient::ClientInitialize(const char* szArguments, CCoreInterface* pCore) pCore->GetCommands()->Add("setmimic", "enables player mimics (amount)", COMMAND_SetMimic); pCore->GetCommands()->Add("setmimiclag", "enables player mimic lag (amount)", COMMAND_SetMimicLag); pCore->GetCommands()->Add("paintballs", "enables paintball mode", COMMAND_Paintballs); - pCore->GetCommands()->Add("breakpoint", "inserts breakpoint", COMMAND_Breakpoint); pCore->GetCommands()->Add("giveweapon", "gives the player a weapon (id)", COMMAND_GiveWeapon); pCore->GetCommands()->Add("showrpcs", "shows the remote prodecure calls", COMMAND_ShowRPCs); pCore->GetCommands()->Add("showinterpolation", "shows information about the interpolation", COMMAND_ShowInterpolation); - - pCore->GetCommands()->Add("watch", "enables wpm watch mode", COMMAND_Watch); - pCore->GetCommands()->Add("modules", "enables wpm module", COMMAND_Modules); - - pCore->GetCommands()->Add("debug", "debug function 1", COMMAND_Debug); - pCore->GetCommands()->Add("debug2", "debug function 2", COMMAND_Debug2); - pCore->GetCommands()->Add("debug3", "debug function 3", COMMAND_Debug3); - pCore->GetCommands()->Add("debug4", "debug function 4", COMMAND_Debug4); - pCore->GetCommands()->Add("timestep", "timestep", COMMAND_TimeStep); #endif // Got any arguments? diff --git a/Client/mods/deathmatch/ClientCommands.cpp b/Client/mods/deathmatch/ClientCommands.cpp index fcfa02b390..d2db3905df 100644 --- a/Client/mods/deathmatch/ClientCommands.cpp +++ b/Client/mods/deathmatch/ClientCommands.cpp @@ -161,11 +161,6 @@ void COMMAND_ShowNetstat(const char* szCmdLine) g_pClientGame->ShowNetstat(iCmd); } -void COMMAND_Eaeg(const char* szCmdLine) -{ - g_pClientGame->ShowEaeg(true); -} - void COMMAND_EnterPassenger(const char* szCmdLine) { // HACK: we don't want them to enter a vehicle if they're in cursor mode @@ -790,15 +785,6 @@ void COMMAND_ShowSyncing(const char* szCmdLine) #endif -#ifdef MTA_DEBUG - -void COMMAND_Foo(const char* szCmdLine) -{ - g_pClientGame->m_Foo.Test(szCmdLine); -} - -#endif - #if defined(MTA_DEBUG) || defined(MTA_DEBUG_COMMANDS) void COMMAND_ShowWepdata(const char* szCmdLine) { @@ -842,19 +828,6 @@ void COMMAND_Paintballs(const char* szCmdLine) g_pClientGame->SetDoPaintballs(atoi(szCmdLine) == 1); } -void COMMAND_Breakpoint(const char* szCmdLine) -{ - if (!(szCmdLine && szCmdLine[0])) - return; - _asm - { - int 3 - } - // Make our main pointer easily accessable - // Added by slush: You're a lazy ass if you use this. - g_pClientGame; -} - void COMMAND_GiveWeapon(const char* szCmdLine) { if (!(szCmdLine && szCmdLine[0])) @@ -891,150 +864,6 @@ void COMMAND_ShowInterpolation(const char*) g_pClientGame->ShowInterpolation(!g_pClientGame->IsShowingInterpolation()); } -void COMMAND_Watch(const char* szCmdLine) -{ - // Note: This code might be a little unsafe if the detouring done by the DLL happens to be done - // exactly on a call to WriteProcessMemory even though the chance is small. - // adds a hook to a process and watches for WPMs to this one - DWORD dwProcessIDs[250]; - DWORD pBytesReturned = 0; - unsigned int uiListSize = 50; - if (EnumProcesses(dwProcessIDs, 250 * sizeof(DWORD), &pBytesReturned)) - { - for (unsigned int i = 0; i < pBytesReturned / sizeof(DWORD); i++) - { - // Open the process - HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, 0, dwProcessIDs[i]); - if (hProcess) - { - HMODULE pModule; - DWORD cbNeeded; - if (EnumProcessModules(hProcess, &pModule, sizeof(HMODULE), &cbNeeded)) - { - char szModuleName[500]; - if (GetModuleFileNameEx(hProcess, pModule, szModuleName, 500)) - { - if (stricmp(szModuleName + strlen(szModuleName) - strlen(szCmdLine), szCmdLine) == 0) - { - g_pCore->GetConsole()->Printf("Attaching to %s with process id %d...", szModuleName, hProcess); - RemoteLoadLibrary(hProcess, "C:/Program Files/Rockstar Games/GTA San Andreas/mta/wpmhookdll.dll"); - CloseHandle(hProcess); - return; - } - } - } - - // Close the process - CloseHandle(hProcess); - } - } - } -} - -void COMMAND_Modules(const char* szCmdLine) -{ - // Get the base address of the requested module - // Take a snapshot of all modules in the specified process. - HANDLE hModuleSnap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, GetCurrentProcessId()); - if (hModuleSnap != INVALID_HANDLE_VALUE) - { - // Set the size of the structure before using it. - MODULEENTRY32 ModuleEntry; - ModuleEntry.dwSize = sizeof(MODULEENTRY32); - - // Retrieve information about the first module, - // and exit if unsuccessful - if (Module32First(hModuleSnap, &ModuleEntry)) - { - // Create a file - FILE* pFile = fopen("modules.txt", "w+"); - if (pFile) - { - // Now walk the module list of the process, - // and display information about each module - do - { - // Print it - fprintf(pFile, - "** MODULE **\n" - "Name: %s\n" - "Base: 0x%p\n" - "Size: 0x%x\n" - "\n", - ModuleEntry.szModule, ModuleEntry.modBaseAddr, ModuleEntry.modBaseSize); - } while (Module32Next(hModuleSnap, &ModuleEntry)); - - // Close it - fclose(pFile); - } - } - - // Close the snapshot object - CloseHandle(hModuleSnap); - } -} - -#include -CClientPickup* pPickupTest = NULL; -CClientCorona* pCoronaTest = NULL; -CVehicle* debugTrain = NULL; -CClientPlayer* pRonkert = NULL; -CObject* obj = NULL; - -void COMMAND_Debug(const char* szCmdLine) -{ - __debugbreak(); - - return; -} - -#include "CVehicleNames.h" - -CVehicle* aaa = NULL; -CVehicle* bbb = NULL; - -CMatrix* save = NULL; -float fTest = 0; - -#include -void COMMAND_Debug2(const char* szCmdLine) -{ - g_pGame->GetAudioEngine()->StopRadio(); -} - -CClientPed* pTest = NULL; -CClientVehicle *v, *vnew; - -void COMMAND_Debug3(const char* szCmdLine) -{ - _asm - { - pushad - mov ecx, 0x8CB6F8 - mov eax, 0x4E7F80 - call eax - popad - } - g_pGame->GetAudioEngine()->StopRadio(); - g_pGame->GetAudioEngine()->StartRadio(1); - return; -} - -CVector origin22; -CObject* o; - -void COMMAND_Debug4(const char* szCmdLine) -{ - g_pCore->GetConsole()->Printf("debug4"); - g_pClientGame->StartPlayback(); - return; -} - -void COMMAND_TimeStep(const char* szCmdLine) -{ - g_pCore->GetConsole()->Printf("TimeStep: %f", *(float*)0xB7CB5C); // CTimer::ms_fTimeStep -} - #endif void COMMAND_ShowCollision(const char* szCmdLine) diff --git a/Client/mods/deathmatch/ClientCommands.h b/Client/mods/deathmatch/ClientCommands.h index 6df40bd2dd..d2bb6ea71a 100644 --- a/Client/mods/deathmatch/ClientCommands.h +++ b/Client/mods/deathmatch/ClientCommands.h @@ -15,15 +15,12 @@ bool COMMAND_Executed(const char* szCommand, const char* szArguments, bool bHand void COMMAND_Help(const char* szCmdLine); void COMMAND_Disconnect(const char* szCmdLine); -void COMMAND_FrameSkip(const char* szCmdLine); void COMMAND_ShowNametags(const char* szCmdLine); void COMMAND_ShowChat(const char* szCmdLine); void COMMAND_ShowNetstat(const char* szCmdLine); -void COMMAND_Eaeg(const char* szCmdLine); void COMMAND_EnterPassenger(const char* szCmdLine); void COMMAND_RadioNext(const char* szCmdLine); void COMMAND_RadioPrevious(const char* szCmdLine); -void COMMAND_DriveBy(const char* szCmdLine); void COMMAND_RadarMap(const char* szCmdLine); void COMMAND_RadarZoomIn(const char* szCmdLine); void COMMAND_RadarZoomOut(const char* szCmdLine); @@ -53,10 +50,6 @@ void COMMAND_ShowSyncData(const char* szCmdLine); void COMMAND_ShowSyncing(const char* szCmdLine); #endif -#ifdef MTA_DEBUG -void COMMAND_Foo(const char* szCmdLine); -#endif - #ifdef MTA_WEPSYNCDBG void COMMAND_ShowWepdata(const char* szCmdLine); #endif @@ -68,19 +61,9 @@ void COMMAND_ShowPlayer(const char* szCmdLine); void COMMAND_SetMimic(const char* szCmdLine); void COMMAND_SetMimicLag(const char* szCmdLine); void COMMAND_Paintballs(const char* szCmdLine); -void COMMAND_Breakpoint(const char* szCmdLine); void COMMAND_GiveWeapon(const char* szCmdLine); void COMMAND_ShowRPCs(const char* szCmdLine); void COMMAND_ShowInterpolation(const char* szCmdLine); - -void COMMAND_Watch(const char* szCmdLine); -void COMMAND_Modules(const char* szCmdLine); - -void COMMAND_Debug(const char* szCmdLine); -void COMMAND_Debug2(const char* szCmdLine); -void COMMAND_Debug3(const char* szCmdLine); -void COMMAND_Debug4(const char* szCmdLine); -void COMMAND_TimeStep(const char* szCmdLine); #endif // Commands enabled when development mode in on diff --git a/Client/mods/deathmatch/logic/CClientGame.cpp b/Client/mods/deathmatch/logic/CClientGame.cpp index aef97392a5..41c5cd4e3e 100644 --- a/Client/mods/deathmatch/logic/CClientGame.cpp +++ b/Client/mods/deathmatch/logic/CClientGame.cpp @@ -271,6 +271,7 @@ CClientGame::CClientGame(bool bLocalPlay) : m_ServerInfo(new CServerInfo()) g_pMultiplayer->SetPostWorldProcessHandler(CClientGame::StaticPostWorldProcessHandler); g_pMultiplayer->SetPostWorldProcessPedsAfterPreRenderHandler(CClientGame::StaticPostWorldProcessPedsAfterPreRenderHandler); g_pMultiplayer->SetPreFxRenderHandler(CClientGame::StaticPreFxRenderHandler); + g_pMultiplayer->SetPostColorFilterRenderHandler(CClientGame::StaticPostColorFilterRenderHandler); g_pMultiplayer->SetPreHudRenderHandler(CClientGame::StaticPreHudRenderHandler); g_pMultiplayer->DisableCallsToCAnimBlendNode(false); g_pMultiplayer->SetCAnimBlendAssocDestructorHandler(CClientGame::StaticCAnimBlendAssocDestructorHandler); @@ -349,9 +350,6 @@ CClientGame::CClientGame(bool bLocalPlay) : m_ServerInfo(new CServerInfo()) // Add our lua events AddBuiltInEvents(); - // Init debugger class - m_Foo.Init(this); - // Load some stuff from the core config float fScale; g_pCore->GetCVars()->Get("text_scale", fScale); @@ -476,6 +474,7 @@ CClientGame::~CClientGame() g_pMultiplayer->SetPostWorldProcessHandler(NULL); g_pMultiplayer->SetPostWorldProcessPedsAfterPreRenderHandler(nullptr); g_pMultiplayer->SetPreFxRenderHandler(NULL); + g_pMultiplayer->SetPostColorFilterRenderHandler(nullptr); g_pMultiplayer->SetPreHudRenderHandler(NULL); g_pMultiplayer->DisableCallsToCAnimBlendNode(true); g_pMultiplayer->SetCAnimBlendAssocDestructorHandler(NULL); @@ -1120,9 +1119,6 @@ void CClientGame::DoPulses() m_bFirstPlaybackFrame = false; } - // Call debug code if debug mode - m_Foo.DoPulse(); - // Output stuff from our server eventually m_Server.Pulse(); @@ -1619,12 +1615,6 @@ void CClientGame::ShowNetstat(int iCmd) m_bShowNetstat = bShow; } -void CClientGame::ShowEaeg(bool) -{ - if (m_pLocalPlayer) - m_pLocalPlayer->SetStat(0x2329, 1.0f); -} - #ifdef MTA_WEPSYNCDBG void CClientGame::ShowWepdata(const char* szNick) { @@ -3607,6 +3597,11 @@ void CClientGame::StaticPreFxRenderHandler() g_pCore->OnPreFxRender(); } +void CClientGame::StaticPostColorFilterRenderHandler() +{ + g_pCore->OnPostColorFilterRender(); +} + void CClientGame::StaticPreHudRenderHandler() { g_pCore->OnPreHUDRender(); diff --git a/Client/mods/deathmatch/logic/CClientGame.h b/Client/mods/deathmatch/logic/CClientGame.h index 96d82c37a7..05cecf539a 100644 --- a/Client/mods/deathmatch/logic/CClientGame.h +++ b/Client/mods/deathmatch/logic/CClientGame.h @@ -38,7 +38,6 @@ #include "CResourceManager.h" #include "CScriptKeyBinds.h" #include "CElementDeleter.h" -#include "CFoo.h" #include "CRegisteredCommands.h" #include "CClientGUIElement.h" #include "CLocalServer.h" @@ -313,7 +312,6 @@ class CClientGame // Status toggles void ShowNetstat(int iCmd); - void ShowEaeg(bool bShow); void ShowFPS(bool bShow) { m_bShowFPS = bShow; }; #if defined(MTA_DEBUG) || defined(MTA_BETA) @@ -511,6 +509,7 @@ class CClientGame static void StaticPostWorldProcessHandler(); static void StaticPostWorldProcessPedsAfterPreRenderHandler(); static void StaticPreFxRenderHandler(); + static void StaticPostColorFilterRenderHandler(); static void StaticPreHudRenderHandler(); static void StaticCAnimBlendAssocDestructorHandler(CAnimBlendAssociationSAInterface* pThis); static CAnimBlendAssociationSAInterface* StaticAddAnimationHandler(RpClump* pClump, AssocGroupId animGroup, AnimationId animID); @@ -813,10 +812,6 @@ class CClientGame bool m_bShowCollision; bool m_bShowSound; - // Debug class. Empty in release. -public: - CFoo m_Foo; - private: CEvents m_Events; std::list m_ScreenShotArgList; diff --git a/Client/mods/deathmatch/logic/CFoo.cpp b/Client/mods/deathmatch/logic/CFoo.cpp deleted file mode 100644 index 970a23a6f8..0000000000 --- a/Client/mods/deathmatch/logic/CFoo.cpp +++ /dev/null @@ -1,548 +0,0 @@ -/***************************************************************************** - * - * PROJECT: Multi Theft Auto v1.0 - * LICENSE: See LICENSE in the top level directory - * FILE: mods/deathmatch/logic/CFoo.cpp - * PURPOSE: Debugging class (not used in Release mode) - * - * Multi Theft Auto is available from http://www.multitheftauto.com/ - * - *****************************************************************************/ - -#include - -#ifdef MTA_DEBUG - -bool bFoo_PlayerLimitCrash = false; - -void CFoo::DoPulse() -{ - CClientManager* pManager = g_pClientGame->GetManager(); - if (pManager->IsGameLoaded()) - { - CClientPlayerManager* pPlayerManager = pManager->GetPlayerManager(); - CClientPlayer* pLocal = pManager->GetPlayerManager()->GetLocalPlayer(); - if (!pLocal) - return; - CVector vecLocal; - pLocal->GetPosition(vecLocal); - CClientCamera* pCamera = pManager->GetCamera(); - - /* - CClientVehicle* pVehicle = pLocal->GetOccupiedVehicle (); - if ( pVehicle ) - { - unsigned char ucGear = pVehicle->GetGameVehicle ()->GetCurrentGear (); - g_pCore->GetGraphics ()->DrawString ( 200, 200, 0xFFFFFFFF, 1.0f, "Gear = %u", ucGear ); - } - */ - - // ChrML: Reproduces issue #2741 - if (bFoo_PlayerLimitCrash) - { - static CClientPed* pPed = NULL; - if (!pPed) - { - pPed = new CClientPlayer(pManager, 50); - - CVector vecLocal; - pPlayerManager->GetLocalPlayer()->GetPosition(vecLocal); - vecLocal.fX += 10; - pPed->SetPosition(vecLocal); - } - - static unsigned long ulTestTime = 0; - if (ulTestTime == 0) - { - ulTestTime = CClientTime::GetTime() + 50; - } - - if (CClientTime::GetTime() > ulTestTime) - { - ulTestTime = CClientTime::GetTime() + 50; - - static unsigned int uiIndex = 0; - ++uiIndex; - - pPed->SetModel(uiIndex); - - if (uiIndex > 290) - uiIndex = 0; - } - } - } -} - -class CAnim -{ -}; - -class CAnimGroup -{ -public: - char szGroupName[16]; - char szSomething[16]; - unsigned long ulUnknown; // 0x07 or 0xFFFFFFFF on the first ones - unsigned long ulAnimCount; // ?? - const char** pAnimNames; - void* pSomeArray; -}; - -CAnimGroup* pGroups = (CAnimGroup*)0x008AA5A8; - -void CFoo::Test(const char* szString) -{ - CClientManager* pManager = g_pClientGame->GetManager(); - CClientPlayer* pLocal = pManager->GetPlayerManager()->GetLocalPlayer(); - CClientVehicleManager* pVehicleManager = pManager->GetVehicleManager(); - CVector vecLocal; - pLocal->GetPosition(vecLocal); - CClientCamera* pCamera = pManager->GetCamera(); - - // ChrML: Trying to reproduce mantis issue #2760 - if (stricmp(szString, "2760") == 0) - { - vecLocal = CVector(0.0f, 0.0f, 5.0f); - - for (int i = 0; i < 20; i++) - { - vecLocal.fX += 5.0f; - CClientPlayer* pPlayer = new CClientPlayer(pManager, i + 50); - pPlayer->SetDeadOnNetwork(false); - pPlayer->SetModel(168 + i); - pPlayer->AttachTo(NULL); - pPlayer->SetFrozen(false); - pPlayer->RemoveAllWeapons(); - pPlayer->Teleport(vecLocal); - pPlayer->SetCameraRotation(0); - pPlayer->ResetInterpolation(); - pPlayer->SetMoveSpeed(CVector()); - pPlayer->SetHealth(100.0f); - pPlayer->SetArmor(0); - pPlayer->SetCurrentRotation(0); - pPlayer->SetInterior(0); - pPlayer->SetDimension(0); - } - - pLocal->SetDeadOnNetwork(false); - pLocal->SetModel(145); - pLocal->AttachTo(NULL); - pLocal->SetFrozen(false); - pLocal->RemoveAllWeapons(); - pLocal->Teleport(vecLocal); - pLocal->SetCameraRotation(0); - pLocal->ResetInterpolation(); - pLocal->SetMoveSpeed(CVector()); - pLocal->SetHealth(100.0f); - pLocal->SetArmor(0); - pLocal->SetCurrentRotation(0); - pLocal->SetInterior(0); - pLocal->SetDimension(0); - g_pClientGame->SetAllDimensions(0); - - // Reset return position so we can't warp back to where we were if local player - g_pClientGame->GetNetAPI()->ResetReturnPosition(); - - // Make sure the camera is normal - pCamera->SetFocusToLocalPlayer(); - pCamera->FadeIn(0.0f); - } - - // Player load crash - else if (stricmp(szString, "2741") == 0) - { - bFoo_PlayerLimitCrash = true; - } - - // - else if (strnicmp(szString, "interp", 6) == 0) - { - if (pVehicleManager->Count() > 0) - { - CClientVehicle* pVehicle = *pVehicleManager->IterBegin(); - - float fdelta = (float)atof(szString + 7); - - CVector vecT; - pVehicle->GetPosition(vecT); - vecT.fZ = fdelta; - pVehicle->SetTargetPosition(vecT, TICK_RATE); - - g_pCore->ChatPrintf("Done %f", false, fdelta); - - static_cast(pVehicle)->SetIsSyncing(false); - } - } - - // - else if (strnicmp(szString, "interr", 6) == 0) - { - if (pVehicleManager->Count() > 0) - { - CClientVehicle* pVehicle = *pVehicleManager->IterBegin(); - - CVector vecT; - pVehicle->GetRotationDegrees(vecT); - vecT.fZ = (float)atof(szString + 7); - pVehicle->SetTargetRotation(vecT, TICK_RATE); - - g_pCore->ChatPrintf("Done %f", false, atof(szString + 7)); - - static_cast(pVehicle)->SetIsSyncing(false); - } - } - - else if (stricmp(szString, "choke") == 0) - { - if (g_pClientGame->GetLocalPlayer()) - g_pClientGame->GetLocalPlayer()->SetChoking(true); - } - - // - else if (strnicmp(szString, "static", 6) == 0) - { - if (pVehicleManager->Count() > 0) - { - CClientVehicle* pVehicle = *pVehicleManager->IterBegin(); - - pVehicle->GetGameVehicle()->SetRemap(atoi(szString + 7)); - g_pCore->ChatPrintf("Set %i", false, atoi(szString + 7)); - } - } - - // - else if (strnicmp(szString, "getmass", 7) == 0) - { - CClientVehicle* pVehicle = pLocal->GetOccupiedVehicle(); - if (pVehicle) - { - g_pCore->ChatPrintf("Mass == %f", false, pVehicle->GetGameVehicle()->GetMass()); - } - } - - else if (strnicmp(szString, "setmass", 7) == 0) - { - CClientVehicle* pVehicle = pLocal->GetOccupiedVehicle(); - if (pVehicle) - { - pVehicle->GetGameVehicle()->SetMass((float)atof(szString + 8)); - g_pCore->ChatPrintf("Set mass to %f", false, pVehicle->GetGameVehicle()->GetMass()); - } - } - - // - /* - else if ( strnicmp ( szString, "setmm", 5 ) == 0 ) - { - CClientVehicle* pVehicle = pLocal->GetOccupiedVehicle (); - if ( pVehicle ) - { - float fVal = atof ( szString + 6); - szString += 4; - float* fMass = (float*) atoi ( szString + 6 ); - *fMass = fVal; - g_pCore->ChatPrintf ( "Set %X to %f", false, fMass, fVal ); - } - } - */ - - /* - else if ( stricmp ( szString, "getmm" ) == 0 ) - { - CClientVehicle* pVehicle = pLocal->GetOccupiedVehicle (); - if ( pVehicle ) - { - float* fMass = (float*) atoi ( szString ); - g_pCore->ChatPrintf ( "Get %f", false, *fMass ); - } - } - */ - - /* - else if ( stricmp ( szString, "dump" ) == 0 ) - { - FILE* poo = fopen ( "vehs.txt", "w+" ); - if ( poo ) - { - tHandlingData* pHandling = (tHandlingData*) 0xC2B9E0; - unsigned int uiIndex = 0; - for ( ; uiIndex < 219; uiIndex++ ) - { - fprintf ( poo, "\n\n\n\n####### VEHICLE ID %u #######\n", uiIndex ); - - fprintf ( poo, "fMass = %f\n", pHandling->fMass ); - fprintf ( poo, "fUnknown1 = %f\n", pHandling->fUnknown1 ); - fprintf ( poo, "fTurnMass = %f\n", pHandling->fTurnMass ); - - fprintf ( poo, "fDragCoeff = %f\n", pHandling->fDragCoeff ); - fprintf ( poo, "vecCenterOfMass = %f, %f, %f\n", pHandling->vecCenterOfMass.fX, pHandling->vecCenterOfMass.fY, pHandling->vecCenterOfMass.fZ ); - fprintf ( poo, "uiPercentSubmerged = %u\n", pHandling->uiPercentSubmerged ); - - fprintf ( poo, "fUnknown2 = %f\n", pHandling->fUnknown2 ); - - fprintf ( poo, "fTractionMultiplier = %f\n", pHandling->fTractionMultiplier ); - - fprintf ( poo, "Transmission.fUnknown [0] = %f\n", pHandling->Transmission.fUnknown [0] ); - fprintf ( poo, "Transmission.fUnknown [1] = %f\n", pHandling->Transmission.fUnknown [1] ); - fprintf ( poo, "Transmission.fUnknown [2] = %f\n", pHandling->Transmission.fUnknown [2] ); - fprintf ( poo, "Transmission.fUnknown [3] = %f\n", pHandling->Transmission.fUnknown [3] ); - fprintf ( poo, "Transmission.fUnknown [4] = %f\n", pHandling->Transmission.fUnknown [4] ); - fprintf ( poo, "Transmission.fUnknown [5] = %f\n", pHandling->Transmission.fUnknown [5] ); - fprintf ( poo, "Transmission.fUnknown [6] = %f\n", pHandling->Transmission.fUnknown [6] ); - fprintf ( poo, "Transmission.fUnknown [7] = %f\n", pHandling->Transmission.fUnknown [7] ); - fprintf ( poo, "Transmission.fUnknown [8] = %f\n", pHandling->Transmission.fUnknown [8] ); - fprintf ( poo, "Transmission.fUnknown [9] = %f\n", pHandling->Transmission.fUnknown [9] ); - fprintf ( poo, "Transmission.fUnknown [10] = %f\n", pHandling->Transmission.fUnknown [10] ); - fprintf ( poo, "Transmission.fUnknown [11] = %f\n", pHandling->Transmission.fUnknown [11] ); - fprintf ( poo, "Transmission.fUnknown [12] = %f\n", pHandling->Transmission.fUnknown [12] ); - fprintf ( poo, "Transmission.fUnknown [13] = %f\n", pHandling->Transmission.fUnknown [13] ); - fprintf ( poo, "Transmission.fUnknown [14] = %f\n", pHandling->Transmission.fUnknown [14] ); - fprintf ( poo, "Transmission.fUnknown [15] = %f\n", pHandling->Transmission.fUnknown [15] ); - fprintf ( poo, "Transmission.fUnknown [16] = %f\n", pHandling->Transmission.fUnknown [16] ); - fprintf ( poo, "Transmission.fUnknown [17] = %f\n", pHandling->Transmission.fUnknown [17] ); - - fprintf ( poo, "Transmission.ucDriveType = %c\n", pHandling->Transmission.ucDriveType ); - fprintf ( poo, "Transmission.ucEngineType = %c\n", pHandling->Transmission.ucEngineType ); - fprintf ( poo, "Transmission.ucNumberOfGears = %u\n", pHandling->Transmission.ucNumberOfGears ); - fprintf ( poo, "Transmission.ucUnknown = %u\n", pHandling->Transmission.ucUnknown ); - - fprintf ( poo, "Transmission.uiHandlingFlags = 0x%X\n", pHandling->Transmission.uiHandlingFlags ); - - fprintf ( poo, "Transmission.fEngineAcceleration = %f\n", pHandling->Transmission.fEngineAcceleration ); - fprintf ( poo, "Transmission.fEngineInertia = %f\n", pHandling->Transmission.fEngineInertia ); - fprintf ( poo, "Transmission.fMaxVelocity = %f\n", pHandling->Transmission.fMaxVelocity ); - - fprintf ( poo, "Transmission.fUnknown2 [0] = %f\n", pHandling->Transmission.fUnknown2 [0] ); - fprintf ( poo, "Transmission.fUnknown2 [1] = %f\n", pHandling->Transmission.fUnknown2 [1] ); - fprintf ( poo, "Transmission.fUnknown2 [2] = %f\n", pHandling->Transmission.fUnknown2 [2] ); - - fprintf ( poo, "fBrakeDeceleration = %f\n", pHandling->fBrakeDeceleration ); - fprintf ( poo, "fBrakeBias = %f\n", pHandling->fBrakeBias ); - fprintf ( poo, "bABS = %u\n", pHandling->bABS ); - - fprintf ( poo, "fSteeringLock = %f\n", pHandling->fSteeringLock ); - fprintf ( poo, "fTractionLoss = %f\n", pHandling->fTractionLoss ); - fprintf ( poo, "fTractionBias = %f\n", pHandling->fTractionBias ); - - fprintf ( poo, "fSuspensionForceLevel = %f\n", pHandling->fSuspensionForceLevel ); - fprintf ( poo, "fSuspensionDamping = %f\n", pHandling->fSuspensionDamping ); - fprintf ( poo, "fSuspensionHighSpdDamping = %f\n", pHandling->fSuspensionHighSpdDamping ); - fprintf ( poo, "fSuspensionUpperLimit = %f\n", pHandling->fSuspensionUpperLimit ); - fprintf ( poo, "fSuspensionLowerLimit = %f\n", pHandling->fSuspensionLowerLimit ); - fprintf ( poo, "fSuspensionFrontRearBias = %f\n", pHandling->fSuspensionFrontRearBias ); - fprintf ( poo, "fSuspensionAntiDiveMultiplier = %f\n", pHandling->fSuspensionAntiDiveMultiplier ); - - fprintf ( poo, "fCollisionDamageMultiplier = %f\n", pHandling->fCollisionDamageMultiplier ); - - fprintf ( poo, "uiModelFlags = %X\n", pHandling->uiModelFlags ); - fprintf ( poo, "uiHandlingFlags = %X\n", pHandling->uiHandlingFlags ); - fprintf ( poo, "fSeatOffsetDistance = %f\n", pHandling->fSeatOffsetDistance ); - fprintf ( poo, "uiMonetary = %u\n", pHandling->uiMonetary ); - - fprintf ( poo, "ucHeadLight = 0x%X\n", pHandling->ucHeadLight ); - fprintf ( poo, "ucTailLight = 0x%X\n", pHandling->ucTailLight ); - fprintf ( poo, "ucAnimGroup = 0x%X\n", pHandling->ucAnimGroup ); - fprintf ( poo, "ucUnused = 0x%X\n", pHandling->ucUnused ); - - fprintf ( poo, "iUnknown7 = %f, %X\n", pHandling->iUnknown7, pHandling->iUnknown7 ); - - pHandling += 1; - } - - - g_pCore->ChatPrintf ( "Dumped", false ); - fclose ( poo ); - } - } - */ - - else if (strnicmp(szString, "moveug", 6) == 0) - { - if (pVehicleManager->Count() > 0) - { - CClientVehicle* pVehicle = *pVehicleManager->IterBegin(); - - /* - CClientPed* pModel = pVehicle->GetOccupant ( 0 ); - if ( !pModel ) - { - CClientPlayer* pPlayer = new CClientPlayer ( g_pClientGame->GetManager (), 50 ); - pModel = pPlayer->LoadModel ( 0 ); - pModel->WarpIntoVehicle ( pVehicle ); - } - */ - - pVehicle->RemoveTargetPosition(); - pVehicle->RemoveTargetRotation(); - - CVector vecT; - pVehicle->GetPosition(vecT); - vecT.fZ = (float)atof(szString + 7); - pVehicle->SetPosition(vecT); - - g_pCore->ChatPrintf("Done", false); - } - } - - else if (strnicmp(szString, "nocol", 5) == 0) - { - if (pVehicleManager->Count() > 0) - { - CClientVehicle* pVehicle = *pVehicleManager->IterBegin(); - pVehicle->SetCollisionEnabled(false); - - g_pCore->ChatPrintf("Done", false); - } - } - - else if (stricmp(szString, "resetdamage") == 0) - { - g_pClientGame->GetPlayerManager()->GetLocalPlayer()->GetGamePlayer()->ResetLastDamage(); - } - - else if (strnicmp(szString, "fuckveh", 7) == 0) - { - CClientVehicle* pVehicle = pLocal->GetOccupiedVehicle(); - if (pVehicle) - { - pVehicle->SetTargetPosition(CVector(0, 0, 0), TICK_RATE); - pVehicle->SetTargetRotation(CVector(0, 0, 0), TICK_RATE); - - g_pCore->ChatPrintf("Done", false); - } - } - - else if (stricmp(szString, "ped") == 0) - { - CClientPed* pPed = new CClientPed(g_pClientGame->GetManager(), INVALID_ELEMENT_ID, 9); - vecLocal.fX += 5.0f; - pPed->SetPosition(vecLocal); - } - - else if (strnicmp(szString, "callit", 6) == 0) - { - FILE* pFile = fopen("C:/dump.txt", "w+"); - - for (int i = 0; i < 400; i++) - { - int iIndex = i; - const char* szName = NULL; - _asm - { - mov eax, 0x4D3A30 - push iIndex - call eax - mov szName, eax - add esp, 4 - } - - fprintf(pFile, "%i: %s\n", iIndex, szName); - } - - fclose(pFile); - } - - /*else if (strnicmp(szString, "veh", 3) == 0) - { - int i = 600; - FILE* p = fopen("C:/dump.txt", "w+"); - - for (int a = 0; a < 13; a++) - { - g_pGame->GetModelInfo(i)->ModelAddRef(BLOCKING, "CFoo::Test"); - - CVehicle* pVehicle = g_pGame->GetPools()->AddVehicle((eVehicleTypes)i, 5, 5); - DWORD* dw2 = (DWORD*)(((DWORD)pVehicle->GetVehicleInterface()) + 0xE1 * 4); - DWORD dw = *dw2; - dw = dw + 4; - dw = dw - 0xC2B9E0; - dw = dw / 224; - fprintf(p, "Array [%u] = %u;\n", i, dw); - - g_pGame->GetPools()->RemoveVehicle(pVehicle); - - fflush(p); - - g_pGame->GetModelInfo(i)->RemoveRef(); - - i++; - } - - fclose(p); - }*/ - - else if (strnicmp(szString, "groups", 6) == 0) - { - FILE* pFile = fopen("C:/dump.txt", "w+"); - - int i = 0; - for (; i < 139; i++) - { - fprintf(pFile, "==%s [%s] (%i)==\n", pGroups[i].szGroupName, pGroups[i].szSomething, i); - uint i2 = 0; - for (; i2 < pGroups[i].ulAnimCount; i2++) - { - const char* szAnimName = pGroups[i].pAnimNames[i2]; - if (szAnimName[0]) - { - fprintf(pFile, "''%i'': %s
\n", i2, szAnimName); - } - } - - fprintf(pFile, "\n"); - } - - fclose(pFile); - } - - else if (strnicmp(szString, "getshot", 7) == 0) - { - if (pLocal->GetGamePlayer()->GetCanBeShotInVehicle()) - { - g_pCore->ChatEcho("true"); - } - else - { - g_pCore->ChatEcho("false"); - } - } - - else if (strnicmp(szString, "gettest", 7) == 0) - { - if (pLocal->GetGamePlayer()->GetTestForShotInVehicle()) - { - g_pCore->ChatEcho("true"); - } - else - { - g_pCore->ChatEcho("false"); - } - } - - else if (strnicmp(szString, "setshot", 7) == 0) - { - pLocal->GetGamePlayer()->SetCanBeShotInVehicle(true); - } - - else if (strnicmp(szString, "settest", 8) == 0) - { - pLocal->GetGamePlayer()->SetTestForShotInVehicle(true); - } - - else if (stricmp(szString, "applytest") == 0) - { - DWORD oldProt, oldProt2; - VirtualProtect((LPVOID)0x5E8FFB, 6, PAGE_EXECUTE_READWRITE, &oldProt); - - *(unsigned char*)(0x5E8FFB) = 0x90; - *(unsigned char*)(0x5E8FFC) = 0x90; - *(unsigned char*)(0x5E8FFD) = 0x90; - *(unsigned char*)(0x5E8FFE) = 0x90; - *(unsigned char*)(0x5E8FFF) = 0x90; - *(unsigned char*)(0x5E9000) = 0x90; - - VirtualProtect((LPVOID)0x5E8FFB, 6, oldProt, &oldProt2); - } -} - -#endif diff --git a/Client/mods/deathmatch/logic/CFoo.h b/Client/mods/deathmatch/logic/CFoo.h deleted file mode 100644 index f5ed770763..0000000000 --- a/Client/mods/deathmatch/logic/CFoo.h +++ /dev/null @@ -1,31 +0,0 @@ -/***************************************************************************** - * - * PROJECT: Multi Theft Auto v1.0 - * LICENSE: See LICENSE in the top level directory - * FILE: mods/deathmatch/logic/CFoo.h - * PURPOSE: Debugging class (not used in Release mode) - * - * Multi Theft Auto is available from http://www.multitheftauto.com/ - * - *****************************************************************************/ - -/* This class is purely for debugging things. This will avoid usage of CClientGame. */ - -#pragma once - -class CFoo -{ -public: - #ifdef MTA_DEBUG - void Init(class CClientGame* pClientGame) { g_pClientGame = pClientGame; }; - - void DoPulse(); - void Test(const char* szString); - - class CClientGame* g_pClientGame; - #else - void Init(CClientGame* pClientGame){}; - void DoPulse(){}; - void Test(const char* szString){}; - #endif -}; diff --git a/Client/multiplayer_sa/CMultiplayerSA.cpp b/Client/multiplayer_sa/CMultiplayerSA.cpp index ad8f6eb576..7dbb168fcb 100644 --- a/Client/multiplayer_sa/CMultiplayerSA.cpp +++ b/Client/multiplayer_sa/CMultiplayerSA.cpp @@ -198,6 +198,9 @@ DWORD RETURN_ProcessEntityCollision = 0x4185C0; #define HOOKPOS_PreFxRender 0x049E650 DWORD RETURN_PreFxRender = 0x0404D1E; +#define HOOKPOS_PostColorFilterRender 0x705099 +DWORD RETURN_PostColorFilterRender = 0x70509E; + #define HOOKPOS_PreHUDRender 0x053EAD8 DWORD RETURN_PreHUDRender = 0x053EADD; @@ -307,7 +310,6 @@ bool bHideRadar; bool bHasProcessedScript; float fX, fY, fZ; DWORD RoadSignFixTemp; -DWORD dwEAEG = 0; bool m_bExplosionsDisabled; float fGlobalGravity = 0.008f; float fLocalPlayerGravity = 0.008f; @@ -377,6 +379,7 @@ PostWorldProcessHandler* m_pPostWorldProcessHandler = NULL; PostWorldProcessPedsAfterPreRenderHandler* m_postWorldProcessPedsAfterPreRenderHandler = nullptr; IdleHandler* m_pIdleHandler = NULL; PreFxRenderHandler* m_pPreFxRenderHandler = NULL; +PostColorFilterRenderHandler* m_pPostColorFilterRenderHandler = nullptr; PreHudRenderHandler* m_pPreHudRenderHandler = NULL; ProcessCollisionHandler* m_pProcessCollisionHandler = NULL; HeliKillHandler* m_pHeliKillHandler = NULL; @@ -479,6 +482,7 @@ void HOOK_Transmission_CalculateDriveAcceleration(); void HOOK_isVehDriveTypeNotRWD(); void HOOK_isVehDriveTypeNotFWD(); void HOOK_PreFxRender(); +void HOOK_PostColorFilterRender(); void HOOK_PreHUDRender(); void HOOK_CTrafficLights_GetPrimaryLightState(); @@ -657,6 +661,7 @@ void CMultiplayerSA::InitHooks() HookInstall(HOOKPOS_VehColCB, (DWORD)HOOK_VehColCB, 29); HookInstall(HOOKPOS_VehCol, (DWORD)HOOK_VehCol, 9); HookInstall(HOOKPOS_PreFxRender, (DWORD)HOOK_PreFxRender, 5); + HookInstall(HOOKPOS_PostColorFilterRender, (DWORD)HOOK_PostColorFilterRender, 5); HookInstall(HOOKPOS_PreHUDRender, (DWORD)HOOK_PreHUDRender, 5); HookInstall(HOOKPOS_CAutomobile__ProcessSwingingDoor, (DWORD)HOOK_CAutomobile__ProcessSwingingDoor, 7); @@ -2315,6 +2320,11 @@ void CMultiplayerSA::SetPreFxRenderHandler(PreFxRenderHandler* pHandler) m_pPreFxRenderHandler = pHandler; } +void CMultiplayerSA::SetPostColorFilterRenderHandler(PostColorFilterRenderHandler* pHandler) +{ + m_pPostColorFilterRenderHandler = pHandler; +} + void CMultiplayerSA::SetPreHudRenderHandler(PreHudRenderHandler* pHandler) { m_pPreHudRenderHandler = pHandler; @@ -3394,31 +3404,6 @@ static void RestoreAlphaValues() /** ** Vehicles **/ -static RpAtomic* CVehicle_EAEG(RpAtomic* pAtomic, void*) -{ - RwFrame* pFrame = ((RwFrame*)(((RwObject*)(pAtomic))->parent)); - if (pFrame) - { - switch (pFrame->szName[0]) - { - case '\0': - case 'h': - break; - default: - DWORD dwFunc = (DWORD)0x533290; - DWORD dwAtomic = (DWORD)pAtomic; - _asm - { - push 0 - push dwAtomic - call dwFunc - add esp, 0x8 - } - } - } - - return pAtomic; -} static void SetVehicleAlpha() { @@ -3427,15 +3412,6 @@ static void SetVehicleAlpha() if (ucAlpha < 255) GetAlphaAndSetNewValues(ucAlpha); - else if (dwEAEG && pInterface->m_pVehicle->GetModelIndex() == 0x20A) - { - bEntityHasAlpha = true; - uiAlphaIdx = 0; - SetEntityAlphaHooked(dwAlphaEntity, (DWORD)HOOK_GetAlphaValues, 0); - MemPutFast(0x5332D6, (DWORD)CVehicle_EAEG); - SetEntityAlphaHooked(dwAlphaEntity, (DWORD)HOOK_SetAlphaValues, 0); - MemPutFast(0x5332D6, 0x533290); - } else bEntityHasAlpha = false; } @@ -3947,8 +3923,6 @@ void CMultiplayerSA::SetLocalStatValue(unsigned short usStat, float fValue) localStatsData.StatTypesFloat[usStat] = fValue; else if (usStat >= STATS_OFFSET && usStat < MAX_INT_FLOAT_STATS) localStatsData.StatTypesInt[usStat - STATS_OFFSET] = (int)fValue; - else if (usStat == 0x2329) - dwEAEG = !dwEAEG; } float CMultiplayerSA::GetLocalStatValue(unsigned short usStat) @@ -4780,6 +4754,24 @@ void _declspec(naked) HOOK_PreFxRender() } } +// Hooked from 00705099 5 bytes +void _declspec(naked) HOOK_PostColorFilterRender() +{ + _asm + { + pushad + } + + if (m_pPostColorFilterRenderHandler) m_pPostColorFilterRenderHandler(); + + _asm + { + popad + mov al, ds:0C402BAh + jmp RETURN_PostColorFilterRender // 0070509E + } +} + // Hooked from 0053EAD8 5 bytes void _declspec(naked) HOOK_PreHUDRender() { diff --git a/Client/multiplayer_sa/CMultiplayerSA.h b/Client/multiplayer_sa/CMultiplayerSA.h index fd81a18828..12daeb26be 100644 --- a/Client/multiplayer_sa/CMultiplayerSA.h +++ b/Client/multiplayer_sa/CMultiplayerSA.h @@ -115,6 +115,7 @@ class CMultiplayerSA : public CMultiplayer void SetPostWorldProcessPedsAfterPreRenderHandler(PostWorldProcessPedsAfterPreRenderHandler* pHandler); void SetIdleHandler(IdleHandler* pHandler); void SetPreFxRenderHandler(PreFxRenderHandler* pHandler); + void SetPostColorFilterRenderHandler(PostColorFilterRenderHandler* pHandler) override; void SetPreHudRenderHandler(PreHudRenderHandler* pHandler); void DisableCallsToCAnimBlendNode(bool bDisableCalls); void SetCAnimBlendAssocDestructorHandler(CAnimBlendAssocDestructorHandler* pHandler); diff --git a/Client/sdk/core/CCoreInterface.h b/Client/sdk/core/CCoreInterface.h index 25c578a25a..aea1ca9054 100644 --- a/Client/sdk/core/CCoreInterface.h +++ b/Client/sdk/core/CCoreInterface.h @@ -192,6 +192,8 @@ class CCoreInterface virtual const SString& GetLastConnectedServerName() const = 0; virtual void SetLastConnectedServerName(const SString& strServerName) = 0; + + virtual void OnPostColorFilterRender() = 0; }; class CClientTime diff --git a/Client/sdk/multiplayer/CMultiplayer.h b/Client/sdk/multiplayer/CMultiplayer.h index 23c6f2ac15..48f1f3246c 100644 --- a/Client/sdk/multiplayer/CMultiplayer.h +++ b/Client/sdk/multiplayer/CMultiplayer.h @@ -102,6 +102,7 @@ typedef void(PostWorldProcessHandler)(); typedef void(PostWorldProcessPedsAfterPreRenderHandler)(); typedef void(IdleHandler)(); typedef void(PreFxRenderHandler)(); +typedef void(PostColorFilterRenderHandler)(); typedef void(PreHudRenderHandler)(); typedef CAnimBlendAssociationSAInterface*(AddAnimationHandler)(RpClump* pClump, AssocGroupId animGroup, AnimationId animID); typedef CAnimBlendAssociationSAInterface*(AddAnimationAndSyncHandler)(RpClump* pClump, CAnimBlendAssociationSAInterface* pAnimAssocToSyncWith, @@ -231,6 +232,7 @@ class CMultiplayer virtual void SetPostWorldProcessPedsAfterPreRenderHandler(PostWorldProcessPedsAfterPreRenderHandler* pHandler) = 0; virtual void SetIdleHandler(IdleHandler* pHandler) = 0; virtual void SetPreFxRenderHandler(PreFxRenderHandler* pHandler) = 0; + virtual void SetPostColorFilterRenderHandler(PostColorFilterRenderHandler* pHandler) = 0; virtual void SetPreHudRenderHandler(PreHudRenderHandler* pHandler) = 0; virtual void DisableCallsToCAnimBlendNode(bool bDisableCalls) = 0; virtual void SetCAnimBlendAssocDestructorHandler(CAnimBlendAssocDestructorHandler* pHandler) = 0; diff --git a/Client/utils/wpmhookdll/Main.cpp b/Client/utils/wpmhookdll/Main.cpp deleted file mode 100644 index 350a558a33..0000000000 --- a/Client/utils/wpmhookdll/Main.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/***************************************************************************** - * - * PROJECT: Multi Theft Auto v1.0 - * LICENSE: See LICENSE in the top level directory - * FILE: utils/wpmhookdll/Main.cpp - * PURPOSE: Memory manipulation hooking utility - * - * Multi Theft Auto is available from http://www.multitheftauto.com/ - * - *****************************************************************************/ - -#define WIN32_LEAN_AND_MEAN -#include -#include -#include - -using namespace std; - -#define MESSAGE_MONITOR_START 0x8500 -#define MESSAGE_MONITOR_END 0x8501 -#define MESSAGE_MONITOR_RPM 0x8502 -#define MESSAGE_MONITOR_WPM 0x8503 - -HWND hGTA = NULL; - -// ******** ReadProcessMemory hook! ********* -typedef BOOL(WINAPI* pReadProcessMemory)(HANDLE hProcess, LPCVOID lpBaseAddress, LPVOID lpBuffer, SIZE_T nSize, SIZE_T* lpNumberOfBytesRead); - -pReadProcessMemory pfnReadProcessMemory = NULL; - -BOOL WINAPI Hook_ReadProcessMemory(HANDLE hProcess, LPCVOID lpBaseAddress, LPVOID lpBuffer, SIZE_T nSize, SIZE_T* lpNumberOfBytesRead) -{ - // Tell MTA about the RPM call - PostMessage(hGTA, MESSAGE_MONITOR_RPM, reinterpret_cast(lpBaseAddress), nSize); - - // Call the original WriteProcessMemory - return pfnReadProcessMemory(hProcess, lpBaseAddress, lpBuffer, nSize, lpNumberOfBytesRead); -} - -// ******** WriteProcessMemory hook! ********* -typedef BOOL(WINAPI* pWriteProcessMemory)(HANDLE hProcess, LPVOID lpBaseAddress, LPCVOID lpBuffer, SIZE_T nSize, SIZE_T* lpNumberOfBytesWritten); - -pWriteProcessMemory pfnWriteProcessMemory = NULL; - -BOOL WINAPI Hook_WriteProcessMemory(HANDLE hProcess, LPVOID lpBaseAddress, LPCVOID lpBuffer, SIZE_T nSize, SIZE_T* lpNumberOfBytesWritten) -{ - // Tell MTA about the WPM call - PostMessage(hGTA, MESSAGE_MONITOR_WPM, reinterpret_cast(lpBaseAddress), nSize); - - // Call the original WriteProcessMemory - return pfnWriteProcessMemory(hProcess, lpBaseAddress, lpBuffer, nSize, lpNumberOfBytesWritten); -} - -void Initialize(void) -{ - // Grab the GTA window handle - hGTA = FindWindow("Grand theft auto San Andreas", NULL); - if (hGTA != NULL) - { - // Make sure Kernel32.dll is loaded - PBYTE pKernel32 = reinterpret_cast(LoadLibrary("Kernel32.dll")); - if (pKernel32) - { - // Hook ReadProcessMemory - pfnReadProcessMemory = reinterpret_cast( - DetourFunction(DetourFindFunction("Kernel32.dll", "ReadProcessMemory"), reinterpret_cast(Hook_ReadProcessMemory))); - - // Hook WriteProcessMemory - pfnWriteProcessMemory = reinterpret_cast( - DetourFunction(DetourFindFunction("Kernel32.dll", "WriteProcessMemory"), reinterpret_cast(Hook_WriteProcessMemory))); - - // Success? - if (pfnReadProcessMemory && pfnWriteProcessMemory) - { - // Tell MTA we successfully hooked the trainer - PostMessage(hGTA, MESSAGE_MONITOR_START, 0, 0); - return; - } - } - - // Tell MTA we successfully injected but failed hooking the functions - PostMessage(hGTA, MESSAGE_MONITOR_START, 1, 1); - } -} - -void Finalize(void) -{ - // Unhook WriteProcessMemory - if (pfnWriteProcessMemory) - { - DetourRemove(reinterpret_cast(pfnWriteProcessMemory), reinterpret_cast(Hook_WriteProcessMemory)); - } - - // Unhook ReadProcessMemory - if (pfnReadProcessMemory) - { - DetourRemove(reinterpret_cast(pfnReadProcessMemory), reinterpret_cast(Hook_ReadProcessMemory)); - } - - // Tell MTA we've unhooked from the trainer - if (hGTA != NULL) - { - PostMessage(hGTA, MESSAGE_MONITOR_END, 0, 0); - } -} - -int WINAPI DllMain(HINSTANCE hModule, DWORD dwReason, PVOID pvNothing) -{ - switch (dwReason) - { - case DLL_PROCESS_ATTACH: - { - Initialize(); - return TRUE; - } - - case DLL_PROCESS_DETACH: - { - Finalize(); - return TRUE; - } - } - - return FALSE; -} diff --git a/Client/utils/wpmhookdll/wpmhookdll.sln b/Client/utils/wpmhookdll/wpmhookdll.sln deleted file mode 100644 index 6af2e1dc45..0000000000 --- a/Client/utils/wpmhookdll/wpmhookdll.sln +++ /dev/null @@ -1,21 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 8.00 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wpmhookdll", "wpmhookdll.vcproj", "{BA915391-732D-40BB-9C25-4416DCC53B80}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - Debug = Debug - Release = Release - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {BA915391-732D-40BB-9C25-4416DCC53B80}.Debug.ActiveCfg = Debug|Win32 - {BA915391-732D-40BB-9C25-4416DCC53B80}.Debug.Build.0 = Debug|Win32 - {BA915391-732D-40BB-9C25-4416DCC53B80}.Release.ActiveCfg = Release|Win32 - {BA915391-732D-40BB-9C25-4416DCC53B80}.Release.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/Client/utils/wpmhookdll/wpmhookdll.vcproj b/Client/utils/wpmhookdll/wpmhookdll.vcproj deleted file mode 100644 index 9b169e32ac..0000000000 --- a/Client/utils/wpmhookdll/wpmhookdll.vcproj +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/README.md b/README.md index 3fa1d8db7a..0173284d06 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,9 @@ Our project's code repository can be found on the [multitheftauto/mtasa-blue](ht #### Windows Prerequisites -- [Visual Studio 2022](https://visualstudio.microsoft.com/vs/) +- [Visual Studio 2022](https://visualstudio.microsoft.com/vs/) with: + - Desktop development with C++ + - Optional component *C++ MFC for latest v143 build tools (x86 & x64)* - [Microsoft DirectX SDK](https://wiki.multitheftauto.com/wiki/Compiling_MTASA#Microsoft_DirectX_SDK) - [Git for Windows](https://git-scm.com/download/win) (Optional) @@ -48,13 +50,15 @@ Prerequisites 3. Compile 4. Execute: `win-install-data.bat` +Visit the wiki article ["Compiling MTASA"](https://wiki.multitheftauto.com/wiki/Compiling_MTASA) for additional information and error troubleshooting. + #### GNU/Linux You can build the MTA:SA server on GNU/Linux distributions only for x86, x86_64, armhf and arm64 CPU architectures. ARM architectures are currently in **experimental phase**, which means they're unstable, untested and may crash randomly. Beware that we only officially support building from x86_64 and that includes cross-compiling for x86, arm and arm64. **Build dependencies** -*Please always read the Dockerfiles for up-to-date build dependencies.* +*Please always read the Dockerfiles for up-to-date build dependencies.* *Note: ncftp is not required for building the MTA:SA server.* - git diff --git a/Server/mods/deathmatch/logic/CGame.cpp b/Server/mods/deathmatch/logic/CGame.cpp index a965d160e5..75fc4aaae6 100644 --- a/Server/mods/deathmatch/logic/CGame.cpp +++ b/Server/mods/deathmatch/logic/CGame.cpp @@ -3659,6 +3659,7 @@ void CGame::Packet_Vehicle_InOut(CVehicleInOutPacket& Packet) if (pPed->GetVehicleAction() == CPed::VEHICLEACTION_JACKING) { unsigned char ucDoor = Packet.GetDoor(); + unsigned char ucOccupiedSeat = pPed->GetOccupiedVehicleSeat(); float fAngle = Packet.GetDoorAngle(); CPed* pJacked = pVehicle->GetOccupant(0); @@ -3692,6 +3693,29 @@ void CGame::Packet_Vehicle_InOut(CVehicleInOutPacket& Packet) CVehicleInOutPacket JackedReply(pJacked->GetID(), VehicleID, 0, VEHICLE_NOTIFY_OUT_RETURN); m_pPlayerManager->BroadcastOnlyJoined(JackedReply); + CLuaArguments Arguments; + Arguments.PushElement(pVehicle); // vehicle + Arguments.PushNumber(ucOccupiedSeat); // seat + Arguments.PushElement(pPed); // jacker + Arguments.PushBoolean(false); // forcedByScript + + if (pJacked->IsPlayer()) + { + pJacked->CallEvent("onPlayerVehicleExit", Arguments); + } + else + { + pJacked->CallEvent("onPedVehicleExit", Arguments); + } + + CLuaArguments Arguments2; + Arguments2.PushElement(pJacked); // jacked + Arguments2.PushNumber(ucOccupiedSeat); // seat + Arguments2.PushElement(pPed); // jacker + Arguments2.PushBoolean(false); // forcedByScript + + pVehicle->CallEvent("onVehicleExit", Arguments2); + if (!sendListIncompatiblePlayers.empty()) { // Warp the ped out of the vehicle manually for incompatible players diff --git a/Shared/data/MTA San Andreas/MTA/locale/en_US/client.pot b/Shared/data/MTA San Andreas/MTA/locale/en_US/client.pot index 801286d0e7..18600f065a 100644 --- a/Shared/data/MTA San Andreas/MTA/locale/en_US/client.pot +++ b/Shared/data/MTA San Andreas/MTA/locale/en_US/client.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: MTA San Andreas 1.x\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-06-16 01:10+0000\n" +"POT-Creation-Date: 2024-06-21 20:59+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -18,6 +18,44 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" +#. Create buttons +#. OK button +#: Client/gui/CGUIMessageBox_Impl.cpp:64 Client/core/CSettings.cpp:127 +#: Client/core/CSettings.cpp:4785 Client/core/CVersionUpdater.cpp:1607 +#: Client/core/CVersionUpdater.cpp:1823 Client/core/CVersionUpdater.cpp:1916 +#: Client/core/CVersionUpdater.cpp:1938 Client/core/CVersionUpdater.cpp:1956 +#: Client/core/CVersionUpdater.cpp:1968 Client/core/CVersionUpdater.cpp:2120 +#: Client/core/CVersionUpdater.cpp:2129 Client/core/CVersionUpdater.cpp:2138 +#: Client/core/CVersionUpdater.cpp:2152 Client/loader/Dialogs.cpp:133 +msgid "OK" +msgstr "" + +#. Cancel button +#: Client/gui/CGUIMessageBox_Impl.cpp:68 Client/core/CSettings.cpp:132 +#: Client/core/CSettings.cpp:4784 Client/core/CVersionUpdater.cpp:1790 +#: Client/core/CVersionUpdater.cpp:1806 Client/core/CVersionUpdater.cpp:1841 +#: Client/mods/deathmatch/logic/CLocalServer.cpp:123 +#: Client/loader/Dialogs.cpp:136 +msgid "Cancel" +msgstr "" + +#. ///////////////////////////////////////////////////////////////////////// +#. +#. Dialog strings +#. +#. +#. ///////////////////////////////////////////////////////////////////////// +#: Client/gui/CGUIMessageBox_Impl.cpp:72 Client/core/CSettings.cpp:1389 +#: Client/core/CSettings.cpp:1413 Client/core/CSettings.cpp:4489 +#: Client/core/CSettings.cpp:4563 Client/core/CSettings.cpp:4593 +#: Client/core/CSettings.cpp:4642 Client/core/CQuestionBox.cpp:195 +#: Client/core/CVersionUpdater.cpp:1572 Client/core/CVersionUpdater.cpp:1590 +#: Client/core/CVersionUpdater.cpp:1859 Client/core/CVersionUpdater.cpp:1878 +#: Client/core/CMainMenu.cpp:1200 Client/core/ServerBrowser/CServerInfo.cpp:479 +#: Client/loader/Dialogs.cpp:131 +msgid "Yes" +msgstr "" + #: Client/game_sa/CSettingsSA.cpp:753 msgid "Can't find valid screen resolution." msgstr "" @@ -31,1499 +69,1434 @@ msgstr "" msgid "MTA: San Andreas" msgstr "" -#: Client/loader/CInstallManager.cpp:361 Client/loader/Utils.cpp:968 -#, c-format -msgid "" -"MTA:SA needs Administrator access for the following task:\n" -"\n" -" '%s'\n" -"\n" -"Please confirm in the next window." -msgstr "" - -#: Client/loader/CInstallManager.cpp:376 -#, c-format -msgid "" -"MTA:SA could not complete the following task:\n" -"\n" -" '%s'\n" -msgstr "" - -#: Client/loader/CInstallManager.cpp:426 -msgid "" -"** The crash was caused by a graphics driver error **\n" -"\n" -"** Please update your graphics drivers **" -msgstr "" - -#: Client/loader/CInstallManager.cpp:532 -msgid "Install updated MTA:SA files" -msgstr "" - -#: Client/loader/CInstallManager.cpp:552 +#. Even the default skin doesn't work, so give up +#: Client/core/CGUI.cpp:86 msgid "" -"Could not update due to file conflicts. Please close other applications and " -"retry" +"The skin you selected could not be loaded, and the default skin also could " +"not be loaded, please reinstall MTA." msgstr "" -#. Show timeout message and disconnect -#. Display an error, reset the error status and exit #. Show a message that the connection timed out and abort #. Show failed message and abort the attempt -#: Client/loader/CInstallManager.cpp:552 Client/loader/CInstallManager.cpp:561 -#: Client/loader/MainFunctions.cpp:252 Client/loader/MainFunctions.cpp:267 -#: Client/loader/MainFunctions.cpp:269 Client/loader/MainFunctions.cpp:846 -#: Client/mods/deathmatch/logic/CResourceFileDownloadManager.cpp:145 -#: Client/mods/deathmatch/logic/CClientGame.cpp:636 -#: Client/mods/deathmatch/logic/CClientGame.cpp:710 -#: Client/mods/deathmatch/logic/CClientGame.cpp:734 -#: Client/mods/deathmatch/logic/CClientGame.cpp:756 -#: Client/mods/deathmatch/logic/CClientGame.cpp:1172 -#: Client/mods/deathmatch/logic/CClientGame.cpp:1252 -#: Client/mods/deathmatch/logic/CClientGame.cpp:1262 -#: Client/mods/deathmatch/logic/CClientGame.cpp:1331 -#: Client/mods/deathmatch/logic/CClientGame.cpp:1368 -#: Client/mods/deathmatch/logic/CClientGame.cpp:1417 -#: Client/mods/deathmatch/logic/CClientGame.cpp:1429 -#: Client/core/CConnectManager.cpp:80 Client/core/CConnectManager.cpp:111 -#: Client/core/CConnectManager.cpp:127 Client/core/CConnectManager.cpp:263 -#: Client/core/CConnectManager.cpp:321 Client/core/CConnectManager.cpp:404 -#: Client/core/CConnectManager.cpp:411 Client/core/CConnectManager.cpp:421 -#: Client/core/CCore.cpp:1275 Client/core/CCore.cpp:1288 -#: Client/core/CSettings.cpp:2941 Client/core/CSettings.cpp:4166 -#: Client/core/CSettings.cpp:4194 Client/core/CSettings.cpp:4764 -#: Client/core/CGUI.cpp:87 Client/core/DXHook/CDirect3DHook9.cpp:127 -#: Client/core/ServerBrowser/CServerBrowser.cpp:1278 +#. Show timeout message and disconnect +#. Display an error, reset the error status and exit +#: Client/core/CGUI.cpp:87 Client/core/CSettings.cpp:2941 +#: Client/core/CSettings.cpp:4166 Client/core/CSettings.cpp:4194 +#: Client/core/CSettings.cpp:4764 Client/core/CConnectManager.cpp:80 +#: Client/core/CConnectManager.cpp:111 Client/core/CConnectManager.cpp:127 +#: Client/core/CConnectManager.cpp:263 Client/core/CConnectManager.cpp:321 +#: Client/core/CConnectManager.cpp:404 Client/core/CConnectManager.cpp:411 +#: Client/core/CConnectManager.cpp:421 Client/core/CCore.cpp:1275 +#: Client/core/CCore.cpp:1288 Client/core/ServerBrowser/CServerBrowser.cpp:1278 #: Client/core/ServerBrowser/CServerBrowser.cpp:1300 #: Client/core/ServerBrowser/CServerBrowser.cpp:1357 #: Client/core/ServerBrowser/CServerBrowser.cpp:1406 +#: Client/core/DXHook/CDirect3DHook9.cpp:127 +#: Client/mods/deathmatch/logic/CResourceFileDownloadManager.cpp:145 +#: Client/mods/deathmatch/logic/CClientGame.cpp:635 +#: Client/mods/deathmatch/logic/CClientGame.cpp:709 +#: Client/mods/deathmatch/logic/CClientGame.cpp:733 +#: Client/mods/deathmatch/logic/CClientGame.cpp:755 +#: Client/mods/deathmatch/logic/CClientGame.cpp:1168 +#: Client/mods/deathmatch/logic/CClientGame.cpp:1248 +#: Client/mods/deathmatch/logic/CClientGame.cpp:1258 +#: Client/mods/deathmatch/logic/CClientGame.cpp:1327 +#: Client/mods/deathmatch/logic/CClientGame.cpp:1364 +#: Client/mods/deathmatch/logic/CClientGame.cpp:1413 +#: Client/mods/deathmatch/logic/CClientGame.cpp:1425 +#: Client/loader/MainFunctions.cpp:252 Client/loader/MainFunctions.cpp:267 +#: Client/loader/MainFunctions.cpp:269 Client/loader/MainFunctions.cpp:846 +#: Client/loader/CInstallManager.cpp:552 Client/loader/CInstallManager.cpp:561 #: Shared/mods/deathmatch/logic/CLatentTransferManager.cpp:378 #: Shared/sdk/SharedUtil.Misc.hpp:137 msgid "Error" msgstr "" -#: Client/loader/CInstallManager.cpp:561 -#, c-format -msgid "Multi Theft Auto has not been installed properly, please reinstall. %s" +#: Client/core/CCredits.cpp:34 +msgid "Programming" msgstr "" -#: Client/loader/CInstallManager.cpp:613 -msgid "Create GTA:SA junctions" +#: Client/core/CCredits.cpp:63 +msgid "Contributors" msgstr "" -#: Client/loader/CInstallManager.cpp:657 -msgid "MTA:SA cannot launch because copying a file failed:" +#: Client/core/CCredits.cpp:84 +msgid "Game Design / Scripting" msgstr "" -#: Client/loader/CInstallManager.cpp:663 Client/loader/CInstallManager.cpp:703 -msgid "MTA:SA cannot launch because an MTA:SA file is incorrect or missing:" +#: Client/core/CCredits.cpp:104 +msgid "Language Localization" msgstr "" -#: Client/loader/CInstallManager.cpp:672 -msgid "Copy MTA:SA files" +#: Client/core/CCredits.cpp:110 +msgid "Patch contributors" msgstr "" -#: Client/loader/CInstallManager.cpp:695 Client/loader/CInstallManager.cpp:773 -msgid "MTA:SA cannot launch because a GTA:SA file is incorrect or missing:" +#: Client/core/CCredits.cpp:234 +msgid "Special Thanks" msgstr "" -#: Client/loader/CInstallManager.cpp:780 -msgid "Patch GTA:SA dependency" +#: Client/core/CCredits.cpp:265 +msgid "" +"This software and project makes use of the following libraries and software:" msgstr "" -#: Client/loader/CInstallManager.cpp:828 -msgid "" -"MTA:SA cannot launch because the GTA:SA executable is incorrect or missing:" +#: Client/core/CScreenShot.cpp:104 +#, c-format +msgid "Screenshot got %d bytes, but expected %d" msgstr "" -#: Client/loader/CInstallManager.cpp:832 -msgid "" -"Please check your anti-virus for a false-positive detection, try to add an " -"exception for the GTA:SA executable and restart MTA:SA." +#: Client/core/CScreenShot.cpp:110 +msgid "Screenshot failed" msgstr "" -#: Client/loader/CInstallManager.cpp:838 -msgid "Generate GTA:SA" +#: Client/core/CScreenShot.cpp:160 +#, c-format +msgid "Screenshot taken: '%s'" msgstr "" -#: Client/loader/CInstallManager.cpp:853 -msgid "MTA:SA cannot launch because the GTA:SA executable is not loadable:" +#. Create the window +#: Client/core/CNewsBrowser.cpp:153 +msgid "NEWS" msgstr "" -#: Client/loader/CInstallManager.cpp:860 Client/loader/CInstallManager.cpp:883 -msgid "Patch GTA:SA" +#. News link +#: Client/core/CNewsBrowser.cpp:171 Client/core/CNewsBrowser.cpp:172 +msgid "Visit latest news article" msgstr "" -#: Client/loader/CInstallManager.cpp:876 -msgid "MTA:SA cannot launch because patching GTA:SA has failed:" +#: Client/core/CKeyBinds.cpp:186 +msgid "Fire" msgstr "" -#: Client/loader/CInstallManager.cpp:1057 Client/core/CCore.cpp:811 -#, c-format -msgid "MTA:SA cannot continue because drive %s does not have enough space." +#: Client/core/CKeyBinds.cpp:187 +msgid "Next weapon" msgstr "" -#: Client/loader/CInstallManager.cpp:1113 -msgid "Missing file:" +#: Client/core/CKeyBinds.cpp:188 +msgid "Previous weapon" msgstr "" -#: Client/loader/CInstallManager.cpp:1117 -msgid "If MTA fails to load, please re-install GTA:SA" +#: Client/core/CKeyBinds.cpp:189 +msgid "Forwards" msgstr "" -#: Client/loader/CInstallManager.cpp:1152 -msgid "Update install settings" +#: Client/core/CKeyBinds.cpp:190 +msgid "Backwards" msgstr "" -#: Client/loader/CInstallManager.cpp:1291 -msgid "Update compatibility settings" +#: Client/core/CKeyBinds.cpp:191 Client/core/CSettings.cpp:2240 +#: Client/core/CSettings.cpp:2268 +msgid "Left" msgstr "" -#: Client/loader/Utils.cpp:534 Client/loader/Dialogs.cpp:890 -msgid "Searching for Grand Theft Auto San Andreas" +#: Client/core/CKeyBinds.cpp:192 Client/core/CSettings.cpp:2242 +#: Client/core/CSettings.cpp:2269 +msgid "Right" msgstr "" -#: Client/loader/Utils.cpp:536 Client/loader/Dialogs.cpp:893 -msgid "Please start Grand Theft Auto San Andreas" +#: Client/core/CKeyBinds.cpp:193 +msgid "Zoom in" msgstr "" -#: Client/loader/Utils.cpp:600 -msgid "Select your Grand Theft Auto: San Andreas Installation Directory" +#: Client/core/CKeyBinds.cpp:194 +msgid "Zoom out" msgstr "" -#: Client/loader/Utils.cpp:1069 -#, c-format -msgid "Error loading %s module! (%s)" +#: Client/core/CKeyBinds.cpp:195 +msgid "Enter/Exit" msgstr "" -#: Client/loader/Utils.cpp:1394 Client/loader/Dialogs.cpp:914 -msgid "Copying files..." +#: Client/core/CKeyBinds.cpp:196 +msgid "Change camera" msgstr "" -#: Client/loader/Utils.cpp:1454 Client/loader/Dialogs.cpp:919 -msgid "Copy finished early. Everything OK." +#. 10 +#: Client/core/CKeyBinds.cpp:197 +msgid "Jump" msgstr "" -#: Client/loader/Utils.cpp:1460 Client/loader/Dialogs.cpp:924 -msgid "Finishing..." +#: Client/core/CKeyBinds.cpp:198 +msgid "Sprint" msgstr "" -#: Client/loader/Utils.cpp:1462 Client/loader/Dialogs.cpp:928 -msgid "Done!" +#: Client/core/CKeyBinds.cpp:199 +msgid "Look behind" msgstr "" -#: Client/loader/Utils.cpp:1502 -#, c-format -msgid "" -"New installation of %s detected.\n" -"\n" -"Do you want to copy your settings from %s ?" +#: Client/core/CKeyBinds.cpp:200 +msgid "Crouch" msgstr "" -#: Client/loader/Utils.cpp:1541 -#, c-format -msgid "GTA:SA had trouble opening the file '%s'" +#: Client/core/CKeyBinds.cpp:201 +msgid "Action" msgstr "" -#: Client/loader/Utils.cpp:1563 -#, c-format -msgid "GTA:SA is missing the file '%s'." +#: Client/core/CKeyBinds.cpp:202 +msgid "Walk" msgstr "" -#: Client/loader/Utils.cpp:1588 -msgid "GTA:SA had trouble loading a model." +#: Client/core/CKeyBinds.cpp:203 +msgid "Vehicle fire" msgstr "" -#: Client/loader/Utils.cpp:1590 -msgid "If you recently modified gta3.img, then try reinstalling GTA:SA." +#: Client/core/CKeyBinds.cpp:204 +msgid "Vehicle secondary fire" msgstr "" -#: Client/loader/Utils.cpp:1615 -msgid "GTA:SA had trouble adding an upgrade to a vehicle." +#: Client/core/CKeyBinds.cpp:205 +msgid "Vehicle left" msgstr "" -#: Client/loader/Utils.cpp:1634 -#, c-format -msgid "GTA:SA found errors in the file '%s'" +#: Client/core/CKeyBinds.cpp:206 +msgid "Vehicle right" msgstr "" -#: Client/loader/Utils.cpp:1716 -msgid "Did your computer restart when playing MTA:SA?" +#. 20 +#: Client/core/CKeyBinds.cpp:207 +msgid "Steer forwards/down" msgstr "" -#: Client/loader/Utils.cpp:1781 -msgid "Please terminate the following programs before continuing:" +#: Client/core/CKeyBinds.cpp:208 +msgid "Steer backwards/up" msgstr "" -#. ///////////////////////////////////////////////////////////////////////// -#. -#. Dialog strings -#. -#. -#. ///////////////////////////////////////////////////////////////////////// -#: Client/loader/Dialogs.cpp:131 Client/gui/CGUIMessageBox_Impl.cpp:72 -#: Client/core/CQuestionBox.cpp:195 Client/core/CSettings.cpp:1389 -#: Client/core/CSettings.cpp:1413 Client/core/CSettings.cpp:4489 -#: Client/core/CSettings.cpp:4563 Client/core/CSettings.cpp:4593 -#: Client/core/CSettings.cpp:4642 Client/core/CVersionUpdater.cpp:1572 -#: Client/core/CVersionUpdater.cpp:1590 Client/core/CVersionUpdater.cpp:1859 -#: Client/core/CVersionUpdater.cpp:1878 Client/core/CMainMenu.cpp:1200 -#: Client/core/ServerBrowser/CServerInfo.cpp:479 -msgid "Yes" +#: Client/core/CKeyBinds.cpp:209 +msgid "Accelerate" msgstr "" -#: Client/loader/Dialogs.cpp:132 Client/core/CQuestionBox.cpp:194 -#: Client/core/CSettings.cpp:1388 Client/core/CSettings.cpp:1412 -#: Client/core/CSettings.cpp:4488 Client/core/CSettings.cpp:4562 -#: Client/core/CSettings.cpp:4592 Client/core/CSettings.cpp:4641 -#: Client/core/CVersionUpdater.cpp:1571 Client/core/CVersionUpdater.cpp:1589 -#: Client/core/CVersionUpdater.cpp:1858 Client/core/CVersionUpdater.cpp:1877 -#: Client/core/CMainMenu.cpp:1199 Client/core/ServerBrowser/CServerInfo.cpp:479 -msgid "No" +#: Client/core/CKeyBinds.cpp:210 +msgid "Brake/Reverse" msgstr "" -#. Create buttons -#. OK button -#: Client/loader/Dialogs.cpp:133 Client/gui/CGUIMessageBox_Impl.cpp:64 -#: Client/core/CSettings.cpp:127 Client/core/CSettings.cpp:4785 -#: Client/core/CVersionUpdater.cpp:1607 Client/core/CVersionUpdater.cpp:1823 -#: Client/core/CVersionUpdater.cpp:1916 Client/core/CVersionUpdater.cpp:1938 -#: Client/core/CVersionUpdater.cpp:1956 Client/core/CVersionUpdater.cpp:1968 -#: Client/core/CVersionUpdater.cpp:2120 Client/core/CVersionUpdater.cpp:2129 -#: Client/core/CVersionUpdater.cpp:2138 Client/core/CVersionUpdater.cpp:2152 -msgid "OK" +#: Client/core/CKeyBinds.cpp:211 +msgid "Radio next" msgstr "" -#: Client/loader/Dialogs.cpp:134 -msgid "Quit" +#: Client/core/CKeyBinds.cpp:212 +msgid "Radio previous" msgstr "" -#: Client/loader/Dialogs.cpp:135 -#: Client/core/ServerBrowser/CServerBrowser.cpp:556 -msgid "Help" +#: Client/core/CKeyBinds.cpp:213 +msgid "Radio user track skip" msgstr "" -#. Cancel button -#: Client/loader/Dialogs.cpp:136 -#: Client/mods/deathmatch/logic/CLocalServer.cpp:123 -#: Client/gui/CGUIMessageBox_Impl.cpp:68 Client/core/CSettings.cpp:132 -#: Client/core/CSettings.cpp:4784 Client/core/CVersionUpdater.cpp:1790 -#: Client/core/CVersionUpdater.cpp:1806 Client/core/CVersionUpdater.cpp:1841 -msgid "Cancel" +#: Client/core/CKeyBinds.cpp:214 +msgid "Horn" msgstr "" -#: Client/loader/Dialogs.cpp:151 -msgid "MTA: San Andreas has encountered a problem" +#: Client/core/CKeyBinds.cpp:215 +msgid "Sub-mission" msgstr "" -#: Client/loader/Dialogs.cpp:152 -msgid "Crash information" +#: Client/core/CKeyBinds.cpp:216 +msgid "Handbrake" msgstr "" -#: Client/loader/Dialogs.cpp:153 -msgid "" -"Tick the check box to send this crash info to MTA devs using the 'internet'" +#. 30 +#: Client/core/CKeyBinds.cpp:217 +msgid "Vehicle look left" msgstr "" -#: Client/loader/Dialogs.cpp:154 -msgid "Doing so will increase the chance of this crash being fixed." +#: Client/core/CKeyBinds.cpp:218 +msgid "Vehicle look right" msgstr "" -#: Client/loader/Dialogs.cpp:155 -msgid "Do you want to restart MTA: San Andreas ?" +#: Client/core/CKeyBinds.cpp:219 +msgid "Vehicle look behind" msgstr "" -#: Client/loader/Dialogs.cpp:162 -msgid "MTA: San Andreas - Warning" +#: Client/core/CKeyBinds.cpp:220 +msgid "Vehicle mouse look" msgstr "" -#: Client/loader/Dialogs.cpp:163 -msgid "" -"Your Grand Theft Auto: San Andreas install directory contains these files:" +#: Client/core/CKeyBinds.cpp:221 +msgid "Special control left" msgstr "" -#: Client/loader/Dialogs.cpp:165 -msgid "" -"These files are not required and may interfere with the graphical features " -"in this version of MTA:SA.\n" -"\n" -"It is recommended that you remove or rename these files." +#: Client/core/CKeyBinds.cpp:222 +msgid "Special control right" msgstr "" -#: Client/loader/Dialogs.cpp:167 -msgid "Keep these files, but also show this warning on next start" +#: Client/core/CKeyBinds.cpp:223 +msgid "Special control down" msgstr "" -#: Client/loader/Dialogs.cpp:168 -msgid "Do not remind me about these files again" +#: Client/core/CKeyBinds.cpp:224 +msgid "Special control up" msgstr "" -#: Client/loader/Dialogs.cpp:169 -msgid "Rename these files from *.dll to *.dll.bak" +#: Client/core/CKeyBinds.cpp:225 +msgid "Aim weapon" msgstr "" -#: Client/loader/Dialogs.cpp:170 -msgid "Show me these files" +#: Client/core/CKeyBinds.cpp:226 +msgid "Conversation yes" msgstr "" -#: Client/loader/Dialogs.cpp:171 -msgid "Play MTA:SA" +#. 40 +#: Client/core/CKeyBinds.cpp:227 +msgid "Conversation no" msgstr "" -#: Client/loader/Dialogs.cpp:177 -msgid "MTA: San Andreas - Confusing options" +#: Client/core/CKeyBinds.cpp:228 +msgid "Group control forwards" msgstr "" -#: Client/loader/Dialogs.cpp:178 -msgid "NVidia Optimus detected!" +#: Client/core/CKeyBinds.cpp:229 +msgid "Group control backwards" msgstr "" -#: Client/loader/Dialogs.cpp:179 -msgid "Try each option and see what works:" +#: Client/core/CJoystickManager.cpp:1578 +msgid "Accelerate Axis" msgstr "" -#: Client/loader/Dialogs.cpp:180 -msgid "A - Standard NVidia" +#: Client/core/CJoystickManager.cpp:1580 +msgid "Brake Axis" msgstr "" -#: Client/loader/Dialogs.cpp:181 -msgid "B - Alternate NVidia" +#. Create window (with frame) if it will fit inside the screen resolution +#: Client/core/CSettings.cpp:84 +msgid "SETTINGS" msgstr "" -#: Client/loader/Dialogs.cpp:182 -msgid "C - Standard Intel" +#: Client/core/CSettings.cpp:116 +msgid "Multiplayer" msgstr "" -#: Client/loader/Dialogs.cpp:183 -msgid "D - Alternate Intel" +#: Client/core/CSettings.cpp:117 +msgid "Video" msgstr "" -#: Client/loader/Dialogs.cpp:184 -msgid "If you get desperate, this might help:" +#: Client/core/CSettings.cpp:118 +msgid "Audio" msgstr "" -#: Client/loader/Dialogs.cpp:185 -msgid "If you have already selected an option that works, this might help:" +#: Client/core/CSettings.cpp:119 +msgid "Binds" msgstr "" -#: Client/loader/Dialogs.cpp:186 -msgid "Force windowed mode" +#: Client/core/CSettings.cpp:120 +msgid "Controls" msgstr "" -#: Client/loader/Dialogs.cpp:187 -msgid "Don't show again" +#: Client/core/CSettings.cpp:121 +msgid "Interface" msgstr "" -#: Client/loader/Dialogs.cpp:195 -msgid "Warning: Could not detect anti-virus product" +#: Client/core/CSettings.cpp:122 +msgid "Web Browser" msgstr "" -#: Client/loader/Dialogs.cpp:197 -msgid "" -"MTA could not detect an anti-virus on your PC.\n" -"\n" -"Viruses interfere with MTA and degrade your gameplay experience.\n" -"\n" -"Press 'Help' for more information." +#: Client/core/CSettings.cpp:123 +msgid "Advanced" msgstr "" -#: Client/loader/Dialogs.cpp:200 -msgid "I have already installed an anti-virus" +#: Client/core/CSettings.cpp:147 Client/core/CSettings.cpp:338 +#: Client/core/CSettings.cpp:617 Client/core/CSettings.cpp:889 +msgid "Load defaults" msgstr "" -#: Client/loader/Dialogs.cpp:202 -msgid "" -"I will not install an anti-virus.\n" -"I want my PC to lag and be part of a botnet." +#. * +#. * Controls tab +#. * +#: Client/core/CSettings.cpp:157 Client/core/CSettings.cpp:181 +msgid "Mouse sensitivity:" msgstr "" -#: Client/loader/Dialogs.cpp:901 Client/loader/Install.cpp:852 -msgid "Installing update..." +#. VerticalAimSensitivity +#: Client/core/CSettings.cpp:157 Client/core/CSettings.cpp:199 +msgid "Vertical aim sensitivity:" msgstr "" -#: Client/loader/Dialogs.cpp:909 Client/loader/Install.cpp:934 -msgid "Extracting files..." +#. Mouse Options +#: Client/core/CSettings.cpp:160 +msgid "Mouse options" msgstr "" -#: Client/loader/MainFunctions.cpp:248 -msgid "" -"Trouble restarting MTA:SA\n" -"\n" -"If the problem persists, open Task Manager and\n" -"stop the 'gta_sa.exe' and 'Multi Theft Auto.exe' processes\n" -"\n" -"\n" -"Try to launch MTA:SA again?" +#: Client/core/CSettings.cpp:167 +msgid "Invert mouse vertically" msgstr "" -#: Client/loader/MainFunctions.cpp:266 -msgid "" -"Another instance of MTA is already running.\n" -"\n" -"If this problem persists, please restart your computer" +#: Client/core/CSettings.cpp:171 +msgid "Steer with mouse" msgstr "" -#: Client/loader/MainFunctions.cpp:269 -msgid "" -"Another instance of MTA is already running.\n" -"\n" -"Do you want to terminate it?" +#: Client/core/CSettings.cpp:175 +msgid "Fly with mouse" msgstr "" -#: Client/loader/MainFunctions.cpp:294 -msgid "" -"Are you having problems running MTA:SA?.\n" -"\n" -"Do you want to revert to an earlier version?" +#. Joypad options +#: Client/core/CSettings.cpp:217 +msgid "Joypad options" msgstr "" -#: Client/loader/MainFunctions.cpp:324 -msgid "" -"There seems to be a problem launching MTA:SA.\n" -"Resetting GTA settings can sometimes fix this problem.\n" -"\n" -"Do you want to reset GTA settings now?" +#: Client/core/CSettings.cpp:230 +msgid "Standard controls (Mouse + Keyboard)" msgstr "" -#: Client/loader/MainFunctions.cpp:339 -msgid "" -"GTA settings have been reset.\n" -"\n" -"Press OK to continue." +#: Client/core/CSettings.cpp:237 +msgid "Classic controls (Joypad)" msgstr "" -#: Client/loader/MainFunctions.cpp:344 -#, c-format -msgid "File could not be deleted: '%s'" +#: Client/core/CSettings.cpp:274 +msgid "Dead Zone" msgstr "" -#. No settings to delete, or can't find them -#: Client/loader/MainFunctions.cpp:352 -msgid "" -"Are you having problems running MTA:SA?.\n" -"\n" -"Do you want to see some online help?" +#: Client/core/CSettings.cpp:279 +msgid "Saturation" msgstr "" -#. Inform user -#: Client/loader/MainFunctions.cpp:388 -msgid "" -"Are you having problems running MTA:SA?.\n" -"\n" -"Do you want to change the following setting?" +#: Client/core/CSettings.cpp:285 +msgid "Use the 'Binds' tab for joypad buttons." msgstr "" -#: Client/loader/MainFunctions.cpp:389 Client/core/CSettings.cpp:662 -#: Client/core/CSettings.cpp:1004 -msgid "Fullscreen mode:" +#: Client/core/CSettings.cpp:324 +msgid "Left Stick" msgstr "" -#: Client/loader/MainFunctions.cpp:389 Client/core/CSettings.cpp:670 -#: Client/core/CSettings.cpp:1615 -msgid "Borderless window" +#: Client/core/CSettings.cpp:330 +msgid "Right Stick" msgstr "" -#: Client/loader/MainFunctions.cpp:431 -msgid "" -"Are you having problems running MTA:SA?.\n" -"\n" -"Try disabling the following products for GTA and MTA:" +#: Client/core/CSettings.cpp:345 +msgid "DESCRIPTION" msgstr "" -#: Client/loader/MainFunctions.cpp:465 -msgid "" -"WARNING\n" -"\n" -"MTA:SA has detected unusual activity.\n" -"Please run a virus scan to ensure your system is secure.\n" -"\n" +#: Client/core/CSettings.cpp:346 +msgid "KEY" msgstr "" -#: Client/loader/MainFunctions.cpp:468 -#, c-format -msgid "The detected file was: %s\n" +#: Client/core/CSettings.cpp:348 +msgid "ALT. KEY" msgstr "" -#: Client/loader/MainFunctions.cpp:602 -msgid "" -"An instance of GTA: San Andreas is already running. It needs to be " -"terminated before MTA:SA can be started. Do you want to do that now?" +#. * +#. * Multiplayer tab +#. * +#: Client/core/CSettings.cpp:353 Client/core/CSettings.cpp:356 +msgid "Nick:" msgstr "" -#: Client/loader/MainFunctions.cpp:603 Client/loader/MainFunctions.cpp:610 -#: Client/loader/MainFunctions.cpp:1219 -#: Client/core/ServerBrowser/CServerInfo.cpp:319 -#: Client/core/ServerBrowser/CServerBrowser.cpp:1380 -msgid "Information" +#: Client/core/CSettings.cpp:378 +msgid "Save server passwords" msgstr "" -#: Client/loader/MainFunctions.cpp:609 -msgid "" -"Unable to terminate GTA: San Andreas. If the problem persists, please " -"restart your computer." +#: Client/core/CSettings.cpp:383 +msgid "Auto-refresh server browser" msgstr "" -#: Client/loader/MainFunctions.cpp:632 -msgid "" -"Registry entries are missing. Please reinstall Multi Theft Auto: San Andreas." +#: Client/core/CSettings.cpp:388 +msgid "Allow screen upload" msgstr "" -#: Client/loader/MainFunctions.cpp:638 -msgid "" -"The path to your installation of GTA: San Andreas contains unsupported " -"(unicode) characters. Please move your Grand Theft Auto: San Andreas " -"installation to a compatible path that contains only standard ASCII " -"characters and reinstall Multi Theft Auto: San Andreas." +#: Client/core/CSettings.cpp:393 +msgid "Allow external sounds" msgstr "" -#: Client/loader/MainFunctions.cpp:648 -msgid "" -"The path to your installation of 'MTA:SA' or 'GTA: San Andreas'\n" -"contains a ';' (semicolon).\n" -"\n" -" If you experience problems when running MTA:SA,\n" -" move your installation(s) to a path that does not contain a semicolon." +#: Client/core/CSettings.cpp:398 +msgid "Always show download window" msgstr "" -#: Client/loader/MainFunctions.cpp:810 -msgid "" -"Load failed. Please ensure that the latest data files have been installed " -"correctly." +#: Client/core/CSettings.cpp:403 +msgid "Allow connecting with Discord Rich Presence" msgstr "" -#: Client/loader/MainFunctions.cpp:819 -#, c-format -msgid "Load failed. Please ensure that %s is installed correctly." +#: Client/core/CSettings.cpp:408 +msgid "Use customized GTA:SA files" msgstr "" -#: Client/loader/MainFunctions.cpp:826 -#, c-format -msgid "Load failed. Could not find gta_sa.exe in %s." +#: Client/core/CSettings.cpp:413 +msgid "Map rendering options" msgstr "" -#: Client/loader/MainFunctions.cpp:836 -#, c-format -msgid "" -"Load failed. %s exists in the GTA directory. Please delete before continuing." +#: Client/core/CSettings.cpp:419 Client/core/CSettings.cpp:628 +msgid "Opacity:" msgstr "" -#: Client/loader/MainFunctions.cpp:845 -#, c-format -msgid "Main file has an incorrect name (%s)" +#. * +#. * Audio tab +#. * +#: Client/core/CSettings.cpp:439 Client/core/CSettings.cpp:448 +msgid "Master volume:" msgstr "" -#: Client/loader/MainFunctions.cpp:856 -msgid "" -"Main file is unsigned. Possible virus activity.\n" -"\n" -"See online help if MTA does not work correctly." +#: Client/core/CSettings.cpp:439 Client/core/CSettings.cpp:467 +msgid "Radio volume:" msgstr "" -#: Client/loader/MainFunctions.cpp:882 -#, c-format -msgid "" -"Data file %s is missing. Possible virus activity.\n" -"\n" -"Consider reinstalling Multi Theft Auto for your security.\n" -"See online help if MTA does not work correctly." +#: Client/core/CSettings.cpp:439 Client/core/CSettings.cpp:486 +msgid "SFX volume:" msgstr "" -#: Client/loader/MainFunctions.cpp:893 -#, c-format -msgid "" -"Data file %s is modified. Possible virus activity.\n" -"\n" -"Consider reinstalling Multi Theft Auto for your security.\n" -"See online help if MTA does not work correctly." +#: Client/core/CSettings.cpp:439 Client/core/CSettings.cpp:505 +msgid "MTA volume:" msgstr "" -#: Client/loader/MainFunctions.cpp:907 -msgid "" -".asi files are in the 'MTA:SA' or 'GTA: San Andreas' installation " -"directory.\n" -"\n" -"Remove these .asi files if you experience problems with MTA:SA." +#: Client/core/CSettings.cpp:440 Client/core/CSettings.cpp:524 +msgid "Voice volume:" msgstr "" -#: Client/loader/MainFunctions.cpp:1009 -msgid "" -"File version mismatch error. Reinstall MTA:SA if you experience problems.\n" +#: Client/core/CSettings.cpp:440 Client/core/CSettings.cpp:565 +msgid "Play mode:" msgstr "" -#: Client/loader/MainFunctions.cpp:1018 -msgid "Some files are missing. Reinstall MTA:SA if you experience problems.\n" +#. * +#. * Webbrowser tab +#. * +#: Client/core/CSettings.cpp:442 Client/core/CSettings.cpp:630 +#: Client/core/CSettings.cpp:904 Client/core/CSettings.cpp:2018 +#: Client/mods/deathmatch/logic/CLocalServer.cpp:51 +msgid "General" msgstr "" -#: Client/loader/MainFunctions.cpp:1030 -msgid "" -"MTA:SA is not compatible with Windows 'Safe Mode'.\n" -"\n" -"Please restart your PC.\n" +#: Client/core/CSettings.cpp:543 +msgid "Radio options" msgstr "" -#: Client/loader/MainFunctions.cpp:1123 -msgid "Fix configuration issue" +#: Client/core/CSettings.cpp:549 +msgid "Radio Equalizer" msgstr "" -#. Try to relaunch as admin if not done so already -#: Client/loader/MainFunctions.cpp:1157 -msgid "Fix elevation required error" +#: Client/core/CSettings.cpp:554 +msgid "Radio Auto-tune" msgstr "" -#: Client/loader/MainFunctions.cpp:1164 -#, c-format -msgid "" -"Could not start Grand Theft Auto: San Andreas. Please try restarting, or if " -"the problem persists,contact MTA at www.multitheftauto.com. \n" -"\n" -"[%s]" +#: Client/core/CSettings.cpp:559 +msgid "Usertrack options" msgstr "" -#: Client/loader/MainFunctions.cpp:1219 -msgid "" -"GTA: San Andreas may not have launched correctly. Do you want to terminate " -"it?" +#: Client/core/CSettings.cpp:573 Client/core/CSettings.cpp:3087 +msgid "Radio" msgstr "" -#: Client/loader/Install.cpp:265 -msgid "Unknown" +#: Client/core/CSettings.cpp:574 Client/core/CSettings.cpp:3089 +msgid "Random" msgstr "" -#: Client/loader/Install.cpp:272 -#, c-format -msgid "" -"The file '%s' is currently locked by %zu processes.\n" -"\n" -"Do you want to terminate the following processes and continue updating?\n" -"\n" -"%s" +#: Client/core/CSettings.cpp:575 Client/core/CSettings.cpp:3091 +msgid "Sequential" msgstr "" -#: Client/loader/Install.cpp:479 -#, c-format -msgid "" -"Your installation may be corrupt now.\n" -"\n" -"%zu out of %zu files could not be restored from the backup.\n" -"\n" -"You should reinstall Multi Theft Auto from www.multitheftauto.com\n" -"or try running the update with administrator rights." +#: Client/core/CSettings.cpp:578 +msgid "Automatic Media Scan" msgstr "" -#: Client/mods/deathmatch/CClient.cpp:36 -msgid "This version has expired." +#: Client/core/CSettings.cpp:585 +msgid "Mute options" msgstr "" -#: Client/mods/deathmatch/CClient.cpp:56 -msgid "disconnect from the game" +#: Client/core/CSettings.cpp:591 +msgid "Mute All sounds when minimized" msgstr "" -#: Client/mods/deathmatch/CClient.cpp:57 -msgid "shows the nametags" +#: Client/core/CSettings.cpp:596 +msgid "Mute Radio sounds when minimized" msgstr "" -#: Client/mods/deathmatch/CClient.cpp:58 -msgid "shows the chatbox" +#: Client/core/CSettings.cpp:601 +msgid "Mute SFX sounds when minimized" msgstr "" -#: Client/mods/deathmatch/CClient.cpp:59 -msgid "shows the network statistics" +#: Client/core/CSettings.cpp:606 +msgid "Mute MTA sounds when minimized" msgstr "" -#. Key commands (registered as 'mod commands', can be disabled) -#: Client/mods/deathmatch/CClient.cpp:63 -msgid "open the chat input" +#: Client/core/CSettings.cpp:611 +msgid "Mute Voice sounds when minimized" msgstr "" -#: Client/mods/deathmatch/CClient.cpp:64 -msgid "transmits voice to other players" +#. * +#. * Video tab +#. * +#: Client/core/CSettings.cpp:627 Client/core/CSettings.cpp:636 +msgid "Resolution:" msgstr "" -#: Client/mods/deathmatch/CClient.cpp:65 -msgid "enters a car as passenger" +#: Client/core/CSettings.cpp:627 Client/core/CSettings.cpp:683 +msgid "FOV:" msgstr "" -#: Client/mods/deathmatch/CClient.cpp:66 -msgid "next radio channel" +#: Client/core/CSettings.cpp:627 Client/core/CSettings.cpp:699 +msgid "Draw Distance:" msgstr "" -#: Client/mods/deathmatch/CClient.cpp:67 -msgid "previous radio channel" +#: Client/core/CSettings.cpp:627 Client/core/CSettings.cpp:717 +msgid "Brightness:" msgstr "" -#: Client/mods/deathmatch/CClient.cpp:68 -msgid "enables the radar view" +#: Client/core/CSettings.cpp:627 Client/core/CSettings.cpp:735 +msgid "FX Quality:" msgstr "" -#: Client/mods/deathmatch/CClient.cpp:69 -msgid "zooms the radar in" +#: Client/core/CSettings.cpp:628 Client/core/CSettings.cpp:749 +msgid "Anisotropic filtering:" msgstr "" -#: Client/mods/deathmatch/CClient.cpp:70 -msgid "zooms the radar out" +#: Client/core/CSettings.cpp:628 Client/core/CSettings.cpp:776 +msgid "Anti-aliasing:" msgstr "" -#: Client/mods/deathmatch/CClient.cpp:71 -msgid "moves the radar north" +#: Client/core/CSettings.cpp:628 Client/core/CSettings.cpp:790 +msgid "Aspect Ratio:" msgstr "" -#: Client/mods/deathmatch/CClient.cpp:72 -msgid "moves the radar south" +#: Client/core/CSettings.cpp:648 +msgid "Windowed" msgstr "" -#: Client/mods/deathmatch/CClient.cpp:73 -msgid "moves the radar east" +#: Client/core/CSettings.cpp:654 +msgid "DPI aware" msgstr "" -#: Client/mods/deathmatch/CClient.cpp:74 -msgid "moves the radar west" +#: Client/core/CSettings.cpp:662 Client/core/CSettings.cpp:1004 +#: Client/loader/MainFunctions.cpp:389 +msgid "Fullscreen mode:" msgstr "" -#: Client/mods/deathmatch/CClient.cpp:75 -msgid "attaches the radar" +#: Client/core/CSettings.cpp:669 Client/core/CSettings.cpp:1613 +msgid "Standard" msgstr "" -#: Client/mods/deathmatch/CClient.cpp:76 -msgid "reduces radar opacity" +#: Client/core/CSettings.cpp:670 Client/core/CSettings.cpp:1615 +#: Client/loader/MainFunctions.cpp:389 +msgid "Borderless window" msgstr "" -#: Client/mods/deathmatch/CClient.cpp:77 -msgid "increases radar opacity" +#: Client/core/CSettings.cpp:671 Client/core/CSettings.cpp:1617 +msgid "Borderless keep res" msgstr "" -#: Client/mods/deathmatch/CClient.cpp:78 -msgid "toggles radar help text" +#: Client/core/CSettings.cpp:675 +msgid "Mip Mapping" msgstr "" -#: Client/mods/deathmatch/CClient.cpp:79 -msgid "sends a message to the targetted player" -msgstr "" - -#: Client/mods/deathmatch/CClient.cpp:80 -msgid "changes to the next weapon whilst in a vehicle" +#: Client/core/CSettings.cpp:743 Client/core/CSettings.cpp:1517 +msgid "Low" msgstr "" -#: Client/mods/deathmatch/CClient.cpp:81 -msgid "changes to the previous weapon whilst in a vehicle" +#: Client/core/CSettings.cpp:744 Client/core/CSettings.cpp:1519 +msgid "Medium" msgstr "" -#: Client/mods/deathmatch/CClient.cpp:82 -msgid "outputs info about the current server" +#: Client/core/CSettings.cpp:745 Client/core/CSettings.cpp:1086 +#: Client/core/CSettings.cpp:1521 Client/core/CSettings.cpp:3145 +msgid "High" msgstr "" -#. ACHTUNG" Should this be handled by the atomic cvar setter? -#: Client/mods/deathmatch/CClient.cpp:85 -msgid "defines the scale multiplier of all text-displays" +#: Client/core/CSettings.cpp:746 Client/core/CSettings.cpp:1523 +msgid "Very high" msgstr "" -#. Development mode -#: Client/mods/deathmatch/CClient.cpp:92 -msgid "(Development mode) shows the colshapes" +#: Client/core/CSettings.cpp:761 Client/core/CSettings.cpp:784 +#: Client/core/CSettings.cpp:1017 Client/core/CSettings.cpp:1071 +#: Client/core/CSettings.cpp:1201 Client/core/CSettings.cpp:1527 +#: Client/core/CSettings.cpp:3152 Client/core/CSettings.cpp:3184 +#: Client/core/CSettings.cpp:3206 Client/core/CSettings.cpp:4234 +msgid "Off" msgstr "" -#: Client/mods/deathmatch/CClient.cpp:93 -msgid "(Development mode) prints world sound ids into the debug window" +#: Client/core/CSettings.cpp:785 Client/core/CSettings.cpp:1529 +msgid "1x" msgstr "" -#. Throw the error and disconnect -#: Client/mods/deathmatch/logic/CResourceFileDownloadManager.cpp:141 -#, c-format -msgid "Download error: %s" +#: Client/core/CSettings.cpp:786 Client/core/CSettings.cpp:1531 +msgid "2x" msgstr "" -#: Client/mods/deathmatch/logic/CPacketHandler.cpp:506 -msgid "Disconnected: Invalid nickname" +#: Client/core/CSettings.cpp:787 Client/core/CSettings.cpp:1533 +msgid "3x" msgstr "" -#: Client/mods/deathmatch/logic/CPacketHandler.cpp:510 -msgid "Disconnect from server" +#: Client/core/CSettings.cpp:800 Client/core/CSettings.cpp:1019 +#: Client/core/CSettings.cpp:1539 Client/core/CSettings.cpp:3154 +msgid "Auto" msgstr "" -#: Client/mods/deathmatch/logic/CPacketHandler.cpp:514 -#, c-format -msgid "" -"Disconnected: Serial is banned.\n" -"Reason: %s" +#: Client/core/CSettings.cpp:801 Client/core/CSettings.cpp:1541 +msgid "4:3" msgstr "" -#: Client/mods/deathmatch/logic/CPacketHandler.cpp:520 -#, c-format -msgid "" -"Disconnected: You are banned.\n" -"Reason: %s" +#: Client/core/CSettings.cpp:802 Client/core/CSettings.cpp:1543 +msgid "16:10" msgstr "" -#: Client/mods/deathmatch/logic/CPacketHandler.cpp:526 -#, c-format -msgid "" -"Disconnected: Account is banned.\n" -"Reason: %s" +#: Client/core/CSettings.cpp:803 Client/core/CSettings.cpp:1545 +msgid "16:9" msgstr "" -#: Client/mods/deathmatch/logic/CPacketHandler.cpp:531 -msgid "Disconnected: Version mismatch" +#: Client/core/CSettings.cpp:806 +msgid "HUD Match Aspect Ratio" msgstr "" -#: Client/mods/deathmatch/logic/CPacketHandler.cpp:535 -msgid "Disconnected: Join flood. Please wait a minute, then reconnect." +#: Client/core/CSettings.cpp:812 +msgid "Volumetric Shadows" msgstr "" -#: Client/mods/deathmatch/logic/CPacketHandler.cpp:539 -#, c-format -msgid "" -"Disconnected: Server from different branch.\n" -"Information: %s" +#: Client/core/CSettings.cpp:816 +msgid "Grass effect" msgstr "" -#: Client/mods/deathmatch/logic/CPacketHandler.cpp:544 -#, c-format -msgid "" -"Disconnected: Bad version.\n" -"Information: %s" +#: Client/core/CSettings.cpp:820 +msgid "Heat haze" msgstr "" -#: Client/mods/deathmatch/logic/CPacketHandler.cpp:549 -#, c-format -msgid "" -"Disconnected: Server is running a newer build.\n" -"Information: %s" +#: Client/core/CSettings.cpp:824 +msgid "Tyre Smoke etc" msgstr "" -#: Client/mods/deathmatch/logic/CPacketHandler.cpp:554 -#, c-format -msgid "" -"Disconnected: Server is running an older build.\n" -"Information: %s" +#: Client/core/CSettings.cpp:828 +msgid "Dynamic ped shadows" msgstr "" -#: Client/mods/deathmatch/logic/CPacketHandler.cpp:559 -msgid "Disconnected: Nick already in use" +#: Client/core/CSettings.cpp:832 +msgid "Motion blur" msgstr "" -#: Client/mods/deathmatch/logic/CPacketHandler.cpp:563 -msgid "Disconnected: Player element could not be created." +#: Client/core/CSettings.cpp:837 +msgid "Full Screen Minimize" msgstr "" -#: Client/mods/deathmatch/logic/CPacketHandler.cpp:567 -#, c-format -msgid "Disconnected: Server refused the connection: %s" +#: Client/core/CSettings.cpp:849 +msgid "Enable Device Selection Dialog" msgstr "" -#: Client/mods/deathmatch/logic/CPacketHandler.cpp:572 -msgid "Disconnected: Serial verification failed" +#: Client/core/CSettings.cpp:861 +msgid "Show unsafe resolutions" msgstr "" -#: Client/mods/deathmatch/logic/CPacketHandler.cpp:576 -#, c-format -msgid "Disconnected: Connection desync %s" +#: Client/core/CSettings.cpp:873 +msgid "Render vehicles always in high detail" msgstr "" -#: Client/mods/deathmatch/logic/CPacketHandler.cpp:585 -#, c-format -msgid "Disconnected: You were kicked by %s" +#: Client/core/CSettings.cpp:877 +msgid "Render peds always in high detail" msgstr "" -#: Client/mods/deathmatch/logic/CPacketHandler.cpp:590 -#, c-format -msgid "Disconnected: You were banned by %s" +#: Client/core/CSettings.cpp:881 +msgid "Corona rain reflections" msgstr "" -#: Client/mods/deathmatch/logic/CPacketHandler.cpp:601 -msgid "Disconnected: Server shutdown or restarting" +#: Client/core/CSettings.cpp:910 +msgid "Enable remote websites" msgstr "" -#: Client/mods/deathmatch/logic/CPacketHandler.cpp:621 -msgid "You were kicked from the game" +#: Client/core/CSettings.cpp:915 +msgid "Enable Javascript on remote websites" msgstr "" -#: Client/mods/deathmatch/logic/CPacketHandler.cpp:622 -#: Client/mods/deathmatch/logic/CPacketHandler.cpp:633 -msgid "This server requires a non-modifed gta_sa.exe" +#: Client/core/CSettings.cpp:920 +msgid "Custom blacklist" msgstr "" -#: Client/mods/deathmatch/logic/CPacketHandler.cpp:623 -#: Client/mods/deathmatch/logic/CPacketHandler.cpp:634 -msgid "Please replace gta_sa.exe" +#: Client/core/CSettings.cpp:931 Client/core/CSettings.cpp:966 +msgid "Enter a domain e.g. google.com" msgstr "" -#: Client/mods/deathmatch/logic/CPacketHandler.cpp:624 -msgid "This server does not allow custom D3D9.DLLs" +#: Client/core/CSettings.cpp:939 +msgid "Block" msgstr "" -#: Client/mods/deathmatch/logic/CPacketHandler.cpp:625 -msgid "Remove D3D9.DLL from your GTA install directory and restart MTA" +#: Client/core/CSettings.cpp:947 Client/core/CSettings.cpp:982 +msgid "Domain" msgstr "" -#: Client/mods/deathmatch/logic/CPacketHandler.cpp:626 -msgid "This server does not allow virtual machines" +#: Client/core/CSettings.cpp:949 Client/core/CSettings.cpp:984 +msgid "Remove domain" msgstr "" -#: Client/mods/deathmatch/logic/CPacketHandler.cpp:627 -msgid "This server requires driver signing to be enabled" +#. Reset vecTemp +#: Client/core/CSettings.cpp:955 +msgid "Custom whitelist" msgstr "" -#: Client/mods/deathmatch/logic/CPacketHandler.cpp:628 -msgid "Please restart your PC" +#: Client/core/CSettings.cpp:974 Client/cefweb/CWebsiteRequests.cpp:51 +msgid "Allow" msgstr "" -#: Client/mods/deathmatch/logic/CPacketHandler.cpp:629 -msgid "This server has detected missing anti-cheat components" +#. Misc section label +#: Client/core/CSettings.cpp:997 +msgid "Misc" msgstr "" -#: Client/mods/deathmatch/logic/CPacketHandler.cpp:630 -msgid "Try restarting MTA" +#. Fast clothes loading +#: Client/core/CSettings.cpp:1003 Client/core/CSettings.cpp:1010 +#: Client/core/CSettings.cpp:4803 +msgid "Fast CJ clothes loading:" msgstr "" -#: Client/mods/deathmatch/logic/CPacketHandler.cpp:631 -msgid "This server requires a non-modifed gta3.img and gta_int.img" +#. Browser scan speed +#: Client/core/CSettings.cpp:1003 Client/core/CSettings.cpp:1024 +#: Client/core/CSettings.cpp:4805 +msgid "Browser speed:" msgstr "" -#: Client/mods/deathmatch/logic/CPacketHandler.cpp:632 -msgid "Please replace gta3.img or gta_int.img" +#. Single download +#: Client/core/CSettings.cpp:1003 Client/core/CSettings.cpp:1038 +#: Client/core/CSettings.cpp:4807 +msgid "Single connection:" msgstr "" -#: Client/mods/deathmatch/logic/CPacketHandler.cpp:635 -msgid "This server does not allow Wine" +#. Packet tag +#: Client/core/CSettings.cpp:1003 Client/core/CSettings.cpp:1051 +#: Client/core/CSettings.cpp:4809 +msgid "Packet tag:" msgstr "" -#: Client/mods/deathmatch/logic/CPacketHandler.cpp:636 -msgid "Ensure no other program is modifying MTA:SA" +#. Progress animation +#: Client/core/CSettings.cpp:1004 Client/core/CSettings.cpp:1064 +#: Client/core/CSettings.cpp:4811 +msgid "Progress animation:" msgstr "" -#: Client/mods/deathmatch/logic/CPacketHandler.cpp:650 -msgid "Time Remaining: " +#. Process priority +#: Client/core/CSettings.cpp:1004 Client/core/CSettings.cpp:1077 +#: Client/core/CSettings.cpp:4801 +msgid "Process priority:" msgstr "" -#: Client/mods/deathmatch/logic/CPacketHandler.cpp:660 -#, c-format -msgid "%d day" -msgid_plural "%d days" -msgstr[0] "" -msgstr[1] "" - -#: Client/mods/deathmatch/logic/CPacketHandler.cpp:662 -#, c-format -msgid "%d hour" -msgid_plural "%d hours" -msgstr[0] "" -msgstr[1] "" - -#: Client/mods/deathmatch/logic/CPacketHandler.cpp:664 -#, c-format -msgid "%d minute" -msgid_plural "%d minutes" -msgstr[0] "" -msgstr[1] "" - -#: Client/mods/deathmatch/logic/CPacketHandler.cpp:666 -#, c-format -msgid "%d second" -msgid_plural "%d seconds" -msgstr[0] "" -msgstr[1] "" +#. Debug setting +#: Client/core/CSettings.cpp:1004 Client/core/CSettings.cpp:1091 +#: Client/core/CSettings.cpp:4813 +msgid "Debug setting:" +msgstr "" -#. Display the error -#: Client/mods/deathmatch/logic/CPacketHandler.cpp:670 -msgid "Disconnected" +#. Streaming memory +#: Client/core/CSettings.cpp:1005 Client/core/CSettings.cpp:1114 +#: Client/core/CSettings.cpp:4815 +msgid "Streaming memory:" msgstr "" -#: Client/mods/deathmatch/logic/CLocalServer.cpp:37 -msgid "HOST GAME" +#. Update build type +#: Client/core/CSettings.cpp:1005 Client/core/CSettings.cpp:1215 +msgid "Update build type:" msgstr "" -#. * -#. * Webbrowser tab -#. * -#: Client/mods/deathmatch/logic/CLocalServer.cpp:51 -#: Client/core/CSettings.cpp:442 Client/core/CSettings.cpp:630 -#: Client/core/CSettings.cpp:904 Client/core/CSettings.cpp:2018 -msgid "General" +#. UpdateAutoInstall +#: Client/core/CSettings.cpp:1005 Client/core/CSettings.cpp:1194 +msgid "Install important updates:" msgstr "" -#. m_pTabs->CreateTab ( "Gamemode" ); -#: Client/mods/deathmatch/logic/CLocalServer.cpp:53 -msgid "Resources" +#: Client/core/CSettings.cpp:1018 Client/core/CSettings.cpp:1046 +#: Client/core/CSettings.cpp:1059 Client/core/CSettings.cpp:3156 +#: Client/core/CSettings.cpp:3172 Client/core/CSettings.cpp:3179 +msgid "On" msgstr "" -#: Client/mods/deathmatch/logic/CLocalServer.cpp:55 -#: Client/mods/deathmatch/logic/CLocalServer.cpp:57 -msgid "Server name:" +#: Client/core/CSettings.cpp:1031 Client/core/CSettings.cpp:3161 +msgid "Very slow" msgstr "" -#: Client/mods/deathmatch/logic/CLocalServer.cpp:64 -#: Client/mods/deathmatch/logic/CLocalServer.cpp:66 -msgid "Password:" +#: Client/core/CSettings.cpp:1032 Client/core/CSettings.cpp:1045 +#: Client/core/CSettings.cpp:1058 Client/core/CSettings.cpp:1072 +#: Client/core/CSettings.cpp:1098 Client/core/CSettings.cpp:1110 +#: Client/core/CSettings.cpp:1202 Client/core/CSettings.cpp:1222 +#: Client/core/CSettings.cpp:3163 Client/core/CSettings.cpp:3170 +#: Client/core/CSettings.cpp:3177 Client/core/CSettings.cpp:3186 +#: Client/core/CSettings.cpp:3199 +msgid "Default" msgstr "" -#: Client/mods/deathmatch/logic/CLocalServer.cpp:73 -#: Client/mods/deathmatch/logic/CLocalServer.cpp:75 -msgid "Max players:" +#: Client/core/CSettings.cpp:1033 Client/core/CSettings.cpp:3165 +msgid "Fast" msgstr "" -#: Client/mods/deathmatch/logic/CLocalServer.cpp:82 -#: Client/mods/deathmatch/logic/CLocalServer.cpp:84 -msgid "Broadcast:" +#: Client/core/CSettings.cpp:1084 Client/core/CSettings.cpp:3141 +msgid "Normal" msgstr "" -#: Client/mods/deathmatch/logic/CLocalServer.cpp:86 -msgid "LAN" +#: Client/core/CSettings.cpp:1085 Client/core/CSettings.cpp:3143 +msgid "Above normal" msgstr "" -#. Create the tabs -#: Client/mods/deathmatch/logic/CLocalServer.cpp:90 -#: Client/core/ServerBrowser/CServerBrowser.cpp:133 -msgid "Internet" +#: Client/core/CSettings.cpp:1121 +msgid "Min" msgstr "" -#: Client/mods/deathmatch/logic/CLocalServer.cpp:99 -msgid "Selected" +#: Client/core/CSettings.cpp:1134 +msgid "Max" msgstr "" -#: Client/mods/deathmatch/logic/CLocalServer.cpp:116 -msgid "All" +#. Windows 8 compatibility +#: Client/core/CSettings.cpp:1141 +msgid "Windows 8 compatibility:" msgstr "" -#: Client/mods/deathmatch/logic/CLocalServer.cpp:118 -msgid "Start" +#: Client/core/CSettings.cpp:1145 +msgid "16-bit color" msgstr "" -#: Client/mods/deathmatch/logic/CResource.cpp:372 -#: Client/mods/deathmatch/logic/CClientGame.cpp:1084 Client/core/CCore.cpp:674 -#: Client/core/CSettings.cpp:3483 -msgid "In-game" +#: Client/core/CSettings.cpp:1150 +msgid "Mouse fix" msgstr "" -#: Client/mods/deathmatch/logic/CTransferBox.cpp:25 -msgid "Map download progress:" +#. Cache path info +#: Client/core/CSettings.cpp:1168 +msgid "Client resource files:" msgstr "" -#: Client/mods/deathmatch/logic/CTransferBox.cpp:28 -msgid "Download Progress:" +#: Client/core/CSettings.cpp:1172 +msgid "Show in Explorer" msgstr "" -#. Find our largest piece of text, so we can size accordingly -#: Client/mods/deathmatch/logic/CTransferBox.cpp:42 -#: Client/mods/deathmatch/logic/CTransferBox.cpp:105 -#, c-format -msgid "%s of %s" +#. Auto updater section label +#: Client/core/CSettings.cpp:1187 Client/core/CSettings.cpp:1190 +msgid "Auto updater" msgstr "" -#: Client/mods/deathmatch/logic/CTransferBox.cpp:44 -#: Client/mods/deathmatch/logic/CTransferBox.cpp:65 -msgid "Disconnect to cancel download" +#. Check for updates +#: Client/core/CSettings.cpp:1228 +msgid "Check for update now" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:371 -msgid "Flying a UFO around" +#: Client/core/CSettings.cpp:1382 +msgid "Some settings will be changed when you next start MTA" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:371 -msgid "Cruising around" +#: Client/core/CSettings.cpp:1383 +msgid "" +"\n" +"\n" +"Do you want to restart now?" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:371 -msgid "Riding the waves of" +#: Client/core/CSettings.cpp:1386 +msgid "RESTART REQUIRED" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:372 -msgid "Riding the train in" +#: Client/core/CSettings.cpp:1388 Client/core/CSettings.cpp:1412 +#: Client/core/CSettings.cpp:4488 Client/core/CSettings.cpp:4562 +#: Client/core/CSettings.cpp:4592 Client/core/CSettings.cpp:4641 +#: Client/core/CQuestionBox.cpp:194 Client/core/CVersionUpdater.cpp:1571 +#: Client/core/CVersionUpdater.cpp:1589 Client/core/CVersionUpdater.cpp:1858 +#: Client/core/CVersionUpdater.cpp:1877 Client/core/CMainMenu.cpp:1199 +#: Client/core/ServerBrowser/CServerInfo.cpp:479 Client/loader/Dialogs.cpp:132 +msgid "No" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:372 -msgid "Flying around" +#: Client/core/CSettings.cpp:1406 +msgid "Some settings will be changed when you disconnect the current server" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:373 -msgid "Riding around" +#: Client/core/CSettings.cpp:1407 +msgid "" +"\n" +"\n" +"Do you want to disconnect now?" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:373 -msgid "Monster truckin' around" +#: Client/core/CSettings.cpp:1410 +msgid "DISCONNECT REQUIRED" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:373 -msgid "Quaddin' around" +#. Update the joystick name +#: Client/core/CSettings.cpp:1737 +msgid "Joypad not detected - Check connections and restart game" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:374 -msgid "Bunny hopping around" +#: Client/core/CSettings.cpp:1932 +msgid "Binding axis" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:374 -msgid "Doing weird stuff in" +#: Client/core/CSettings.cpp:1932 +msgid "Move an axis to bind, or escape to clear" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:378 -msgid "Climbing around in" +#: Client/core/CSettings.cpp:2009 +msgid "Language:" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:379 -#: Client/mods/deathmatch/logic/CClientGame.cpp:380 -msgid "Doing a drive-by in" +#: Client/core/CSettings.cpp:2009 +msgid "Skin:" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:381 -msgid "Blub blub..." +#: Client/core/CSettings.cpp:2009 +msgid "Presets:" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:382 -msgid "Breathing water" +#: Client/core/CSettings.cpp:2058 +msgid "Chat" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:383 -msgid "Drowning in" +#: Client/core/CSettings.cpp:2075 +msgid "Load" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:384 -msgid "Ducking for cover in" +#: Client/core/CSettings.cpp:2087 +msgid "Colors" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:385 -msgid "Fighting in" +#: Client/core/CSettings.cpp:2088 +msgid "Layout" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:386 -msgid "Throwing fists in" +#: Client/core/CSettings.cpp:2089 Client/core/CSettings.cpp:2335 +msgid "Options" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:387 -msgid "Blastin' fools in" +#: Client/core/CSettings.cpp:2095 +msgid "Chat Background" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:388 -msgid "Shooting up" +#: Client/core/CSettings.cpp:2095 +msgid "Chat Text" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:389 -msgid "Jetpacking in" +#: Client/core/CSettings.cpp:2095 +msgid "Input Background" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:390 -msgid "Literally on fire in" +#: Client/core/CSettings.cpp:2095 +msgid "Input Text" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:391 -msgid "Burning up in" +#: Client/core/CSettings.cpp:2118 +msgid "Lines:" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:392 -msgid "Swimming in" +#: Client/core/CSettings.cpp:2118 +msgid "Scale:" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:393 -msgid "Floating around in" +#: Client/core/CSettings.cpp:2118 +msgid "Width:" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:394 -msgid "Being chased by a shark" +#: Client/core/CSettings.cpp:2121 +msgid "Size" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:395 -msgid "Choking to death in" +#: Client/core/CSettings.cpp:2170 +msgid "after" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:528 Client/core/CCore.cpp:674 -#: Client/core/CSettings.cpp:3479 Client/core/CMainMenu.cpp:304 -msgid "Main menu" +#: Client/core/CSettings.cpp:2170 +msgid "for" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:636 -#: Client/mods/deathmatch/logic/CClientGame.cpp:734 -#: Client/core/ServerBrowser/CServerBrowser.cpp:1300 -#: Client/core/ServerBrowser/CServerBrowser.cpp:1357 -msgid "Invalid nickname! Please go to Settings and set a new one!" +#: Client/core/CSettings.cpp:2170 +msgid "sec" msgstr "" -#. Display the status box -#: Client/mods/deathmatch/logic/CClientGame.cpp:652 -#: Client/core/CConnectManager.cpp:148 -msgid "CONNECTING" +#: Client/core/CSettings.cpp:2173 +msgid "Fading" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:652 -msgid "Entering the game ..." +#: Client/core/CSettings.cpp:2179 +msgid "Fade out old lines" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:710 -msgid "" -"Not connected; please use Quick Connect or the 'connect' command to connect " -"to a server." +#: Client/core/CSettings.cpp:2219 +msgid "Horizontal:" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:756 -msgid "Could not start the local server. See console for details." +#: Client/core/CSettings.cpp:2219 +msgid "Vertical:" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:766 -#: Client/mods/deathmatch/logic/CClientGame.cpp:1241 -msgid "Local Server" +#: Client/core/CSettings.cpp:2219 +msgid "Text-Align:" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:766 -msgid "Starting local server ..." +#: Client/core/CSettings.cpp:2219 +msgid "X-Offset:" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:1014 -msgid "Area 51" +#: Client/core/CSettings.cpp:2220 +msgid "Y-Offset:" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:1023 -msgid "Walking around " +#: Client/core/CSettings.cpp:2226 +msgid "Position" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:1172 -#, c-format -msgid "You were kicked from the game ( %s )" +#: Client/core/CSettings.cpp:2241 Client/core/CSettings.cpp:2255 +msgid "Center" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:1241 -msgid "Connecting to local server..." +#: Client/core/CSettings.cpp:2254 +msgid "Top" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:1252 -msgid "Error connecting to server." +#: Client/core/CSettings.cpp:2256 +msgid "Bottom" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:1262 -msgid "Connecting to local server timed out. See console for details." +#: Client/core/CSettings.cpp:2304 +msgid "Font" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:1331 -#: Client/core/CConnectManager.cpp:263 -msgid "Connection timed out" -msgstr "" - -#: Client/mods/deathmatch/logic/CClientGame.cpp:1368 -msgid "Connection with the server was lost" +#: Client/core/CSettings.cpp:2341 +msgid "Hide background when not typing" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:1379 -#: Client/core/CConnectManager.cpp:277 Client/core/CConnectManager.cpp:281 -msgid "Disconnected: unknown protocol error" +#: Client/core/CSettings.cpp:2346 +msgid "Nickname completion using the \"Tab\" key" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:1383 -#: Client/core/CConnectManager.cpp:285 -msgid "Disconnected: disconnected remotely" +#: Client/core/CSettings.cpp:2351 +msgid "Allow server to flash the window" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:1387 -#: Client/core/CConnectManager.cpp:289 -msgid "Disconnected: connection lost remotely" +#: Client/core/CSettings.cpp:2356 +msgid "Allow tray balloon notifications" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:1391 -#: Client/core/CConnectManager.cpp:293 -msgid "Disconnected: you are banned from this server" +#: Client/core/CSettings.cpp:2361 +msgid "Chat text black/white outline" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:1395 -msgid "Disconnected: the server is currently full" +#. Create a messagebox to notify the user +#. SString strText = SString::Printf ( "Press a key to bind to '%s'", pItemBind->GetText ().c_str () ); +#. Create a messagebox to notify the user +#. sSString strText = SString::Printf ( "Press a key to bind to '%s'", pItemBind->GetText ().c_str () ); +#: Client/core/CSettings.cpp:2610 Client/core/CSettings.cpp:2617 +msgid "Press a key to bind, or escape to clear" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:1399 -#: Client/core/CConnectManager.cpp:300 -msgid "Disconnected: disconnected from the server" +#: Client/core/CSettings.cpp:2611 +msgid "Binding a primary key" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:1403 -#: Client/core/CConnectManager.cpp:304 -msgid "Disconnected: connection to the server was lost" +#: Client/core/CSettings.cpp:2618 +msgid "Binding a secondary key" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:1407 -msgid "Disconnected: invalid password specified" +#: Client/core/CSettings.cpp:2694 +msgid "GTA GAME CONTROLS" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:1411 -#: Client/core/CConnectManager.cpp:311 -msgid "Disconnected: connection was refused" +#: Client/core/CSettings.cpp:2696 +msgid "MULTIPLAYER CONTROLS" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:1429 -msgid "MTA Client verification failed!" +#: Client/core/CSettings.cpp:2941 Client/core/CSettings.cpp:4764 +msgid "Your nickname contains invalid characters!" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:5688 -msgid "In a ditch" +#: Client/core/CSettings.cpp:3479 Client/core/CCore.cpp:674 +#: Client/core/CMainMenu.cpp:304 +#: Client/mods/deathmatch/logic/CClientGame.cpp:527 +msgid "Main menu" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:5688 -msgid "En-route to hospital" +#: Client/core/CSettings.cpp:3483 Client/core/CCore.cpp:674 +#: Client/mods/deathmatch/logic/CClientGame.cpp:1083 +#: Client/mods/deathmatch/logic/CResource.cpp:372 +msgid "In-game" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:5688 -msgid "Meeting their maker" +#: Client/core/CSettings.cpp:3778 +msgid "Red:" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:5689 -msgid "Regretting their decisions" +#: Client/core/CSettings.cpp:3778 +msgid "Green:" msgstr "" -#: Client/mods/deathmatch/logic/CClientGame.cpp:5689 -msgid "Wasted" +#: Client/core/CSettings.cpp:3778 +msgid "Blue:" msgstr "" -#. Couldn't create render target for CPostEffects -#: Client/multiplayer_sa/CMultiplayerSA_CrashFixHacks.cpp:1360 -msgid "Problem with graphics driver" +#: Client/core/CSettings.cpp:3778 +msgid "Transparency:" msgstr "" -#: Client/cefweb/CWebsiteRequests.cpp:19 -msgid "Website requests" +#: Client/core/CSettings.cpp:3781 +msgid "Color" msgstr "" -#: Client/cefweb/CWebsiteRequests.cpp:27 -msgid "" -"The server requests the following websites in order to load them (later):" +#: Client/core/CSettings.cpp:3858 +msgid "Preview" msgstr "" -#: Client/cefweb/CWebsiteRequests.cpp:33 -msgid "NEVER ENTER SENSITIVE DATA TO PROTECT THEM FROM BEING STOLEN" +#: Client/core/CSettings.cpp:4166 +msgid "Please disconnect before changing language" msgstr "" -#: Client/cefweb/CWebsiteRequests.cpp:46 -msgid "Remember decision" +#: Client/core/CSettings.cpp:4194 +msgid "Please disconnect before changing skin" msgstr "" -#: Client/cefweb/CWebsiteRequests.cpp:51 Client/core/CSettings.cpp:974 -msgid "Allow" +#: Client/core/CSettings.cpp:4482 +msgid "" +"Volmetric shadows can cause some systems to slow down.\n" +"\n" +"Are you sure you want to enable them?" msgstr "" -#: Client/cefweb/CWebsiteRequests.cpp:57 -msgid "Deny" +#: Client/core/CSettings.cpp:4486 +msgid "PERFORMANCE WARNING" msgstr "" -#: Client/core/CConnectManager.cpp:79 -msgid "Connecting failed. Invalid nick provided!" +#: Client/core/CSettings.cpp:4506 +msgid "" +"Screen upload is required by some servers for anti-cheat purposes.\n" +"\n" +"(The chat box and GUI is excluded from the upload)\n" msgstr "" -#: Client/core/CConnectManager.cpp:110 -msgid "Connecting failed. Invalid host provided!" +#: Client/core/CSettings.cpp:4508 +msgid "SCREEN UPLOAD INFORMATION" msgstr "" -#: Client/core/CConnectManager.cpp:126 -#, c-format -msgid "Connecting to %s at port %u failed!" +#: Client/core/CSettings.cpp:4523 +msgid "" +"Some scripts may play sounds, such as radio, from the internet.\n" +"\n" +"Disabling this setting may decrease network\n" +"bandwidth consumption.\n" msgstr "" -#. Display the status box -#: Client/core/CConnectManager.cpp:147 -#, c-format -msgid "Connecting to %s:%u ..." +#: Client/core/CSettings.cpp:4526 +msgid "EXTERNAL SOUNDS" msgstr "" -#. Failed loading the mod -#: Client/core/CConnectManager.cpp:403 -#, c-format -msgid "No such mod installed (%s)" +#: Client/core/CSettings.cpp:4555 +msgid "" +"It seems that you have the Rich Presence connection option enabled.\n" +"Do you want to allow servers to share their data?\n" +"\n" +"This includes yours unique ID identifier." msgstr "" -#: Client/core/CConnectManager.cpp:411 -msgid "Bad server response (2)" +#: Client/core/CSettings.cpp:4560 +msgid "CONSENT TO ALLOW DATA SHARING" msgstr "" -#: Client/core/CConnectManager.cpp:421 -msgid "Bad server response (1)" +#: Client/core/CSettings.cpp:4584 +msgid "" +"Some files in your GTA:SA data directory are customized.\n" +"MTA will only use these modified files if this check box is ticked.\n" +"\n" +"However, CUSTOMIZED GTA:SA FILES ARE BLOCKED BY MANY SERVERS\n" +"\n" +"Are you sure you want to use them?" msgstr "" -#: Client/core/CCommandFuncs.cpp:24 -msgid "***[ COMMAND HELP ]***\n" +#: Client/core/CSettings.cpp:4590 Client/core/CVersionUpdater.cpp:2081 +msgid "CUSTOMIZED GTA:SA FILES" msgstr "" -#: Client/core/CCommandFuncs.cpp:158 -#, c-format -msgid "* The time is %d:%02d:%02d" +#: Client/core/CSettings.cpp:4633 +msgid "" +"Enabling DPI awareness is an experimental feature and\n" +"we only recommend it when you play MTA:SA on a scaled monitor.\n" +"You may experience graphical issues if you enable this option.\n" +"\n" +"Are you sure you want to enable this option?" msgstr "" -#: Client/core/CCommandFuncs.cpp:242 -msgid "connect: Syntax is 'connect [ ]'" +#: Client/core/CSettings.cpp:4639 +msgid "EXPERIMENTAL FEATURE" msgstr "" -#: Client/core/CCommandFuncs.cpp:250 Client/core/CCommandFuncs.cpp:318 -msgid "connect: Bad port number" +#: Client/core/CSettings.cpp:4782 +msgid "Please enter a nickname" msgstr "" -#: Client/core/CCommandFuncs.cpp:272 Client/core/CCommandFuncs.cpp:333 -#, c-format -msgid "connect: Connecting to %s:%u..." +#: Client/core/CSettings.cpp:4783 +msgid "" +"Please enter a nickname to be used ingame. \n" +"This will be your name when you connect to and play in a server" msgstr "" -#: Client/core/CCommandFuncs.cpp:276 Client/core/CCommandFuncs.cpp:337 -#, c-format -msgid "connect: could not connect to %s:%u!" +#: Client/core/CSettings.cpp:4801 +msgid "Very experimental feature." msgstr "" -#: Client/core/CCommandFuncs.cpp:281 -msgid "connect: Failed to unload current mod" +#: Client/core/CSettings.cpp:4803 +msgid "Stops stalls with CJ variations (Uses 65MB more RAM)" msgstr "" -#: Client/core/CCommandFuncs.cpp:371 -msgid "Bound all controls from GTA" +#: Client/core/CSettings.cpp:4805 +msgid "Older routers may require a slower scan speed." msgstr "" -#: Client/core/CCommandFuncs.cpp:385 -msgid "Saved configuration file" +#: Client/core/CSettings.cpp:4807 +msgid "Switch on to use only one connection when downloading." msgstr "" -#. Print it -#: Client/core/CCommandFuncs.cpp:451 -#, c-format -msgid "* Your serial is: %s" +#: Client/core/CSettings.cpp:4809 +msgid "Tag network packets to help ISPs identify MTA traffic." msgstr "" -#. TRANSLATORS: Replace with your language native name -#: Client/core/CLocalization.cpp:16 -msgid "English" +#: Client/core/CSettings.cpp:4811 +msgid "Spinning circle animation at the bottom of the screen" msgstr "" -#. Unknown command -#: Client/core/CCommands.cpp:216 -msgid "Unknown command or cvar: " +#: Client/core/CSettings.cpp:4813 +msgid "Select default always. (This setting is not saved)" msgstr "" -#: Client/core/CCore.cpp:813 Shared/mods/deathmatch/logic/Utils.cpp:111 -msgid "Fatal error" +#: Client/core/CSettings.cpp:4815 +msgid "Maximum is usually best" msgstr "" -#: Client/core/CCore.cpp:938 -msgid "TO FIX, REMOVE THIS FILE:" +#: Client/core/CSettings.cpp:4817 Client/core/CSettings.cpp:4819 +msgid "Auto updater:" msgstr "" -#: Client/core/CCore.cpp:970 -#, c-format -msgid "%s module is incorrect!" +#: Client/core/CSettings.cpp:4817 +msgid "Select default unless you like filling out bug reports." msgstr "" -#: Client/core/CCore.cpp:1275 -msgid "Error executing URL" +#: Client/core/CSettings.cpp:4819 +msgid "Select default to automatically install important updates." msgstr "" -#: Client/core/CCore.cpp:1287 -#, c-format -msgid "Error running mod specified in command line ('%s')" +#: Client/core/CSettings.cpp:4821 +msgid "16-bit color:" msgstr "" -#. m_pCommands->Add ( "e", CCommandFuncs::Editor ); -#. m_pCommands->Add ( "clear", CCommandFuncs::Clear ); -#: Client/core/CCore.cpp:1389 -msgid "this help screen" +#: Client/core/CSettings.cpp:4821 +msgid "Enable 16 bit color modes - Requires MTA restart" msgstr "" -#: Client/core/CCore.cpp:1390 Client/core/CCore.cpp:1391 -msgid "exits the application" +#: Client/core/CSettings.cpp:4823 +msgid "Mouse fix:" msgstr "" -#: Client/core/CCore.cpp:1392 -msgid "shows the version" +#: Client/core/CSettings.cpp:4823 +msgid "Mouse movement fix - May need PC restart" msgstr "" -#: Client/core/CCore.cpp:1393 -msgid "shows the time" +#. Create window +#: Client/core/CConsole.cpp:417 +msgid "CONSOLE" msgstr "" -#: Client/core/CCore.cpp:1394 -msgid "shows the hud" +#: Client/core/CConnectManager.cpp:79 +msgid "Connecting failed. Invalid nick provided!" +msgstr "" + +#: Client/core/CConnectManager.cpp:110 +msgid "Connecting failed. Invalid host provided!" +msgstr "" + +#: Client/core/CConnectManager.cpp:126 +#, c-format +msgid "Connecting to %s at port %u failed!" +msgstr "" + +#. Display the status box +#: Client/core/CConnectManager.cpp:147 +#, c-format +msgid "Connecting to %s:%u ..." +msgstr "" + +#. Display the status box +#: Client/core/CConnectManager.cpp:148 +#: Client/mods/deathmatch/logic/CClientGame.cpp:651 +msgid "CONNECTING" +msgstr "" + +#: Client/core/CConnectManager.cpp:263 +#: Client/mods/deathmatch/logic/CClientGame.cpp:1327 +msgid "Connection timed out" +msgstr "" + +#: Client/core/CConnectManager.cpp:277 Client/core/CConnectManager.cpp:281 +#: Client/mods/deathmatch/logic/CClientGame.cpp:1375 +msgid "Disconnected: unknown protocol error" +msgstr "" + +#: Client/core/CConnectManager.cpp:285 +#: Client/mods/deathmatch/logic/CClientGame.cpp:1379 +msgid "Disconnected: disconnected remotely" +msgstr "" + +#: Client/core/CConnectManager.cpp:289 +#: Client/mods/deathmatch/logic/CClientGame.cpp:1383 +msgid "Disconnected: connection lost remotely" +msgstr "" + +#: Client/core/CConnectManager.cpp:293 +#: Client/mods/deathmatch/logic/CClientGame.cpp:1387 +msgid "Disconnected: you are banned from this server" +msgstr "" + +#: Client/core/CConnectManager.cpp:300 +#: Client/mods/deathmatch/logic/CClientGame.cpp:1395 +msgid "Disconnected: disconnected from the server" +msgstr "" + +#: Client/core/CConnectManager.cpp:304 +#: Client/mods/deathmatch/logic/CClientGame.cpp:1399 +msgid "Disconnected: connection to the server was lost" +msgstr "" + +#: Client/core/CConnectManager.cpp:311 +#: Client/mods/deathmatch/logic/CClientGame.cpp:1407 +msgid "Disconnected: connection was refused" +msgstr "" + +#. Failed loading the mod +#: Client/core/CConnectManager.cpp:403 +#, c-format +msgid "No such mod installed (%s)" +msgstr "" + +#: Client/core/CConnectManager.cpp:411 +msgid "Bad server response (2)" +msgstr "" + +#: Client/core/CConnectManager.cpp:421 +msgid "Bad server response (1)" +msgstr "" + +#. Unknown command +#: Client/core/CCommands.cpp:216 +msgid "Unknown command or cvar: " +msgstr "" + +#: Client/core/CCore.cpp:811 Client/loader/CInstallManager.cpp:1057 +#, c-format +msgid "MTA:SA cannot continue because drive %s does not have enough space." +msgstr "" + +#: Client/core/CCore.cpp:813 Shared/mods/deathmatch/logic/Utils.cpp:111 +msgid "Fatal error" +msgstr "" + +#: Client/core/CCore.cpp:938 +msgid "TO FIX, REMOVE THIS FILE:" +msgstr "" + +#: Client/core/CCore.cpp:970 +#, c-format +msgid "%s module is incorrect!" +msgstr "" + +#: Client/core/CCore.cpp:1275 +msgid "Error executing URL" +msgstr "" + +#: Client/core/CCore.cpp:1287 +#, c-format +msgid "Error running mod specified in command line ('%s')" +msgstr "" + +#. m_pCommands->Add ( "e", CCommandFuncs::Editor ); +#. m_pCommands->Add ( "clear", CCommandFuncs::Clear ); +#: Client/core/CCore.cpp:1389 +msgid "this help screen" +msgstr "" + +#: Client/core/CCore.cpp:1390 Client/core/CCore.cpp:1391 +msgid "exits the application" +msgstr "" + +#: Client/core/CCore.cpp:1392 +msgid "shows the version" +msgstr "" + +#: Client/core/CCore.cpp:1393 +msgid "shows the time" +msgstr "" + +#: Client/core/CCore.cpp:1394 +msgid "shows the hud" msgstr "" #: Client/core/CCore.cpp:1395 @@ -1594,1690 +1567,1718 @@ msgstr "" msgid "for developers: reload news" msgstr "" -#: Client/core/CCredits.cpp:34 -msgid "Programming" +#. TRANSLATORS: Replace with your language native name +#: Client/core/CLocalization.cpp:16 +msgid "English" msgstr "" -#: Client/core/CCredits.cpp:63 -msgid "Contributors" +#: Client/core/CQuestionBox.cpp:192 Shared/sdk/SharedUtil.Misc.hpp:688 +msgid "Do you want to see some on-line help about this problem ?" msgstr "" -#: Client/core/CCredits.cpp:84 -msgid "Game Design / Scripting" +#: Client/core/CVersionUpdater.cpp:626 +msgid "Busy" msgstr "" -#: Client/core/CCredits.cpp:104 -msgid "Language Localization" +#: Client/core/CVersionUpdater.cpp:626 +msgid "Can't check for updates right now" msgstr "" -#: Client/core/CCredits.cpp:110 -msgid "Patch contributors" +#: Client/core/CVersionUpdater.cpp:1567 Client/core/CVersionUpdater.cpp:1587 +#: Client/core/CVersionUpdater.cpp:1605 +#, c-format +msgid "MTA:SA %s required" msgstr "" -#: Client/core/CCredits.cpp:234 -msgid "Special Thanks" +#: Client/core/CVersionUpdater.cpp:1568 +#, c-format +msgid "" +"An updated version of MTA:SA %s is required to join the selected server.\n" +"\n" +"Do you want to download and install MTA:SA %s ?" msgstr "" -#: Client/core/CCredits.cpp:265 -msgid "" -"This software and project makes use of the following libraries and software:" +#: Client/core/CVersionUpdater.cpp:1588 +#, c-format +msgid "Do you want to launch MTA:SA %s and connect to this server ?" msgstr "" -#: Client/core/CQuestionBox.cpp:192 Shared/sdk/SharedUtil.Misc.hpp:688 -msgid "Do you want to see some on-line help about this problem ?" +#: Client/core/CVersionUpdater.cpp:1606 +msgid "" +"It is not possible to connect at this time.\n" +"\n" +"Please try later." msgstr "" -#. Create window (with frame) if it will fit inside the screen resolution -#: Client/core/CSettings.cpp:84 -msgid "SETTINGS" +#: Client/core/CVersionUpdater.cpp:1788 +msgid "Connecting" msgstr "" -#: Client/core/CSettings.cpp:116 -msgid "Multiplayer" +#: Client/core/CVersionUpdater.cpp:1789 Client/core/CVersionUpdater.cpp:1805 +msgid "Please wait..." msgstr "" -#: Client/core/CSettings.cpp:117 -msgid "Video" +#: Client/core/CVersionUpdater.cpp:1804 +msgid "CHECKING" msgstr "" -#: Client/core/CSettings.cpp:118 -msgid "Audio" +#: Client/core/CVersionUpdater.cpp:1821 Client/core/CVersionUpdater.cpp:1914 +msgid "UPDATE CHECK" msgstr "" -#: Client/core/CSettings.cpp:119 -msgid "Binds" +#: Client/core/CVersionUpdater.cpp:1822 +msgid "No update needed" msgstr "" -#: Client/core/CSettings.cpp:120 -msgid "Controls" +#: Client/core/CVersionUpdater.cpp:1839 +msgid "DOWNLOADING" msgstr "" -#: Client/core/CSettings.cpp:121 -msgid "Interface" +#: Client/core/CVersionUpdater.cpp:1840 +msgid "waiting..." msgstr "" -#: Client/core/CSettings.cpp:122 -msgid "Web Browser" +#: Client/core/CVersionUpdater.cpp:1856 +msgid "MANDATORY UPDATE" msgstr "" -#: Client/core/CSettings.cpp:123 -msgid "Advanced" +#: Client/core/CVersionUpdater.cpp:1857 +msgid "" +"To join this server, you must update MTA.\n" +"\n" +" Do you want to update now ?" msgstr "" -#: Client/core/CSettings.cpp:147 Client/core/CSettings.cpp:338 -#: Client/core/CSettings.cpp:617 Client/core/CSettings.cpp:889 -msgid "Load defaults" +#: Client/core/CVersionUpdater.cpp:1875 +msgid "OPTIONAL UPDATE" msgstr "" -#. * -#. * Controls tab -#. * -#: Client/core/CSettings.cpp:157 Client/core/CSettings.cpp:181 -msgid "Mouse sensitivity:" +#: Client/core/CVersionUpdater.cpp:1876 +msgid "" +"Server says an update is recommended, but not essential.\n" +"\n" +" Do you want to update now ?" msgstr "" -#. VerticalAimSensitivity -#: Client/core/CSettings.cpp:157 Client/core/CSettings.cpp:199 -msgid "Vertical aim sensitivity:" +#: Client/core/CVersionUpdater.cpp:1915 +msgid "" +"Update not currently avalable.\n" +"\n" +"Please check www.mtasa.com" msgstr "" -#. Mouse Options -#: Client/core/CSettings.cpp:160 -msgid "Mouse options" +#: Client/core/CVersionUpdater.cpp:1936 Client/core/CVersionUpdater.cpp:2118 +msgid "ERROR SAVING" msgstr "" -#: Client/core/CSettings.cpp:167 -msgid "Invert mouse vertically" +#: Client/core/CVersionUpdater.cpp:1937 Client/core/CVersionUpdater.cpp:2119 +msgid "Unable to create the file." msgstr "" -#: Client/core/CSettings.cpp:171 -msgid "Steer with mouse" +#: Client/core/CVersionUpdater.cpp:1945 Client/core/CVersionUpdater.cpp:1954 +#: Client/core/CVersionUpdater.cpp:2127 Client/core/CVersionUpdater.cpp:2136 +msgid "ERROR DOWNLOADING" msgstr "" -#: Client/core/CSettings.cpp:175 -msgid "Fly with mouse" +#: Client/core/CVersionUpdater.cpp:1946 Client/core/CVersionUpdater.cpp:2128 +msgid "The downloaded file appears to be incorrect." msgstr "" -#. Joypad options -#: Client/core/CSettings.cpp:217 -msgid "Joypad options" +#: Client/core/CVersionUpdater.cpp:1955 Client/core/CVersionUpdater.cpp:2137 +msgid "For some reason." msgstr "" -#: Client/core/CSettings.cpp:230 -msgid "Standard controls (Mouse + Keyboard)" +#: Client/core/CVersionUpdater.cpp:1966 Client/core/CVersionUpdater.cpp:2150 +msgid "DOWNLOAD COMPLETE" msgstr "" -#: Client/core/CSettings.cpp:237 -msgid "Classic controls (Joypad)" +#: Client/core/CVersionUpdater.cpp:1990 +msgid " - Unknown problem in _DialogUpdateResult" msgstr "" -#: Client/core/CSettings.cpp:274 -msgid "Dead Zone" +#: Client/core/CVersionUpdater.cpp:2088 Client/core/CVersionUpdater.cpp:2098 +msgid "Ok" msgstr "" -#: Client/core/CSettings.cpp:279 -msgid "Saturation" +#: Client/core/CVersionUpdater.cpp:2096 +msgid "ERROR" msgstr "" -#: Client/core/CSettings.cpp:285 -msgid "Use the 'Binds' tab for joypad buttons." +#: Client/core/CVersionUpdater.cpp:2097 +msgid "" +"Some MTA:SA data files are missing.\n" +"\n" +"\n" +"Please reinstall MTA:SA" msgstr "" -#: Client/core/CSettings.cpp:324 -msgid "Left Stick" +#: Client/core/CVersionUpdater.cpp:2774 +#, c-format +msgid "%3d %% completed" msgstr "" -#: Client/core/CSettings.cpp:330 -msgid "Right Stick" +#: Client/core/CVersionUpdater.cpp:2777 +#, c-format +msgid "" +"\n" +"\n" +"Waiting for response - %-3d" msgstr "" -#: Client/core/CSettings.cpp:345 -msgid "DESCRIPTION" +#: Client/core/CCommandFuncs.cpp:24 +msgid "***[ COMMAND HELP ]***\n" msgstr "" -#: Client/core/CSettings.cpp:346 -msgid "KEY" +#: Client/core/CCommandFuncs.cpp:158 +#, c-format +msgid "* The time is %d:%02d:%02d" msgstr "" -#: Client/core/CSettings.cpp:348 -msgid "ALT. KEY" +#: Client/core/CCommandFuncs.cpp:242 +msgid "connect: Syntax is 'connect [ ]'" msgstr "" -#. * -#. * Multiplayer tab -#. * -#: Client/core/CSettings.cpp:353 Client/core/CSettings.cpp:356 -msgid "Nick:" +#: Client/core/CCommandFuncs.cpp:250 Client/core/CCommandFuncs.cpp:318 +msgid "connect: Bad port number" msgstr "" -#: Client/core/CSettings.cpp:378 -msgid "Save server passwords" +#: Client/core/CCommandFuncs.cpp:272 Client/core/CCommandFuncs.cpp:333 +#, c-format +msgid "connect: Connecting to %s:%u..." msgstr "" -#: Client/core/CSettings.cpp:383 -msgid "Auto-refresh server browser" +#: Client/core/CCommandFuncs.cpp:276 Client/core/CCommandFuncs.cpp:337 +#, c-format +msgid "connect: could not connect to %s:%u!" msgstr "" -#: Client/core/CSettings.cpp:388 -msgid "Allow screen upload" +#: Client/core/CCommandFuncs.cpp:281 +msgid "connect: Failed to unload current mod" msgstr "" -#: Client/core/CSettings.cpp:393 -msgid "Allow external sounds" +#: Client/core/CCommandFuncs.cpp:371 +msgid "Bound all controls from GTA" msgstr "" -#: Client/core/CSettings.cpp:398 -msgid "Always show download window" +#: Client/core/CCommandFuncs.cpp:385 +msgid "Saved configuration file" msgstr "" -#: Client/core/CSettings.cpp:403 -msgid "Allow connecting with Discord Rich Presence" +#. Print it +#: Client/core/CCommandFuncs.cpp:451 +#, c-format +msgid "* Your serial is: %s" msgstr "" -#: Client/core/CSettings.cpp:408 -msgid "Use customized GTA:SA files" +#: Client/core/CMainMenu.cpp:333 +msgid "" +"You are using a feature-branch build! This is a test build only which cannot " +"be used to connect to public servers!" msgstr "" -#: Client/core/CSettings.cpp:413 -msgid "Map rendering options" +#: Client/core/CMainMenu.cpp:352 +msgid "" +"MTA will not receive updates on XP/Vista after July 2019.\n" +"\n" +"Upgrade Windows to play on the latest servers." msgstr "" -#: Client/core/CSettings.cpp:419 Client/core/CSettings.cpp:628 -msgid "Opacity:" +#: Client/core/CMainMenu.cpp:1193 +msgid "" +"This will disconnect you from the current server.\n" +"\n" +"Are you sure you want to disconnect?" msgstr "" -#. * -#. * Audio tab -#. * -#: Client/core/CSettings.cpp:439 Client/core/CSettings.cpp:448 -msgid "Master volume:" +#: Client/core/CMainMenu.cpp:1197 +msgid "DISCONNECT WARNING" msgstr "" -#: Client/core/CSettings.cpp:439 Client/core/CSettings.cpp:467 -msgid "Radio volume:" +#: Client/core/ServerBrowser/CServerList.cpp:25 +msgid "Idle" msgstr "" -#: Client/core/CSettings.cpp:439 Client/core/CSettings.cpp:486 -msgid "SFX volume:" -msgstr "" +#: Client/core/ServerBrowser/CServerList.cpp:150 +msgid "player" +msgid_plural "players" +msgstr[0] "" +msgstr[1] "" -#: Client/core/CSettings.cpp:439 Client/core/CSettings.cpp:505 -msgid "MTA volume:" +#: Client/core/ServerBrowser/CServerList.cpp:151 +msgid "on" msgstr "" -#: Client/core/CSettings.cpp:440 Client/core/CSettings.cpp:524 -msgid "Voice volume:" +#: Client/core/ServerBrowser/CServerList.cpp:154 +msgid "server" +msgid_plural "servers" +msgstr[0] "" +msgstr[1] "" + +#. We are polling for the master server list (first pass) +#: Client/core/ServerBrowser/CServerList.cpp:238 +#, c-format +msgid "Requesting master server list (%lu ms elapsed)" msgstr "" -#: Client/core/CSettings.cpp:440 Client/core/CSettings.cpp:565 -msgid "Play mode:" +#. Abort +#: Client/core/ServerBrowser/CServerList.cpp:254 +msgid "Master server list could not be parsed." msgstr "" -#: Client/core/CSettings.cpp:543 -msgid "Radio options" +#. Abort +#: Client/core/ServerBrowser/CServerList.cpp:264 +msgid "Master server list could not be retrieved." msgstr "" -#: Client/core/CSettings.cpp:549 -msgid "Radio Equalizer" +#: Client/core/ServerBrowser/CServerList.cpp:274 +msgid "(Backup server list)" msgstr "" -#: Client/core/CSettings.cpp:554 -msgid "Radio Auto-tune" +#: Client/core/ServerBrowser/CServerList.cpp:326 +msgid "Cannot bind LAN-broadcast socket" msgstr "" -#: Client/core/CSettings.cpp:559 -msgid "Usertrack options" +#: Client/core/ServerBrowser/CServerList.cpp:345 +msgid "Attempting to discover LAN servers" msgstr "" -#: Client/core/CSettings.cpp:573 Client/core/CSettings.cpp:3087 -msgid "Radio" +#. Create queue window +#: Client/core/ServerBrowser/CServerInfo.cpp:32 +#: Client/core/ServerBrowser/CServerInfo.cpp:302 +msgid "SERVER IS FULL" msgstr "" -#: Client/core/CSettings.cpp:574 Client/core/CSettings.cpp:3089 -msgid "Random" +#. Determine our label draw position for L10n +#. Start position +#. Server Name +#: Client/core/ServerBrowser/CServerInfo.cpp:44 +#: Client/core/ServerBrowser/CServerInfo.cpp:53 +msgid "Name:" msgstr "" -#: Client/core/CSettings.cpp:575 Client/core/CSettings.cpp:3091 -msgid "Sequential" +#. Server IP +#: Client/core/ServerBrowser/CServerInfo.cpp:44 +#: Client/core/ServerBrowser/CServerInfo.cpp:64 +msgid "Server Address:" msgstr "" -#: Client/core/CSettings.cpp:578 -msgid "Automatic Media Scan" +#. Gamemode +#: Client/core/ServerBrowser/CServerInfo.cpp:44 +#: Client/core/ServerBrowser/CServerInfo.cpp:75 +msgid "Gamemode:" msgstr "" -#: Client/core/CSettings.cpp:585 -msgid "Mute options" +#. Map +#: Client/core/ServerBrowser/CServerInfo.cpp:44 +#: Client/core/ServerBrowser/CServerInfo.cpp:86 +msgid "Map:" msgstr "" -#: Client/core/CSettings.cpp:591 -msgid "Mute All sounds when minimized" +#. Players +#: Client/core/ServerBrowser/CServerInfo.cpp:45 +#: Client/core/ServerBrowser/CServerInfo.cpp:97 +msgid "Players:" msgstr "" -#: Client/core/CSettings.cpp:596 -msgid "Mute Radio sounds when minimized" +#. Passworded +#: Client/core/ServerBrowser/CServerInfo.cpp:45 +#: Client/core/ServerBrowser/CServerInfo.cpp:108 +msgid "Passworded:" msgstr "" -#: Client/core/CSettings.cpp:601 -msgid "Mute SFX sounds when minimized" +#. Latency +#: Client/core/ServerBrowser/CServerInfo.cpp:45 +#: Client/core/ServerBrowser/CServerInfo.cpp:119 +msgid "Latency:" msgstr "" -#: Client/core/CSettings.cpp:606 -msgid "Mute MTA sounds when minimized" +#. Column for player names +#. Player List Columns +#: Client/core/ServerBrowser/CServerInfo.cpp:138 +#: Client/core/ServerBrowser/CServerBrowser.cpp:478 +msgid "Player list" msgstr "" -#: Client/core/CSettings.cpp:611 -msgid "Mute Voice sounds when minimized" +#. Close button +#: Client/core/ServerBrowser/CServerInfo.cpp:144 +msgid "Close" msgstr "" -#. * -#. * Video tab -#. * -#: Client/core/CSettings.cpp:627 Client/core/CSettings.cpp:636 -msgid "Resolution:" +#. Join Game button +#: Client/core/ServerBrowser/CServerInfo.cpp:152 +msgid "Join Game" msgstr "" -#: Client/core/CSettings.cpp:627 Client/core/CSettings.cpp:683 -msgid "FOV:" +#. Please enter password label +#: Client/core/ServerBrowser/CServerInfo.cpp:166 +msgid "Please enter the password to the server:" msgstr "" -#: Client/core/CSettings.cpp:627 Client/core/CSettings.cpp:699 -msgid "Draw Distance:" +#: Client/core/ServerBrowser/CServerInfo.cpp:177 +msgid "Join the server as soon as a player slot is available." msgstr "" -#: Client/core/CSettings.cpp:627 Client/core/CSettings.cpp:717 -msgid "Brightness:" +#: Client/core/ServerBrowser/CServerInfo.cpp:310 +msgid "PLEASE ENTER SERVER PASSWORD" msgstr "" -#: Client/core/CSettings.cpp:627 Client/core/CSettings.cpp:735 -msgid "FX Quality:" +#: Client/core/ServerBrowser/CServerInfo.cpp:319 +#: Client/core/ServerBrowser/CServerBrowser.cpp:1380 +#: Client/loader/MainFunctions.cpp:603 Client/loader/MainFunctions.cpp:610 +#: Client/loader/MainFunctions.cpp:1219 +msgid "Information" msgstr "" -#: Client/core/CSettings.cpp:628 Client/core/CSettings.cpp:749 -msgid "Anisotropic filtering:" +#. The server has timed out +#: Client/core/ServerBrowser/CServerInfo.cpp:402 +msgid "Timed Out" msgstr "" -#: Client/core/CSettings.cpp:628 Client/core/CSettings.cpp:776 -msgid "Anti-aliasing:" +#. Set every GUI elements text to blank +#: Client/core/ServerBrowser/CServerInfo.cpp:431 +msgid "Querying..." msgstr "" -#: Client/core/CSettings.cpp:628 Client/core/CSettings.cpp:790 -msgid "Aspect Ratio:" +#. Create the window +#: Client/core/ServerBrowser/CServerBrowser.cpp:85 +msgid "SERVER BROWSER" msgstr "" -#: Client/core/CSettings.cpp:648 -msgid "Windowed" +#. Create the tabs +#: Client/core/ServerBrowser/CServerBrowser.cpp:133 +#: Client/mods/deathmatch/logic/CLocalServer.cpp:90 +msgid "Internet" msgstr "" -#: Client/core/CSettings.cpp:654 -msgid "DPI aware" +#: Client/core/ServerBrowser/CServerBrowser.cpp:134 +msgid "Local" msgstr "" -#: Client/core/CSettings.cpp:669 Client/core/CSettings.cpp:1613 -msgid "Standard" +#: Client/core/ServerBrowser/CServerBrowser.cpp:135 +msgid "Favourites" msgstr "" -#: Client/core/CSettings.cpp:671 Client/core/CSettings.cpp:1617 -msgid "Borderless keep res" +#: Client/core/ServerBrowser/CServerBrowser.cpp:136 +msgid "Recent" msgstr "" -#: Client/core/CSettings.cpp:675 -msgid "Mip Mapping" +#: Client/core/ServerBrowser/CServerBrowser.cpp:191 +msgid "" +"FOR QUICK CONNECT:\n" +"\n" +"Type the address and port into the address bar.\n" +"Or select a server from the history list and press 'Connect'" msgstr "" -#: Client/core/CSettings.cpp:743 Client/core/CSettings.cpp:1517 -msgid "Low" +#: Client/core/ServerBrowser/CServerBrowser.cpp:203 +msgid "HELP" msgstr "" -#: Client/core/CSettings.cpp:744 Client/core/CSettings.cpp:1519 -msgid "Medium" +#: Client/core/ServerBrowser/CServerBrowser.cpp:212 +#: Client/core/ServerBrowser/CServerBrowser.cpp:252 +msgid "Refresh" msgstr "" -#: Client/core/CSettings.cpp:745 Client/core/CSettings.cpp:1086 -#: Client/core/CSettings.cpp:1521 Client/core/CSettings.cpp:3145 -msgid "High" +#: Client/core/ServerBrowser/CServerBrowser.cpp:212 +#: Client/core/ServerBrowser/CServerBrowser.cpp:253 +msgid "Add Favorite" msgstr "" -#: Client/core/CSettings.cpp:746 Client/core/CSettings.cpp:1523 -msgid "Very high" +#: Client/core/ServerBrowser/CServerBrowser.cpp:212 +#: Client/core/ServerBrowser/CServerBrowser.cpp:254 +#: Client/core/ServerBrowser/CServerBrowser.cpp:301 +#: Client/core/ServerBrowser/CServerBrowser.cpp:372 +msgid "Connect" msgstr "" -#: Client/core/CSettings.cpp:761 Client/core/CSettings.cpp:784 -#: Client/core/CSettings.cpp:1017 Client/core/CSettings.cpp:1071 -#: Client/core/CSettings.cpp:1201 Client/core/CSettings.cpp:1527 -#: Client/core/CSettings.cpp:3152 Client/core/CSettings.cpp:3184 -#: Client/core/CSettings.cpp:3206 Client/core/CSettings.cpp:4234 -msgid "Off" +#: Client/core/ServerBrowser/CServerBrowser.cpp:212 +#: Client/core/ServerBrowser/CServerBrowser.cpp:255 +msgid "Server information" msgstr "" -#: Client/core/CSettings.cpp:785 Client/core/CSettings.cpp:1529 -msgid "1x" +#: Client/core/ServerBrowser/CServerBrowser.cpp:213 +#: Client/core/ServerBrowser/CServerBrowser.cpp:256 +msgid "Search servers" msgstr "" -#: Client/core/CSettings.cpp:786 Client/core/CSettings.cpp:1531 -msgid "2x" +#: Client/core/ServerBrowser/CServerBrowser.cpp:213 +#: Client/core/ServerBrowser/CServerBrowser.cpp:257 +msgid "Search players" msgstr "" -#: Client/core/CSettings.cpp:787 Client/core/CSettings.cpp:1533 -msgid "3x" +#: Client/core/ServerBrowser/CServerBrowser.cpp:213 +#: Client/core/ServerBrowser/CServerBrowser.cpp:258 +msgid "Start search" msgstr "" -#: Client/core/CSettings.cpp:800 Client/core/CSettings.cpp:1019 -#: Client/core/CSettings.cpp:1539 Client/core/CSettings.cpp:3154 -msgid "Auto" +#: Client/core/ServerBrowser/CServerBrowser.cpp:299 +#: Client/core/ServerBrowser/CServerBrowser.cpp:1697 +msgid "Search players..." msgstr "" -#: Client/core/CSettings.cpp:801 Client/core/CSettings.cpp:1541 -msgid "4:3" +#: Client/core/ServerBrowser/CServerBrowser.cpp:422 +#: Client/core/ServerBrowser/CServerBrowser.cpp:1695 +msgid "Search servers..." msgstr "" -#: Client/core/CSettings.cpp:802 Client/core/CSettings.cpp:1543 -msgid "16:10" +#: Client/core/ServerBrowser/CServerBrowser.cpp:453 +msgid "Name" msgstr "" -#: Client/core/CSettings.cpp:803 Client/core/CSettings.cpp:1545 -msgid "16:9" +#: Client/core/ServerBrowser/CServerBrowser.cpp:454 +msgid "Players" msgstr "" -#: Client/core/CSettings.cpp:806 -msgid "HUD Match Aspect Ratio" +#: Client/core/ServerBrowser/CServerBrowser.cpp:455 +msgid "Ping" msgstr "" -#: Client/core/CSettings.cpp:812 -msgid "Volumetric Shadows" +#: Client/core/ServerBrowser/CServerBrowser.cpp:456 +msgid "Gamemode" msgstr "" -#: Client/core/CSettings.cpp:816 -msgid "Grass effect" +#. Include label +#: Client/core/ServerBrowser/CServerBrowser.cpp:486 +msgid "Include:" msgstr "" -#: Client/core/CSettings.cpp:820 -msgid "Heat haze" +#: Client/core/ServerBrowser/CServerBrowser.cpp:492 +msgid "Empty" msgstr "" -#: Client/core/CSettings.cpp:824 -msgid "Tyre Smoke etc" +#: Client/core/ServerBrowser/CServerBrowser.cpp:498 +msgid "Full" msgstr "" -#: Client/core/CSettings.cpp:828 -msgid "Dynamic ped shadows" +#: Client/core/ServerBrowser/CServerBrowser.cpp:504 +msgid "Locked" msgstr "" -#: Client/core/CSettings.cpp:832 -msgid "Motion blur" +#: Client/core/ServerBrowser/CServerBrowser.cpp:516 +msgid "Offline" msgstr "" -#: Client/core/CSettings.cpp:837 -msgid "Full Screen Minimize" +#: Client/core/ServerBrowser/CServerBrowser.cpp:529 +msgid "Other Versions" msgstr "" -#: Client/core/CSettings.cpp:849 -msgid "Enable Device Selection Dialog" +#: Client/core/ServerBrowser/CServerBrowser.cpp:550 +msgid "Back" msgstr "" -#: Client/core/CSettings.cpp:861 -msgid "Show unsafe resolutions" +#: Client/core/ServerBrowser/CServerBrowser.cpp:556 +#: Client/loader/Dialogs.cpp:135 +msgid "Help" msgstr "" -#: Client/core/CSettings.cpp:873 -msgid "Render vehicles always in high detail" +#: Client/core/ServerBrowser/CServerBrowser.cpp:741 +msgid "Loading..." msgstr "" -#: Client/core/CSettings.cpp:877 -msgid "Render peds always in high detail" +#: Client/core/ServerBrowser/CServerBrowser.cpp:1240 +#: Client/core/ServerBrowser/CServerBrowser.cpp:2182 +msgid " ..loading.." msgstr "" -#: Client/core/CSettings.cpp:881 -msgid "Corona rain reflections" +#: Client/core/ServerBrowser/CServerBrowser.cpp:1278 +#: Client/core/ServerBrowser/CServerBrowser.cpp:1406 +msgid "No address specified!" msgstr "" -#: Client/core/CSettings.cpp:910 -msgid "Enable remote websites" +#: Client/core/ServerBrowser/CServerBrowser.cpp:1291 +msgid "Unknown protocol" msgstr "" -#: Client/core/CSettings.cpp:915 -msgid "Enable Javascript on remote websites" +#: Client/core/ServerBrowser/CServerBrowser.cpp:1291 +msgid "Please use the mtasa:// protocol!" msgstr "" -#: Client/core/CSettings.cpp:920 -msgid "Custom blacklist" +#: Client/core/ServerBrowser/CServerBrowser.cpp:1300 +#: Client/core/ServerBrowser/CServerBrowser.cpp:1357 +#: Client/mods/deathmatch/logic/CClientGame.cpp:635 +#: Client/mods/deathmatch/logic/CClientGame.cpp:733 +msgid "Invalid nickname! Please go to Settings and set a new one!" msgstr "" -#: Client/core/CSettings.cpp:931 Client/core/CSettings.cpp:966 -msgid "Enter a domain e.g. google.com" +#: Client/core/ServerBrowser/CServerBrowser.cpp:1380 +msgid "You have to select a server to connect to." msgstr "" -#: Client/core/CSettings.cpp:939 -msgid "Block" +#: Client/core/DXHook/CDirect3DHook9.cpp:124 +msgid "" +"Could not initialize Direct3D9.\n" +"\n" +"Please ensure the DirectX End-User Runtime and\n" +"latest Windows Service Packs are installed correctly." msgstr "" -#: Client/core/CSettings.cpp:947 Client/core/CSettings.cpp:982 -msgid "Domain" +#: Client/mods/deathmatch/CClient.cpp:36 +msgid "This version has expired." msgstr "" -#: Client/core/CSettings.cpp:949 Client/core/CSettings.cpp:984 -msgid "Remove domain" +#: Client/mods/deathmatch/CClient.cpp:56 +msgid "disconnect from the game" msgstr "" -#. Reset vecTemp -#: Client/core/CSettings.cpp:955 -msgid "Custom whitelist" +#: Client/mods/deathmatch/CClient.cpp:57 +msgid "shows the nametags" msgstr "" -#. Misc section label -#: Client/core/CSettings.cpp:997 -msgid "Misc" +#: Client/mods/deathmatch/CClient.cpp:58 +msgid "shows the chatbox" msgstr "" -#. Fast clothes loading -#: Client/core/CSettings.cpp:1003 Client/core/CSettings.cpp:1010 -#: Client/core/CSettings.cpp:4803 -msgid "Fast CJ clothes loading:" +#: Client/mods/deathmatch/CClient.cpp:59 +msgid "shows the network statistics" msgstr "" -#. Browser scan speed -#: Client/core/CSettings.cpp:1003 Client/core/CSettings.cpp:1024 -#: Client/core/CSettings.cpp:4805 -msgid "Browser speed:" +#. Key commands (registered as 'mod commands', can be disabled) +#: Client/mods/deathmatch/CClient.cpp:62 +msgid "open the chat input" msgstr "" -#. Single download -#: Client/core/CSettings.cpp:1003 Client/core/CSettings.cpp:1038 -#: Client/core/CSettings.cpp:4807 -msgid "Single connection:" +#: Client/mods/deathmatch/CClient.cpp:63 +msgid "transmits voice to other players" msgstr "" -#. Packet tag -#: Client/core/CSettings.cpp:1003 Client/core/CSettings.cpp:1051 -#: Client/core/CSettings.cpp:4809 -msgid "Packet tag:" +#: Client/mods/deathmatch/CClient.cpp:64 +msgid "enters a car as passenger" msgstr "" -#. Progress animation -#: Client/core/CSettings.cpp:1004 Client/core/CSettings.cpp:1064 -#: Client/core/CSettings.cpp:4811 -msgid "Progress animation:" +#: Client/mods/deathmatch/CClient.cpp:65 +msgid "next radio channel" msgstr "" -#. Process priority -#: Client/core/CSettings.cpp:1004 Client/core/CSettings.cpp:1077 -#: Client/core/CSettings.cpp:4801 -msgid "Process priority:" +#: Client/mods/deathmatch/CClient.cpp:66 +msgid "previous radio channel" msgstr "" -#. Debug setting -#: Client/core/CSettings.cpp:1004 Client/core/CSettings.cpp:1091 -#: Client/core/CSettings.cpp:4813 -msgid "Debug setting:" +#: Client/mods/deathmatch/CClient.cpp:67 +msgid "enables the radar view" msgstr "" -#. Streaming memory -#: Client/core/CSettings.cpp:1005 Client/core/CSettings.cpp:1114 -#: Client/core/CSettings.cpp:4815 -msgid "Streaming memory:" +#: Client/mods/deathmatch/CClient.cpp:68 +msgid "zooms the radar in" msgstr "" -#. Update build type -#: Client/core/CSettings.cpp:1005 Client/core/CSettings.cpp:1215 -msgid "Update build type:" +#: Client/mods/deathmatch/CClient.cpp:69 +msgid "zooms the radar out" msgstr "" -#. UpdateAutoInstall -#: Client/core/CSettings.cpp:1005 Client/core/CSettings.cpp:1194 -msgid "Install important updates:" +#: Client/mods/deathmatch/CClient.cpp:70 +msgid "moves the radar north" msgstr "" -#: Client/core/CSettings.cpp:1018 Client/core/CSettings.cpp:1046 -#: Client/core/CSettings.cpp:1059 Client/core/CSettings.cpp:3156 -#: Client/core/CSettings.cpp:3172 Client/core/CSettings.cpp:3179 -msgid "On" +#: Client/mods/deathmatch/CClient.cpp:71 +msgid "moves the radar south" msgstr "" -#: Client/core/CSettings.cpp:1031 Client/core/CSettings.cpp:3161 -msgid "Very slow" +#: Client/mods/deathmatch/CClient.cpp:72 +msgid "moves the radar east" msgstr "" -#: Client/core/CSettings.cpp:1032 Client/core/CSettings.cpp:1045 -#: Client/core/CSettings.cpp:1058 Client/core/CSettings.cpp:1072 -#: Client/core/CSettings.cpp:1098 Client/core/CSettings.cpp:1110 -#: Client/core/CSettings.cpp:1202 Client/core/CSettings.cpp:1222 -#: Client/core/CSettings.cpp:3163 Client/core/CSettings.cpp:3170 -#: Client/core/CSettings.cpp:3177 Client/core/CSettings.cpp:3186 -#: Client/core/CSettings.cpp:3199 -msgid "Default" +#: Client/mods/deathmatch/CClient.cpp:73 +msgid "moves the radar west" msgstr "" -#: Client/core/CSettings.cpp:1033 Client/core/CSettings.cpp:3165 -msgid "Fast" +#: Client/mods/deathmatch/CClient.cpp:74 +msgid "attaches the radar" msgstr "" -#: Client/core/CSettings.cpp:1084 Client/core/CSettings.cpp:3141 -msgid "Normal" +#: Client/mods/deathmatch/CClient.cpp:75 +msgid "reduces radar opacity" msgstr "" -#: Client/core/CSettings.cpp:1085 Client/core/CSettings.cpp:3143 -msgid "Above normal" +#: Client/mods/deathmatch/CClient.cpp:76 +msgid "increases radar opacity" msgstr "" -#: Client/core/CSettings.cpp:1121 -msgid "Min" +#: Client/mods/deathmatch/CClient.cpp:77 +msgid "toggles radar help text" msgstr "" -#: Client/core/CSettings.cpp:1134 -msgid "Max" +#: Client/mods/deathmatch/CClient.cpp:78 +msgid "sends a message to the targetted player" msgstr "" -#. Windows 8 compatibility -#: Client/core/CSettings.cpp:1141 -msgid "Windows 8 compatibility:" +#: Client/mods/deathmatch/CClient.cpp:79 +msgid "changes to the next weapon whilst in a vehicle" msgstr "" -#: Client/core/CSettings.cpp:1145 -msgid "16-bit color" +#: Client/mods/deathmatch/CClient.cpp:80 +msgid "changes to the previous weapon whilst in a vehicle" msgstr "" -#: Client/core/CSettings.cpp:1150 -msgid "Mouse fix" +#: Client/mods/deathmatch/CClient.cpp:81 +msgid "outputs info about the current server" msgstr "" -#. Cache path info -#: Client/core/CSettings.cpp:1168 -msgid "Client resource files:" +#. ACHTUNG" Should this be handled by the atomic cvar setter? +#: Client/mods/deathmatch/CClient.cpp:84 +msgid "defines the scale multiplier of all text-displays" msgstr "" -#: Client/core/CSettings.cpp:1172 -msgid "Show in Explorer" +#. Development mode +#: Client/mods/deathmatch/CClient.cpp:91 +msgid "(Development mode) shows the colshapes" msgstr "" -#. Auto updater section label -#: Client/core/CSettings.cpp:1187 Client/core/CSettings.cpp:1190 -msgid "Auto updater" +#: Client/mods/deathmatch/CClient.cpp:92 +msgid "(Development mode) prints world sound ids into the debug window" msgstr "" -#. Check for updates -#: Client/core/CSettings.cpp:1228 -msgid "Check for update now" +#. Throw the error and disconnect +#: Client/mods/deathmatch/logic/CResourceFileDownloadManager.cpp:141 +#, c-format +msgid "Download error: %s" msgstr "" -#: Client/core/CSettings.cpp:1382 -msgid "Some settings will be changed when you next start MTA" +#: Client/mods/deathmatch/logic/CTransferBox.cpp:25 +msgid "Map download progress:" msgstr "" -#: Client/core/CSettings.cpp:1383 -msgid "" -"\n" -"\n" -"Do you want to restart now?" +#: Client/mods/deathmatch/logic/CTransferBox.cpp:28 +msgid "Download Progress:" msgstr "" -#: Client/core/CSettings.cpp:1386 -msgid "RESTART REQUIRED" +#. Find our largest piece of text, so we can size accordingly +#: Client/mods/deathmatch/logic/CTransferBox.cpp:42 +#: Client/mods/deathmatch/logic/CTransferBox.cpp:105 +#, c-format +msgid "%s of %s" msgstr "" -#: Client/core/CSettings.cpp:1406 -msgid "Some settings will be changed when you disconnect the current server" +#: Client/mods/deathmatch/logic/CTransferBox.cpp:44 +#: Client/mods/deathmatch/logic/CTransferBox.cpp:65 +msgid "Disconnect to cancel download" msgstr "" -#: Client/core/CSettings.cpp:1407 -msgid "" -"\n" -"\n" -"Do you want to disconnect now?" +#: Client/mods/deathmatch/logic/CPacketHandler.cpp:506 +msgid "Disconnected: Invalid nickname" msgstr "" -#: Client/core/CSettings.cpp:1410 -msgid "DISCONNECT REQUIRED" +#: Client/mods/deathmatch/logic/CPacketHandler.cpp:510 +msgid "Disconnect from server" msgstr "" -#. Update the joystick name -#: Client/core/CSettings.cpp:1737 -msgid "Joypad not detected - Check connections and restart game" +#: Client/mods/deathmatch/logic/CPacketHandler.cpp:514 +#, c-format +msgid "" +"Disconnected: Serial is banned.\n" +"Reason: %s" msgstr "" -#: Client/core/CSettings.cpp:1932 -msgid "Binding axis" +#: Client/mods/deathmatch/logic/CPacketHandler.cpp:520 +#, c-format +msgid "" +"Disconnected: You are banned.\n" +"Reason: %s" msgstr "" -#: Client/core/CSettings.cpp:1932 -msgid "Move an axis to bind, or escape to clear" +#: Client/mods/deathmatch/logic/CPacketHandler.cpp:526 +#, c-format +msgid "" +"Disconnected: Account is banned.\n" +"Reason: %s" msgstr "" -#: Client/core/CSettings.cpp:2009 -msgid "Language:" +#: Client/mods/deathmatch/logic/CPacketHandler.cpp:531 +msgid "Disconnected: Version mismatch" msgstr "" -#: Client/core/CSettings.cpp:2009 -msgid "Skin:" +#: Client/mods/deathmatch/logic/CPacketHandler.cpp:535 +msgid "Disconnected: Join flood. Please wait a minute, then reconnect." msgstr "" -#: Client/core/CSettings.cpp:2009 -msgid "Presets:" +#: Client/mods/deathmatch/logic/CPacketHandler.cpp:539 +#, c-format +msgid "" +"Disconnected: Server from different branch.\n" +"Information: %s" msgstr "" -#: Client/core/CSettings.cpp:2058 -msgid "Chat" +#: Client/mods/deathmatch/logic/CPacketHandler.cpp:544 +#, c-format +msgid "" +"Disconnected: Bad version.\n" +"Information: %s" msgstr "" -#: Client/core/CSettings.cpp:2075 -msgid "Load" +#: Client/mods/deathmatch/logic/CPacketHandler.cpp:549 +#, c-format +msgid "" +"Disconnected: Server is running a newer build.\n" +"Information: %s" msgstr "" -#: Client/core/CSettings.cpp:2087 -msgid "Colors" +#: Client/mods/deathmatch/logic/CPacketHandler.cpp:554 +#, c-format +msgid "" +"Disconnected: Server is running an older build.\n" +"Information: %s" msgstr "" -#: Client/core/CSettings.cpp:2088 -msgid "Layout" +#: Client/mods/deathmatch/logic/CPacketHandler.cpp:559 +msgid "Disconnected: Nick already in use" msgstr "" -#: Client/core/CSettings.cpp:2089 Client/core/CSettings.cpp:2335 -msgid "Options" +#: Client/mods/deathmatch/logic/CPacketHandler.cpp:563 +msgid "Disconnected: Player element could not be created." msgstr "" -#: Client/core/CSettings.cpp:2095 -msgid "Chat Background" +#: Client/mods/deathmatch/logic/CPacketHandler.cpp:567 +#, c-format +msgid "Disconnected: Server refused the connection: %s" msgstr "" -#: Client/core/CSettings.cpp:2095 -msgid "Chat Text" +#: Client/mods/deathmatch/logic/CPacketHandler.cpp:572 +msgid "Disconnected: Serial verification failed" msgstr "" -#: Client/core/CSettings.cpp:2095 -msgid "Input Background" +#: Client/mods/deathmatch/logic/CPacketHandler.cpp:576 +#, c-format +msgid "Disconnected: Connection desync %s" msgstr "" -#: Client/core/CSettings.cpp:2095 -msgid "Input Text" +#: Client/mods/deathmatch/logic/CPacketHandler.cpp:585 +#, c-format +msgid "Disconnected: You were kicked by %s" msgstr "" -#: Client/core/CSettings.cpp:2118 -msgid "Lines:" +#: Client/mods/deathmatch/logic/CPacketHandler.cpp:590 +#, c-format +msgid "Disconnected: You were banned by %s" msgstr "" -#: Client/core/CSettings.cpp:2118 -msgid "Scale:" +#: Client/mods/deathmatch/logic/CPacketHandler.cpp:601 +msgid "Disconnected: Server shutdown or restarting" msgstr "" -#: Client/core/CSettings.cpp:2118 -msgid "Width:" +#: Client/mods/deathmatch/logic/CPacketHandler.cpp:621 +msgid "You were kicked from the game" msgstr "" -#: Client/core/CSettings.cpp:2121 -msgid "Size" +#: Client/mods/deathmatch/logic/CPacketHandler.cpp:622 +#: Client/mods/deathmatch/logic/CPacketHandler.cpp:633 +msgid "This server requires a non-modifed gta_sa.exe" msgstr "" -#: Client/core/CSettings.cpp:2170 -msgid "after" +#: Client/mods/deathmatch/logic/CPacketHandler.cpp:623 +#: Client/mods/deathmatch/logic/CPacketHandler.cpp:634 +msgid "Please replace gta_sa.exe" msgstr "" -#: Client/core/CSettings.cpp:2170 -msgid "for" +#: Client/mods/deathmatch/logic/CPacketHandler.cpp:624 +msgid "This server does not allow custom D3D9.DLLs" msgstr "" -#: Client/core/CSettings.cpp:2170 -msgid "sec" +#: Client/mods/deathmatch/logic/CPacketHandler.cpp:625 +msgid "Remove D3D9.DLL from your GTA install directory and restart MTA" msgstr "" -#: Client/core/CSettings.cpp:2173 -msgid "Fading" +#: Client/mods/deathmatch/logic/CPacketHandler.cpp:626 +msgid "This server does not allow virtual machines" msgstr "" -#: Client/core/CSettings.cpp:2179 -msgid "Fade out old lines" +#: Client/mods/deathmatch/logic/CPacketHandler.cpp:627 +msgid "This server requires driver signing to be enabled" msgstr "" -#: Client/core/CSettings.cpp:2219 -msgid "Horizontal:" +#: Client/mods/deathmatch/logic/CPacketHandler.cpp:628 +msgid "Please restart your PC" msgstr "" -#: Client/core/CSettings.cpp:2219 -msgid "Vertical:" +#: Client/mods/deathmatch/logic/CPacketHandler.cpp:629 +msgid "This server has detected missing anti-cheat components" msgstr "" -#: Client/core/CSettings.cpp:2219 -msgid "Text-Align:" +#: Client/mods/deathmatch/logic/CPacketHandler.cpp:630 +msgid "Try restarting MTA" msgstr "" -#: Client/core/CSettings.cpp:2219 -msgid "X-Offset:" +#: Client/mods/deathmatch/logic/CPacketHandler.cpp:631 +msgid "This server requires a non-modifed gta3.img and gta_int.img" msgstr "" -#: Client/core/CSettings.cpp:2220 -msgid "Y-Offset:" +#: Client/mods/deathmatch/logic/CPacketHandler.cpp:632 +msgid "Please replace gta3.img or gta_int.img" msgstr "" -#: Client/core/CSettings.cpp:2226 -msgid "Position" +#: Client/mods/deathmatch/logic/CPacketHandler.cpp:635 +msgid "This server does not allow Wine" msgstr "" -#: Client/core/CSettings.cpp:2240 Client/core/CSettings.cpp:2268 -#: Client/core/CKeyBinds.cpp:191 -msgid "Left" +#: Client/mods/deathmatch/logic/CPacketHandler.cpp:636 +msgid "Ensure no other program is modifying MTA:SA" msgstr "" -#: Client/core/CSettings.cpp:2241 Client/core/CSettings.cpp:2255 -msgid "Center" +#: Client/mods/deathmatch/logic/CPacketHandler.cpp:650 +msgid "Time Remaining: " msgstr "" -#: Client/core/CSettings.cpp:2242 Client/core/CSettings.cpp:2269 -#: Client/core/CKeyBinds.cpp:192 -msgid "Right" -msgstr "" +#: Client/mods/deathmatch/logic/CPacketHandler.cpp:660 +#, c-format +msgid "%d day" +msgid_plural "%d days" +msgstr[0] "" +msgstr[1] "" -#: Client/core/CSettings.cpp:2254 -msgid "Top" -msgstr "" +#: Client/mods/deathmatch/logic/CPacketHandler.cpp:662 +#, c-format +msgid "%d hour" +msgid_plural "%d hours" +msgstr[0] "" +msgstr[1] "" -#: Client/core/CSettings.cpp:2256 -msgid "Bottom" -msgstr "" +#: Client/mods/deathmatch/logic/CPacketHandler.cpp:664 +#, c-format +msgid "%d minute" +msgid_plural "%d minutes" +msgstr[0] "" +msgstr[1] "" -#: Client/core/CSettings.cpp:2304 -msgid "Font" -msgstr "" +#: Client/mods/deathmatch/logic/CPacketHandler.cpp:666 +#, c-format +msgid "%d second" +msgid_plural "%d seconds" +msgstr[0] "" +msgstr[1] "" -#: Client/core/CSettings.cpp:2341 -msgid "Hide background when not typing" +#. Display the error +#: Client/mods/deathmatch/logic/CPacketHandler.cpp:670 +msgid "Disconnected" msgstr "" -#: Client/core/CSettings.cpp:2346 -msgid "Nickname completion using the \"Tab\" key" +#: Client/mods/deathmatch/logic/CClientGame.cpp:369 +msgid "Flying a UFO around" msgstr "" -#: Client/core/CSettings.cpp:2351 -msgid "Allow server to flash the window" +#: Client/mods/deathmatch/logic/CClientGame.cpp:369 +msgid "Cruising around" msgstr "" -#: Client/core/CSettings.cpp:2356 -msgid "Allow tray balloon notifications" +#: Client/mods/deathmatch/logic/CClientGame.cpp:369 +msgid "Riding the waves of" msgstr "" -#: Client/core/CSettings.cpp:2361 -msgid "Chat text black/white outline" +#: Client/mods/deathmatch/logic/CClientGame.cpp:370 +msgid "Riding the train in" msgstr "" -#. Create a messagebox to notify the user -#. SString strText = SString::Printf ( "Press a key to bind to '%s'", pItemBind->GetText ().c_str () ); -#. Create a messagebox to notify the user -#. sSString strText = SString::Printf ( "Press a key to bind to '%s'", pItemBind->GetText ().c_str () ); -#: Client/core/CSettings.cpp:2610 Client/core/CSettings.cpp:2617 -msgid "Press a key to bind, or escape to clear" +#: Client/mods/deathmatch/logic/CClientGame.cpp:370 +msgid "Flying around" msgstr "" -#: Client/core/CSettings.cpp:2611 -msgid "Binding a primary key" +#: Client/mods/deathmatch/logic/CClientGame.cpp:371 +msgid "Riding around" msgstr "" -#: Client/core/CSettings.cpp:2618 -msgid "Binding a secondary key" +#: Client/mods/deathmatch/logic/CClientGame.cpp:371 +msgid "Monster truckin' around" msgstr "" -#: Client/core/CSettings.cpp:2694 -msgid "GTA GAME CONTROLS" +#: Client/mods/deathmatch/logic/CClientGame.cpp:371 +msgid "Quaddin' around" msgstr "" -#: Client/core/CSettings.cpp:2696 -msgid "MULTIPLAYER CONTROLS" +#: Client/mods/deathmatch/logic/CClientGame.cpp:372 +msgid "Bunny hopping around" msgstr "" -#: Client/core/CSettings.cpp:2941 Client/core/CSettings.cpp:4764 -msgid "Your nickname contains invalid characters!" +#: Client/mods/deathmatch/logic/CClientGame.cpp:372 +msgid "Doing weird stuff in" msgstr "" -#: Client/core/CSettings.cpp:3778 -msgid "Red:" +#: Client/mods/deathmatch/logic/CClientGame.cpp:376 +msgid "Climbing around in" msgstr "" -#: Client/core/CSettings.cpp:3778 -msgid "Green:" +#: Client/mods/deathmatch/logic/CClientGame.cpp:377 +#: Client/mods/deathmatch/logic/CClientGame.cpp:378 +msgid "Doing a drive-by in" msgstr "" -#: Client/core/CSettings.cpp:3778 -msgid "Blue:" +#: Client/mods/deathmatch/logic/CClientGame.cpp:379 +msgid "Blub blub..." msgstr "" -#: Client/core/CSettings.cpp:3778 -msgid "Transparency:" +#: Client/mods/deathmatch/logic/CClientGame.cpp:380 +msgid "Breathing water" msgstr "" -#: Client/core/CSettings.cpp:3781 -msgid "Color" +#: Client/mods/deathmatch/logic/CClientGame.cpp:381 +msgid "Drowning in" msgstr "" -#: Client/core/CSettings.cpp:3858 -msgid "Preview" +#: Client/mods/deathmatch/logic/CClientGame.cpp:382 +msgid "Ducking for cover in" msgstr "" -#: Client/core/CSettings.cpp:4166 -msgid "Please disconnect before changing language" +#: Client/mods/deathmatch/logic/CClientGame.cpp:383 +msgid "Fighting in" msgstr "" -#: Client/core/CSettings.cpp:4194 -msgid "Please disconnect before changing skin" +#: Client/mods/deathmatch/logic/CClientGame.cpp:384 +msgid "Throwing fists in" msgstr "" -#: Client/core/CSettings.cpp:4482 -msgid "" -"Volmetric shadows can cause some systems to slow down.\n" -"\n" -"Are you sure you want to enable them?" +#: Client/mods/deathmatch/logic/CClientGame.cpp:385 +msgid "Blastin' fools in" msgstr "" -#: Client/core/CSettings.cpp:4486 -msgid "PERFORMANCE WARNING" +#: Client/mods/deathmatch/logic/CClientGame.cpp:386 +msgid "Shooting up" msgstr "" -#: Client/core/CSettings.cpp:4506 -msgid "" -"Screen upload is required by some servers for anti-cheat purposes.\n" -"\n" -"(The chat box and GUI is excluded from the upload)\n" +#: Client/mods/deathmatch/logic/CClientGame.cpp:387 +msgid "Jetpacking in" msgstr "" -#: Client/core/CSettings.cpp:4508 -msgid "SCREEN UPLOAD INFORMATION" +#: Client/mods/deathmatch/logic/CClientGame.cpp:388 +msgid "Literally on fire in" msgstr "" -#: Client/core/CSettings.cpp:4523 -msgid "" -"Some scripts may play sounds, such as radio, from the internet.\n" -"\n" -"Disabling this setting may decrease network\n" -"bandwidth consumption.\n" +#: Client/mods/deathmatch/logic/CClientGame.cpp:389 +msgid "Burning up in" msgstr "" -#: Client/core/CSettings.cpp:4526 -msgid "EXTERNAL SOUNDS" +#: Client/mods/deathmatch/logic/CClientGame.cpp:390 +msgid "Swimming in" msgstr "" -#: Client/core/CSettings.cpp:4555 -msgid "" -"It seems that you have the Rich Presence connection option enabled.\n" -"Do you want to allow servers to share their data?\n" -"\n" -"This includes yours unique ID identifier." +#: Client/mods/deathmatch/logic/CClientGame.cpp:391 +msgid "Floating around in" msgstr "" -#: Client/core/CSettings.cpp:4560 -msgid "CONSENT TO ALLOW DATA SHARING" +#: Client/mods/deathmatch/logic/CClientGame.cpp:392 +msgid "Being chased by a shark" msgstr "" -#: Client/core/CSettings.cpp:4584 -msgid "" -"Some files in your GTA:SA data directory are customized.\n" -"MTA will only use these modified files if this check box is ticked.\n" -"\n" -"However, CUSTOMIZED GTA:SA FILES ARE BLOCKED BY MANY SERVERS\n" -"\n" -"Are you sure you want to use them?" +#: Client/mods/deathmatch/logic/CClientGame.cpp:393 +msgid "Choking to death in" msgstr "" -#: Client/core/CSettings.cpp:4590 Client/core/CVersionUpdater.cpp:2081 -msgid "CUSTOMIZED GTA:SA FILES" +#: Client/mods/deathmatch/logic/CClientGame.cpp:651 +msgid "Entering the game ..." msgstr "" -#: Client/core/CSettings.cpp:4633 +#: Client/mods/deathmatch/logic/CClientGame.cpp:709 msgid "" -"Enabling DPI awareness is an experimental feature and\n" -"we only recommend it when you play MTA:SA on a scaled monitor.\n" -"You may experience graphical issues if you enable this option.\n" -"\n" -"Are you sure you want to enable this option?" +"Not connected; please use Quick Connect or the 'connect' command to connect " +"to a server." msgstr "" -#: Client/core/CSettings.cpp:4639 -msgid "EXPERIMENTAL FEATURE" +#: Client/mods/deathmatch/logic/CClientGame.cpp:755 +msgid "Could not start the local server. See console for details." msgstr "" -#: Client/core/CSettings.cpp:4782 -msgid "Please enter a nickname" +#: Client/mods/deathmatch/logic/CClientGame.cpp:765 +#: Client/mods/deathmatch/logic/CClientGame.cpp:1237 +msgid "Local Server" msgstr "" -#: Client/core/CSettings.cpp:4783 -msgid "" -"Please enter a nickname to be used ingame. \n" -"This will be your name when you connect to and play in a server" +#: Client/mods/deathmatch/logic/CClientGame.cpp:765 +msgid "Starting local server ..." msgstr "" -#: Client/core/CSettings.cpp:4801 -msgid "Very experimental feature." +#: Client/mods/deathmatch/logic/CClientGame.cpp:1013 +msgid "Area 51" msgstr "" -#: Client/core/CSettings.cpp:4803 -msgid "Stops stalls with CJ variations (Uses 65MB more RAM)" +#: Client/mods/deathmatch/logic/CClientGame.cpp:1022 +msgid "Walking around " msgstr "" -#: Client/core/CSettings.cpp:4805 -msgid "Older routers may require a slower scan speed." +#: Client/mods/deathmatch/logic/CClientGame.cpp:1168 +#, c-format +msgid "You were kicked from the game ( %s )" msgstr "" -#: Client/core/CSettings.cpp:4807 -msgid "Switch on to use only one connection when downloading." +#: Client/mods/deathmatch/logic/CClientGame.cpp:1237 +msgid "Connecting to local server..." msgstr "" -#: Client/core/CSettings.cpp:4809 -msgid "Tag network packets to help ISPs identify MTA traffic." +#: Client/mods/deathmatch/logic/CClientGame.cpp:1248 +msgid "Error connecting to server." msgstr "" -#: Client/core/CSettings.cpp:4811 -msgid "Spinning circle animation at the bottom of the screen" +#: Client/mods/deathmatch/logic/CClientGame.cpp:1258 +msgid "Connecting to local server timed out. See console for details." msgstr "" -#: Client/core/CSettings.cpp:4813 -msgid "Select default always. (This setting is not saved)" +#: Client/mods/deathmatch/logic/CClientGame.cpp:1364 +msgid "Connection with the server was lost" msgstr "" -#: Client/core/CSettings.cpp:4815 -msgid "Maximum is usually best" +#: Client/mods/deathmatch/logic/CClientGame.cpp:1391 +msgid "Disconnected: the server is currently full" msgstr "" -#: Client/core/CSettings.cpp:4817 Client/core/CSettings.cpp:4819 -msgid "Auto updater:" +#: Client/mods/deathmatch/logic/CClientGame.cpp:1403 +msgid "Disconnected: invalid password specified" msgstr "" -#: Client/core/CSettings.cpp:4817 -msgid "Select default unless you like filling out bug reports." +#: Client/mods/deathmatch/logic/CClientGame.cpp:1425 +msgid "MTA Client verification failed!" msgstr "" -#: Client/core/CSettings.cpp:4819 -msgid "Select default to automatically install important updates." +#: Client/mods/deathmatch/logic/CClientGame.cpp:5683 +msgid "In a ditch" msgstr "" -#: Client/core/CSettings.cpp:4821 -msgid "16-bit color:" +#: Client/mods/deathmatch/logic/CClientGame.cpp:5683 +msgid "En-route to hospital" msgstr "" -#: Client/core/CSettings.cpp:4821 -msgid "Enable 16 bit color modes - Requires MTA restart" +#: Client/mods/deathmatch/logic/CClientGame.cpp:5683 +msgid "Meeting their maker" msgstr "" -#: Client/core/CSettings.cpp:4823 -msgid "Mouse fix:" +#: Client/mods/deathmatch/logic/CClientGame.cpp:5684 +msgid "Regretting their decisions" msgstr "" -#: Client/core/CSettings.cpp:4823 -msgid "Mouse movement fix - May need PC restart" +#: Client/mods/deathmatch/logic/CClientGame.cpp:5684 +msgid "Wasted" msgstr "" -#: Client/core/CVersionUpdater.cpp:626 -msgid "Busy" +#: Client/mods/deathmatch/logic/CLocalServer.cpp:37 +msgid "HOST GAME" msgstr "" -#: Client/core/CVersionUpdater.cpp:626 -msgid "Can't check for updates right now" +#. m_pTabs->CreateTab ( "Gamemode" ); +#: Client/mods/deathmatch/logic/CLocalServer.cpp:53 +msgid "Resources" msgstr "" -#: Client/core/CVersionUpdater.cpp:1567 Client/core/CVersionUpdater.cpp:1587 -#: Client/core/CVersionUpdater.cpp:1605 -#, c-format -msgid "MTA:SA %s required" +#: Client/mods/deathmatch/logic/CLocalServer.cpp:55 +#: Client/mods/deathmatch/logic/CLocalServer.cpp:57 +msgid "Server name:" msgstr "" -#: Client/core/CVersionUpdater.cpp:1568 -#, c-format -msgid "" -"An updated version of MTA:SA %s is required to join the selected server.\n" -"\n" -"Do you want to download and install MTA:SA %s ?" +#: Client/mods/deathmatch/logic/CLocalServer.cpp:64 +#: Client/mods/deathmatch/logic/CLocalServer.cpp:66 +msgid "Password:" msgstr "" -#: Client/core/CVersionUpdater.cpp:1588 -#, c-format -msgid "Do you want to launch MTA:SA %s and connect to this server ?" +#: Client/mods/deathmatch/logic/CLocalServer.cpp:73 +#: Client/mods/deathmatch/logic/CLocalServer.cpp:75 +msgid "Max players:" msgstr "" -#: Client/core/CVersionUpdater.cpp:1606 -msgid "" -"It is not possible to connect at this time.\n" -"\n" -"Please try later." +#: Client/mods/deathmatch/logic/CLocalServer.cpp:82 +#: Client/mods/deathmatch/logic/CLocalServer.cpp:84 +msgid "Broadcast:" msgstr "" -#: Client/core/CVersionUpdater.cpp:1788 -msgid "Connecting" +#: Client/mods/deathmatch/logic/CLocalServer.cpp:86 +msgid "LAN" msgstr "" -#: Client/core/CVersionUpdater.cpp:1789 Client/core/CVersionUpdater.cpp:1805 -msgid "Please wait..." +#: Client/mods/deathmatch/logic/CLocalServer.cpp:99 +msgid "Selected" msgstr "" -#: Client/core/CVersionUpdater.cpp:1804 -msgid "CHECKING" +#: Client/mods/deathmatch/logic/CLocalServer.cpp:116 +msgid "All" msgstr "" -#: Client/core/CVersionUpdater.cpp:1821 Client/core/CVersionUpdater.cpp:1914 -msgid "UPDATE CHECK" +#: Client/mods/deathmatch/logic/CLocalServer.cpp:118 +msgid "Start" msgstr "" -#: Client/core/CVersionUpdater.cpp:1822 -msgid "No update needed" +#: Client/loader/Dialogs.cpp:134 +msgid "Quit" msgstr "" -#: Client/core/CVersionUpdater.cpp:1839 -msgid "DOWNLOADING" +#: Client/loader/Dialogs.cpp:151 +msgid "MTA: San Andreas has encountered a problem" msgstr "" -#: Client/core/CVersionUpdater.cpp:1840 -msgid "waiting..." +#: Client/loader/Dialogs.cpp:152 +msgid "Crash information" msgstr "" -#: Client/core/CVersionUpdater.cpp:1856 -msgid "MANDATORY UPDATE" +#: Client/loader/Dialogs.cpp:153 +msgid "" +"Tick the check box to send this crash info to MTA devs using the 'internet'" msgstr "" -#: Client/core/CVersionUpdater.cpp:1857 -msgid "" -"To join this server, you must update MTA.\n" -"\n" -" Do you want to update now ?" +#: Client/loader/Dialogs.cpp:154 +msgid "Doing so will increase the chance of this crash being fixed." msgstr "" -#: Client/core/CVersionUpdater.cpp:1875 -msgid "OPTIONAL UPDATE" +#: Client/loader/Dialogs.cpp:155 +msgid "Do you want to restart MTA: San Andreas ?" msgstr "" -#: Client/core/CVersionUpdater.cpp:1876 +#: Client/loader/Dialogs.cpp:162 +msgid "MTA: San Andreas - Warning" +msgstr "" + +#: Client/loader/Dialogs.cpp:163 msgid "" -"Server says an update is recommended, but not essential.\n" -"\n" -" Do you want to update now ?" +"Your Grand Theft Auto: San Andreas install directory contains these files:" msgstr "" -#: Client/core/CVersionUpdater.cpp:1915 +#: Client/loader/Dialogs.cpp:165 msgid "" -"Update not currently avalable.\n" +"These files are not required and may interfere with the graphical features " +"in this version of MTA:SA.\n" "\n" -"Please check www.mtasa.com" +"It is recommended that you remove or rename these files." msgstr "" -#: Client/core/CVersionUpdater.cpp:1936 Client/core/CVersionUpdater.cpp:2118 -msgid "ERROR SAVING" +#: Client/loader/Dialogs.cpp:167 +msgid "Keep these files, but also show this warning on next start" msgstr "" -#: Client/core/CVersionUpdater.cpp:1937 Client/core/CVersionUpdater.cpp:2119 -msgid "Unable to create the file." +#: Client/loader/Dialogs.cpp:168 +msgid "Do not remind me about these files again" msgstr "" -#: Client/core/CVersionUpdater.cpp:1945 Client/core/CVersionUpdater.cpp:1954 -#: Client/core/CVersionUpdater.cpp:2127 Client/core/CVersionUpdater.cpp:2136 -msgid "ERROR DOWNLOADING" +#: Client/loader/Dialogs.cpp:169 +msgid "Rename these files from *.dll to *.dll.bak" msgstr "" -#: Client/core/CVersionUpdater.cpp:1946 Client/core/CVersionUpdater.cpp:2128 -msgid "The downloaded file appears to be incorrect." +#: Client/loader/Dialogs.cpp:170 +msgid "Show me these files" msgstr "" -#: Client/core/CVersionUpdater.cpp:1955 Client/core/CVersionUpdater.cpp:2137 -msgid "For some reason." +#: Client/loader/Dialogs.cpp:171 +msgid "Play MTA:SA" msgstr "" -#: Client/core/CVersionUpdater.cpp:1966 Client/core/CVersionUpdater.cpp:2150 -msgid "DOWNLOAD COMPLETE" +#: Client/loader/Dialogs.cpp:177 +msgid "MTA: San Andreas - Confusing options" msgstr "" -#: Client/core/CVersionUpdater.cpp:1990 -msgid " - Unknown problem in _DialogUpdateResult" +#: Client/loader/Dialogs.cpp:178 +msgid "NVidia Optimus detected!" msgstr "" -#: Client/core/CVersionUpdater.cpp:2088 Client/core/CVersionUpdater.cpp:2098 -msgid "Ok" +#: Client/loader/Dialogs.cpp:179 +msgid "Try each option and see what works:" msgstr "" -#: Client/core/CVersionUpdater.cpp:2096 -msgid "ERROR" +#: Client/loader/Dialogs.cpp:180 +msgid "A - Standard NVidia" msgstr "" -#: Client/core/CVersionUpdater.cpp:2097 -msgid "" -"Some MTA:SA data files are missing.\n" -"\n" -"\n" -"Please reinstall MTA:SA" +#: Client/loader/Dialogs.cpp:181 +msgid "B - Alternate NVidia" msgstr "" -#: Client/core/CVersionUpdater.cpp:2774 -#, c-format -msgid "%3d %% completed" +#: Client/loader/Dialogs.cpp:182 +msgid "C - Standard Intel" msgstr "" -#: Client/core/CVersionUpdater.cpp:2777 -#, c-format -msgid "" -"\n" -"\n" -"Waiting for response - %-3d" +#: Client/loader/Dialogs.cpp:183 +msgid "D - Alternate Intel" msgstr "" -#. Even the default skin doesn't work, so give up -#: Client/core/CGUI.cpp:86 -msgid "" -"The skin you selected could not be loaded, and the default skin also could " -"not be loaded, please reinstall MTA." +#: Client/loader/Dialogs.cpp:184 +msgid "If you get desperate, this might help:" msgstr "" -#. Create window -#: Client/core/CConsole.cpp:417 -msgid "CONSOLE" +#: Client/loader/Dialogs.cpp:185 +msgid "If you have already selected an option that works, this might help:" msgstr "" -#: Client/core/CScreenShot.cpp:104 -#, c-format -msgid "Screenshot got %d bytes, but expected %d" +#: Client/loader/Dialogs.cpp:186 +msgid "Force windowed mode" msgstr "" -#: Client/core/CScreenShot.cpp:110 -msgid "Screenshot failed" +#: Client/loader/Dialogs.cpp:187 +msgid "Don't show again" msgstr "" -#: Client/core/CScreenShot.cpp:160 -#, c-format -msgid "Screenshot taken: '%s'" +#: Client/loader/Dialogs.cpp:195 +msgid "Warning: Could not detect anti-virus product" msgstr "" -#. Create the window -#: Client/core/CNewsBrowser.cpp:153 -msgid "NEWS" +#: Client/loader/Dialogs.cpp:197 +msgid "" +"MTA could not detect an anti-virus on your PC.\n" +"\n" +"Viruses interfere with MTA and degrade your gameplay experience.\n" +"\n" +"Press 'Help' for more information." msgstr "" -#. News link -#: Client/core/CNewsBrowser.cpp:171 Client/core/CNewsBrowser.cpp:172 -msgid "Visit latest news article" +#: Client/loader/Dialogs.cpp:200 +msgid "I have already installed an anti-virus" msgstr "" -#: Client/core/CMainMenu.cpp:333 +#: Client/loader/Dialogs.cpp:202 msgid "" -"You are using a feature-branch build! This is a test build only which cannot " -"be used to connect to public servers!" +"I will not install an anti-virus.\n" +"I want my PC to lag and be part of a botnet." msgstr "" -#: Client/core/CMainMenu.cpp:352 -msgid "" -"MTA will not receive updates on XP/Vista after July 2019.\n" -"\n" -"Upgrade Windows to play on the latest servers." +#: Client/loader/Dialogs.cpp:890 Client/loader/Utils.cpp:534 +msgid "Searching for Grand Theft Auto San Andreas" msgstr "" -#: Client/core/CMainMenu.cpp:1193 -msgid "" -"This will disconnect you from the current server.\n" -"\n" -"Are you sure you want to disconnect?" +#: Client/loader/Dialogs.cpp:893 Client/loader/Utils.cpp:536 +msgid "Please start Grand Theft Auto San Andreas" msgstr "" -#: Client/core/CMainMenu.cpp:1197 -msgid "DISCONNECT WARNING" +#: Client/loader/Dialogs.cpp:901 Client/loader/Install.cpp:852 +msgid "Installing update..." msgstr "" -#: Client/core/CKeyBinds.cpp:186 -msgid "Fire" +#: Client/loader/Dialogs.cpp:909 Client/loader/Install.cpp:934 +msgid "Extracting files..." msgstr "" -#: Client/core/CKeyBinds.cpp:187 -msgid "Next weapon" +#: Client/loader/Dialogs.cpp:914 Client/loader/Utils.cpp:1394 +msgid "Copying files..." msgstr "" -#: Client/core/CKeyBinds.cpp:188 -msgid "Previous weapon" +#: Client/loader/Dialogs.cpp:919 Client/loader/Utils.cpp:1454 +msgid "Copy finished early. Everything OK." msgstr "" -#: Client/core/CKeyBinds.cpp:189 -msgid "Forwards" +#: Client/loader/Dialogs.cpp:924 Client/loader/Utils.cpp:1460 +msgid "Finishing..." msgstr "" -#: Client/core/CKeyBinds.cpp:190 -msgid "Backwards" +#: Client/loader/Dialogs.cpp:928 Client/loader/Utils.cpp:1462 +msgid "Done!" msgstr "" -#: Client/core/CKeyBinds.cpp:193 -msgid "Zoom in" +#: Client/loader/Utils.cpp:600 +msgid "Select your Grand Theft Auto: San Andreas Installation Directory" msgstr "" -#: Client/core/CKeyBinds.cpp:194 -msgid "Zoom out" +#: Client/loader/Utils.cpp:968 Client/loader/CInstallManager.cpp:361 +#, c-format +msgid "" +"MTA:SA needs Administrator access for the following task:\n" +"\n" +" '%s'\n" +"\n" +"Please confirm in the next window." msgstr "" -#: Client/core/CKeyBinds.cpp:195 -msgid "Enter/Exit" +#: Client/loader/Utils.cpp:1069 +#, c-format +msgid "Error loading %s module! (%s)" msgstr "" -#: Client/core/CKeyBinds.cpp:196 -msgid "Change camera" +#: Client/loader/Utils.cpp:1502 +#, c-format +msgid "" +"New installation of %s detected.\n" +"\n" +"Do you want to copy your settings from %s ?" msgstr "" -#. 10 -#: Client/core/CKeyBinds.cpp:197 -msgid "Jump" -msgstr "" - -#: Client/core/CKeyBinds.cpp:198 -msgid "Sprint" -msgstr "" - -#: Client/core/CKeyBinds.cpp:199 -msgid "Look behind" -msgstr "" - -#: Client/core/CKeyBinds.cpp:200 -msgid "Crouch" -msgstr "" - -#: Client/core/CKeyBinds.cpp:201 -msgid "Action" -msgstr "" - -#: Client/core/CKeyBinds.cpp:202 -msgid "Walk" -msgstr "" - -#: Client/core/CKeyBinds.cpp:203 -msgid "Vehicle fire" -msgstr "" - -#: Client/core/CKeyBinds.cpp:204 -msgid "Vehicle secondary fire" -msgstr "" - -#: Client/core/CKeyBinds.cpp:205 -msgid "Vehicle left" -msgstr "" - -#: Client/core/CKeyBinds.cpp:206 -msgid "Vehicle right" -msgstr "" - -#. 20 -#: Client/core/CKeyBinds.cpp:207 -msgid "Steer forwards/down" -msgstr "" - -#: Client/core/CKeyBinds.cpp:208 -msgid "Steer backwards/up" -msgstr "" - -#: Client/core/CKeyBinds.cpp:209 -msgid "Accelerate" -msgstr "" - -#: Client/core/CKeyBinds.cpp:210 -msgid "Brake/Reverse" -msgstr "" - -#: Client/core/CKeyBinds.cpp:211 -msgid "Radio next" -msgstr "" - -#: Client/core/CKeyBinds.cpp:212 -msgid "Radio previous" -msgstr "" - -#: Client/core/CKeyBinds.cpp:213 -msgid "Radio user track skip" -msgstr "" - -#: Client/core/CKeyBinds.cpp:214 -msgid "Horn" -msgstr "" - -#: Client/core/CKeyBinds.cpp:215 -msgid "Sub-mission" -msgstr "" - -#: Client/core/CKeyBinds.cpp:216 -msgid "Handbrake" -msgstr "" - -#. 30 -#: Client/core/CKeyBinds.cpp:217 -msgid "Vehicle look left" -msgstr "" - -#: Client/core/CKeyBinds.cpp:218 -msgid "Vehicle look right" -msgstr "" - -#: Client/core/CKeyBinds.cpp:219 -msgid "Vehicle look behind" -msgstr "" - -#: Client/core/CKeyBinds.cpp:220 -msgid "Vehicle mouse look" +#: Client/loader/Utils.cpp:1541 +#, c-format +msgid "GTA:SA had trouble opening the file '%s'" msgstr "" -#: Client/core/CKeyBinds.cpp:221 -msgid "Special control left" +#: Client/loader/Utils.cpp:1563 +#, c-format +msgid "GTA:SA is missing the file '%s'." msgstr "" -#: Client/core/CKeyBinds.cpp:222 -msgid "Special control right" +#: Client/loader/Utils.cpp:1588 +msgid "GTA:SA had trouble loading a model." msgstr "" -#: Client/core/CKeyBinds.cpp:223 -msgid "Special control down" +#: Client/loader/Utils.cpp:1590 +msgid "If you recently modified gta3.img, then try reinstalling GTA:SA." msgstr "" -#: Client/core/CKeyBinds.cpp:224 -msgid "Special control up" +#: Client/loader/Utils.cpp:1615 +msgid "GTA:SA had trouble adding an upgrade to a vehicle." msgstr "" -#: Client/core/CKeyBinds.cpp:225 -msgid "Aim weapon" +#: Client/loader/Utils.cpp:1634 +#, c-format +msgid "GTA:SA found errors in the file '%s'" msgstr "" -#: Client/core/CKeyBinds.cpp:226 -msgid "Conversation yes" +#: Client/loader/Utils.cpp:1716 +msgid "Did your computer restart when playing MTA:SA?" msgstr "" -#. 40 -#: Client/core/CKeyBinds.cpp:227 -msgid "Conversation no" +#: Client/loader/Utils.cpp:1781 +msgid "Please terminate the following programs before continuing:" msgstr "" -#: Client/core/CKeyBinds.cpp:228 -msgid "Group control forwards" +#: Client/loader/MainFunctions.cpp:248 +msgid "" +"Trouble restarting MTA:SA\n" +"\n" +"If the problem persists, open Task Manager and\n" +"stop the 'gta_sa.exe' and 'Multi Theft Auto.exe' processes\n" +"\n" +"\n" +"Try to launch MTA:SA again?" msgstr "" -#: Client/core/CKeyBinds.cpp:229 -msgid "Group control backwards" +#: Client/loader/MainFunctions.cpp:266 +msgid "" +"Another instance of MTA is already running.\n" +"\n" +"If this problem persists, please restart your computer" msgstr "" -#: Client/core/CJoystickManager.cpp:1578 -msgid "Accelerate Axis" +#: Client/loader/MainFunctions.cpp:269 +msgid "" +"Another instance of MTA is already running.\n" +"\n" +"Do you want to terminate it?" msgstr "" -#: Client/core/CJoystickManager.cpp:1580 -msgid "Brake Axis" +#: Client/loader/MainFunctions.cpp:294 +msgid "" +"Are you having problems running MTA:SA?.\n" +"\n" +"Do you want to revert to an earlier version?" msgstr "" -#: Client/core/DXHook/CDirect3DHook9.cpp:124 +#: Client/loader/MainFunctions.cpp:324 msgid "" -"Could not initialize Direct3D9.\n" +"There seems to be a problem launching MTA:SA.\n" +"Resetting GTA settings can sometimes fix this problem.\n" "\n" -"Please ensure the DirectX End-User Runtime and\n" -"latest Windows Service Packs are installed correctly." +"Do you want to reset GTA settings now?" msgstr "" -#. Create queue window -#: Client/core/ServerBrowser/CServerInfo.cpp:32 -#: Client/core/ServerBrowser/CServerInfo.cpp:302 -msgid "SERVER IS FULL" +#: Client/loader/MainFunctions.cpp:339 +msgid "" +"GTA settings have been reset.\n" +"\n" +"Press OK to continue." msgstr "" -#. Determine our label draw position for L10n -#. Start position -#. Server Name -#: Client/core/ServerBrowser/CServerInfo.cpp:44 -#: Client/core/ServerBrowser/CServerInfo.cpp:53 -msgid "Name:" +#: Client/loader/MainFunctions.cpp:344 +#, c-format +msgid "File could not be deleted: '%s'" msgstr "" -#. Server IP -#: Client/core/ServerBrowser/CServerInfo.cpp:44 -#: Client/core/ServerBrowser/CServerInfo.cpp:64 -msgid "Server Address:" +#. No settings to delete, or can't find them +#: Client/loader/MainFunctions.cpp:352 +msgid "" +"Are you having problems running MTA:SA?.\n" +"\n" +"Do you want to see some online help?" msgstr "" -#. Gamemode -#: Client/core/ServerBrowser/CServerInfo.cpp:44 -#: Client/core/ServerBrowser/CServerInfo.cpp:75 -msgid "Gamemode:" +#. Inform user +#: Client/loader/MainFunctions.cpp:388 +msgid "" +"Are you having problems running MTA:SA?.\n" +"\n" +"Do you want to change the following setting?" msgstr "" -#. Map -#: Client/core/ServerBrowser/CServerInfo.cpp:44 -#: Client/core/ServerBrowser/CServerInfo.cpp:86 -msgid "Map:" +#: Client/loader/MainFunctions.cpp:431 +msgid "" +"Are you having problems running MTA:SA?.\n" +"\n" +"Try disabling the following products for GTA and MTA:" msgstr "" -#. Players -#: Client/core/ServerBrowser/CServerInfo.cpp:45 -#: Client/core/ServerBrowser/CServerInfo.cpp:97 -msgid "Players:" +#: Client/loader/MainFunctions.cpp:465 +msgid "" +"WARNING\n" +"\n" +"MTA:SA has detected unusual activity.\n" +"Please run a virus scan to ensure your system is secure.\n" +"\n" msgstr "" -#. Passworded -#: Client/core/ServerBrowser/CServerInfo.cpp:45 -#: Client/core/ServerBrowser/CServerInfo.cpp:108 -msgid "Passworded:" +#: Client/loader/MainFunctions.cpp:468 +#, c-format +msgid "The detected file was: %s\n" msgstr "" -#. Latency -#: Client/core/ServerBrowser/CServerInfo.cpp:45 -#: Client/core/ServerBrowser/CServerInfo.cpp:119 -msgid "Latency:" +#: Client/loader/MainFunctions.cpp:602 +msgid "" +"An instance of GTA: San Andreas is already running. It needs to be " +"terminated before MTA:SA can be started. Do you want to do that now?" msgstr "" -#. Column for player names -#. Player List Columns -#: Client/core/ServerBrowser/CServerInfo.cpp:138 -#: Client/core/ServerBrowser/CServerBrowser.cpp:478 -msgid "Player list" +#: Client/loader/MainFunctions.cpp:609 +msgid "" +"Unable to terminate GTA: San Andreas. If the problem persists, please " +"restart your computer." msgstr "" -#. Close button -#: Client/core/ServerBrowser/CServerInfo.cpp:144 -msgid "Close" +#: Client/loader/MainFunctions.cpp:632 +msgid "" +"Registry entries are missing. Please reinstall Multi Theft Auto: San Andreas." msgstr "" -#. Join Game button -#: Client/core/ServerBrowser/CServerInfo.cpp:152 -msgid "Join Game" +#: Client/loader/MainFunctions.cpp:638 +msgid "" +"The path to your installation of GTA: San Andreas contains unsupported " +"(unicode) characters. Please move your Grand Theft Auto: San Andreas " +"installation to a compatible path that contains only standard ASCII " +"characters and reinstall Multi Theft Auto: San Andreas." msgstr "" -#. Please enter password label -#: Client/core/ServerBrowser/CServerInfo.cpp:166 -msgid "Please enter the password to the server:" +#: Client/loader/MainFunctions.cpp:648 +msgid "" +"The path to your installation of 'MTA:SA' or 'GTA: San Andreas'\n" +"contains a ';' (semicolon).\n" +"\n" +" If you experience problems when running MTA:SA,\n" +" move your installation(s) to a path that does not contain a semicolon." msgstr "" -#: Client/core/ServerBrowser/CServerInfo.cpp:177 -msgid "Join the server as soon as a player slot is available." +#: Client/loader/MainFunctions.cpp:810 +msgid "" +"Load failed. Please ensure that the latest data files have been installed " +"correctly." msgstr "" -#: Client/core/ServerBrowser/CServerInfo.cpp:310 -msgid "PLEASE ENTER SERVER PASSWORD" +#: Client/loader/MainFunctions.cpp:819 +#, c-format +msgid "Load failed. Please ensure that %s is installed correctly." msgstr "" -#. The server has timed out -#: Client/core/ServerBrowser/CServerInfo.cpp:402 -msgid "Timed Out" +#: Client/loader/MainFunctions.cpp:826 +#, c-format +msgid "Load failed. Could not find gta_sa.exe in %s." msgstr "" -#. Set every GUI elements text to blank -#: Client/core/ServerBrowser/CServerInfo.cpp:431 -msgid "Querying..." +#: Client/loader/MainFunctions.cpp:836 +#, c-format +msgid "" +"Load failed. %s exists in the GTA directory. Please delete before continuing." msgstr "" -#. Create the window -#: Client/core/ServerBrowser/CServerBrowser.cpp:85 -msgid "SERVER BROWSER" +#: Client/loader/MainFunctions.cpp:845 +#, c-format +msgid "Main file has an incorrect name (%s)" msgstr "" -#: Client/core/ServerBrowser/CServerBrowser.cpp:134 -msgid "Local" +#: Client/loader/MainFunctions.cpp:856 +msgid "" +"Main file is unsigned. Possible virus activity.\n" +"\n" +"See online help if MTA does not work correctly." msgstr "" -#: Client/core/ServerBrowser/CServerBrowser.cpp:135 -msgid "Favourites" +#: Client/loader/MainFunctions.cpp:882 +#, c-format +msgid "" +"Data file %s is missing. Possible virus activity.\n" +"\n" +"Consider reinstalling Multi Theft Auto for your security.\n" +"See online help if MTA does not work correctly." msgstr "" -#: Client/core/ServerBrowser/CServerBrowser.cpp:136 -msgid "Recent" +#: Client/loader/MainFunctions.cpp:893 +#, c-format +msgid "" +"Data file %s is modified. Possible virus activity.\n" +"\n" +"Consider reinstalling Multi Theft Auto for your security.\n" +"See online help if MTA does not work correctly." msgstr "" -#: Client/core/ServerBrowser/CServerBrowser.cpp:191 +#: Client/loader/MainFunctions.cpp:907 msgid "" -"FOR QUICK CONNECT:\n" +".asi files are in the 'MTA:SA' or 'GTA: San Andreas' installation " +"directory.\n" "\n" -"Type the address and port into the address bar.\n" -"Or select a server from the history list and press 'Connect'" +"Remove these .asi files if you experience problems with MTA:SA." msgstr "" -#: Client/core/ServerBrowser/CServerBrowser.cpp:203 -msgid "HELP" +#: Client/loader/MainFunctions.cpp:1009 +msgid "" +"File version mismatch error. Reinstall MTA:SA if you experience problems.\n" msgstr "" -#: Client/core/ServerBrowser/CServerBrowser.cpp:212 -#: Client/core/ServerBrowser/CServerBrowser.cpp:252 -msgid "Refresh" +#: Client/loader/MainFunctions.cpp:1018 +msgid "Some files are missing. Reinstall MTA:SA if you experience problems.\n" msgstr "" -#: Client/core/ServerBrowser/CServerBrowser.cpp:212 -#: Client/core/ServerBrowser/CServerBrowser.cpp:253 -msgid "Add Favorite" +#: Client/loader/MainFunctions.cpp:1030 +msgid "" +"MTA:SA is not compatible with Windows 'Safe Mode'.\n" +"\n" +"Please restart your PC.\n" msgstr "" -#: Client/core/ServerBrowser/CServerBrowser.cpp:212 -#: Client/core/ServerBrowser/CServerBrowser.cpp:254 -#: Client/core/ServerBrowser/CServerBrowser.cpp:301 -#: Client/core/ServerBrowser/CServerBrowser.cpp:372 -msgid "Connect" +#: Client/loader/MainFunctions.cpp:1123 +msgid "Fix configuration issue" msgstr "" -#: Client/core/ServerBrowser/CServerBrowser.cpp:212 -#: Client/core/ServerBrowser/CServerBrowser.cpp:255 -msgid "Server information" +#. Try to relaunch as admin if not done so already +#: Client/loader/MainFunctions.cpp:1157 +msgid "Fix elevation required error" msgstr "" -#: Client/core/ServerBrowser/CServerBrowser.cpp:213 -#: Client/core/ServerBrowser/CServerBrowser.cpp:256 -msgid "Search servers" +#: Client/loader/MainFunctions.cpp:1164 +#, c-format +msgid "" +"Could not start Grand Theft Auto: San Andreas. Please try restarting, or if " +"the problem persists,contact MTA at www.multitheftauto.com. \n" +"\n" +"[%s]" msgstr "" -#: Client/core/ServerBrowser/CServerBrowser.cpp:213 -#: Client/core/ServerBrowser/CServerBrowser.cpp:257 -msgid "Search players" +#: Client/loader/MainFunctions.cpp:1219 +msgid "" +"GTA: San Andreas may not have launched correctly. Do you want to terminate " +"it?" msgstr "" -#: Client/core/ServerBrowser/CServerBrowser.cpp:213 -#: Client/core/ServerBrowser/CServerBrowser.cpp:258 -msgid "Start search" +#: Client/loader/CInstallManager.cpp:376 +#, c-format +msgid "" +"MTA:SA could not complete the following task:\n" +"\n" +" '%s'\n" msgstr "" -#: Client/core/ServerBrowser/CServerBrowser.cpp:299 -#: Client/core/ServerBrowser/CServerBrowser.cpp:1697 -msgid "Search players..." +#: Client/loader/CInstallManager.cpp:426 +msgid "" +"** The crash was caused by a graphics driver error **\n" +"\n" +"** Please update your graphics drivers **" msgstr "" -#: Client/core/ServerBrowser/CServerBrowser.cpp:422 -#: Client/core/ServerBrowser/CServerBrowser.cpp:1695 -msgid "Search servers..." +#: Client/loader/CInstallManager.cpp:532 +msgid "Install updated MTA:SA files" msgstr "" -#: Client/core/ServerBrowser/CServerBrowser.cpp:453 -msgid "Name" +#: Client/loader/CInstallManager.cpp:552 +msgid "" +"Could not update due to file conflicts. Please close other applications and " +"retry" msgstr "" -#: Client/core/ServerBrowser/CServerBrowser.cpp:454 -msgid "Players" +#: Client/loader/CInstallManager.cpp:561 +#, c-format +msgid "Multi Theft Auto has not been installed properly, please reinstall. %s" msgstr "" -#: Client/core/ServerBrowser/CServerBrowser.cpp:455 -msgid "Ping" +#: Client/loader/CInstallManager.cpp:613 +msgid "Create GTA:SA junctions" msgstr "" -#: Client/core/ServerBrowser/CServerBrowser.cpp:456 -msgid "Gamemode" +#: Client/loader/CInstallManager.cpp:657 +msgid "MTA:SA cannot launch because copying a file failed:" msgstr "" -#. Include label -#: Client/core/ServerBrowser/CServerBrowser.cpp:486 -msgid "Include:" +#: Client/loader/CInstallManager.cpp:663 Client/loader/CInstallManager.cpp:703 +msgid "MTA:SA cannot launch because an MTA:SA file is incorrect or missing:" msgstr "" -#: Client/core/ServerBrowser/CServerBrowser.cpp:492 -msgid "Empty" +#: Client/loader/CInstallManager.cpp:672 +msgid "Copy MTA:SA files" msgstr "" -#: Client/core/ServerBrowser/CServerBrowser.cpp:498 -msgid "Full" +#: Client/loader/CInstallManager.cpp:695 Client/loader/CInstallManager.cpp:773 +msgid "MTA:SA cannot launch because a GTA:SA file is incorrect or missing:" msgstr "" -#: Client/core/ServerBrowser/CServerBrowser.cpp:504 -msgid "Locked" +#: Client/loader/CInstallManager.cpp:780 +msgid "Patch GTA:SA dependency" msgstr "" -#: Client/core/ServerBrowser/CServerBrowser.cpp:516 -msgid "Offline" +#: Client/loader/CInstallManager.cpp:828 +msgid "" +"MTA:SA cannot launch because the GTA:SA executable is incorrect or missing:" msgstr "" -#: Client/core/ServerBrowser/CServerBrowser.cpp:529 -msgid "Other Versions" +#: Client/loader/CInstallManager.cpp:832 +msgid "" +"Please check your anti-virus for a false-positive detection, try to add an " +"exception for the GTA:SA executable and restart MTA:SA." msgstr "" -#: Client/core/ServerBrowser/CServerBrowser.cpp:550 -msgid "Back" +#: Client/loader/CInstallManager.cpp:838 +msgid "Generate GTA:SA" msgstr "" -#: Client/core/ServerBrowser/CServerBrowser.cpp:741 -msgid "Loading..." +#: Client/loader/CInstallManager.cpp:853 +msgid "MTA:SA cannot launch because the GTA:SA executable is not loadable:" msgstr "" -#: Client/core/ServerBrowser/CServerBrowser.cpp:1240 -#: Client/core/ServerBrowser/CServerBrowser.cpp:2182 -msgid " ..loading.." +#: Client/loader/CInstallManager.cpp:860 Client/loader/CInstallManager.cpp:883 +msgid "Patch GTA:SA" msgstr "" -#: Client/core/ServerBrowser/CServerBrowser.cpp:1278 -#: Client/core/ServerBrowser/CServerBrowser.cpp:1406 -msgid "No address specified!" +#: Client/loader/CInstallManager.cpp:876 +msgid "MTA:SA cannot launch because patching GTA:SA has failed:" msgstr "" -#: Client/core/ServerBrowser/CServerBrowser.cpp:1291 -msgid "Unknown protocol" +#: Client/loader/CInstallManager.cpp:1113 +msgid "Missing file:" msgstr "" -#: Client/core/ServerBrowser/CServerBrowser.cpp:1291 -msgid "Please use the mtasa:// protocol!" +#: Client/loader/CInstallManager.cpp:1117 +msgid "If MTA fails to load, please re-install GTA:SA" msgstr "" -#: Client/core/ServerBrowser/CServerBrowser.cpp:1380 -msgid "You have to select a server to connect to." +#: Client/loader/CInstallManager.cpp:1152 +msgid "Update install settings" msgstr "" -#: Client/core/ServerBrowser/CServerList.cpp:25 -msgid "Idle" +#: Client/loader/CInstallManager.cpp:1291 +msgid "Update compatibility settings" msgstr "" -#: Client/core/ServerBrowser/CServerList.cpp:150 -msgid "player" -msgid_plural "players" -msgstr[0] "" -msgstr[1] "" - -#: Client/core/ServerBrowser/CServerList.cpp:151 -msgid "on" +#: Client/loader/Install.cpp:265 +msgid "Unknown" msgstr "" -#: Client/core/ServerBrowser/CServerList.cpp:154 -msgid "server" -msgid_plural "servers" -msgstr[0] "" -msgstr[1] "" +#: Client/loader/Install.cpp:272 +#, c-format +msgid "" +"The file '%s' is currently locked by %zu processes.\n" +"\n" +"Do you want to terminate the following processes and continue updating?\n" +"\n" +"%s" +msgstr "" -#. We are polling for the master server list (first pass) -#: Client/core/ServerBrowser/CServerList.cpp:238 +#: Client/loader/Install.cpp:479 #, c-format -msgid "Requesting master server list (%lu ms elapsed)" +msgid "" +"Your installation may be corrupt now.\n" +"\n" +"%zu out of %zu files could not be restored from the backup.\n" +"\n" +"You should reinstall Multi Theft Auto from www.multitheftauto.com\n" +"or try running the update with administrator rights." msgstr "" -#. Abort -#: Client/core/ServerBrowser/CServerList.cpp:254 -msgid "Master server list could not be parsed." +#. Couldn't create render target for CPostEffects +#: Client/multiplayer_sa/CMultiplayerSA_CrashFixHacks.cpp:1360 +msgid "Problem with graphics driver" msgstr "" -#. Abort -#: Client/core/ServerBrowser/CServerList.cpp:264 -msgid "Master server list could not be retrieved." +#: Client/cefweb/CWebsiteRequests.cpp:19 +msgid "Website requests" msgstr "" -#: Client/core/ServerBrowser/CServerList.cpp:274 -msgid "(Backup server list)" +#: Client/cefweb/CWebsiteRequests.cpp:27 +msgid "" +"The server requests the following websites in order to load them (later):" msgstr "" -#: Client/core/ServerBrowser/CServerList.cpp:326 -msgid "Cannot bind LAN-broadcast socket" +#: Client/cefweb/CWebsiteRequests.cpp:33 +msgid "NEVER ENTER SENSITIVE DATA TO PROTECT THEM FROM BEING STOLEN" msgstr "" -#: Client/core/ServerBrowser/CServerList.cpp:345 -msgid "Attempting to discover LAN servers" +#: Client/cefweb/CWebsiteRequests.cpp:46 +msgid "Remember decision" +msgstr "" + +#: Client/cefweb/CWebsiteRequests.cpp:57 +msgid "Deny" msgstr "" #. Populate the message and show the box diff --git a/Shared/mods/deathmatch/logic/Utils.cpp b/Shared/mods/deathmatch/logic/Utils.cpp index 04076419c0..8ba51be070 100644 --- a/Shared/mods/deathmatch/logic/Utils.cpp +++ b/Shared/mods/deathmatch/logic/Utils.cpp @@ -435,65 +435,6 @@ SString GetDataUnit(unsigned long long ullInput) return strUnknown; } -#ifdef MTA_DEBUG -struct ReleaseVirtualMemory -{ - HANDLE process; - - ReleaseVirtualMemory(HANDLE process_) : process(process_) {} - - void operator()(void* p) const noexcept - { - if (p) - VirtualFreeEx(process, p, 0, MEM_RELEASE); - } -}; - -using VirtualMemoryScope = std::unique_ptr; - -bool RemoteLoadLibrary(HANDLE hProcess, const char* szLibPath) -{ - if (!szLibPath || !szLibPath[0]) - return false; - - HMODULE kernel32 = GetModuleHandleA("kernel32"); - - if (!kernel32) - return false; - - // Allocate memory in the remote process for the library path - size_t libraryPathSize = strlen(szLibPath) + 1; - void* remoteLibraryPath = VirtualAllocEx(hProcess, nullptr, libraryPathSize, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); - - if (!remoteLibraryPath) - return false; - - VirtualMemoryScope remoteMemory(remoteLibraryPath, ReleaseVirtualMemory{hProcess}); - - // Write the DLL library path to the remote allocation - DWORD byteswritten = 0; - WriteProcessMemory(hProcess, remoteLibraryPath, static_cast(szLibPath), libraryPathSize, &byteswritten); - - if (byteswritten != libraryPathSize) - return false; - - // Start a remote thread executing LoadLibraryA exported from Kernel32. Passing the - // remotely allocated path buffer as an argument to that thread (and also to LoadLibraryA) - // will make the remote process load the DLL into it's userspace (giving the DLL full - // access to the game executable). - HANDLE remoteThread = CreateRemoteThread( - hProcess, nullptr, 0, static_cast(static_cast(GetProcAddress(kernel32, "LoadLibraryA"))), remoteLibraryPath, 0, nullptr); - - if (!remoteThread) - return false; - - // We wait for the created remote thread to finish executing. When it's done, the DLL - // is loaded into the game's userspace, and we can destroy the thread-handle. - WaitForSingleObject(remoteThread, INFINITE); - return true; -} - -#endif #else bool IsValidFilePath(const char* szDir) { diff --git a/Shared/mods/deathmatch/logic/Utils.h b/Shared/mods/deathmatch/logic/Utils.h index 33cd9d072a..86f30480ef 100644 --- a/Shared/mods/deathmatch/logic/Utils.h +++ b/Shared/mods/deathmatch/logic/Utils.h @@ -350,8 +350,3 @@ void DeletePointersAndClearList(T& elementList) delete *iter; } } - -// for debug -#if defined(MTA_DEBUG) && defined(MTA_CLIENT) -bool RemoteLoadLibrary(HANDLE hProcess, const char* szLibPath); -#endif diff --git a/Shared/mods/deathmatch/logic/lua/CLuaFunctionParser.h b/Shared/mods/deathmatch/logic/lua/CLuaFunctionParser.h index 686a855deb..8861ef6ef3 100644 --- a/Shared/mods/deathmatch/logic/lua/CLuaFunctionParser.h +++ b/Shared/mods/deathmatch/logic/lua/CLuaFunctionParser.h @@ -727,7 +727,7 @@ struct CLuaFunctionParser : CLuaFunctionP { iResult = Call(L); } - catch (std::invalid_argument& e) + catch (std::logic_error& e) { // This exception can be thrown from the called function // as an additional way to provide further argument errors diff --git a/premake5.lua b/premake5.lua index 76b9e95e72..34dc2e37f4 100644 --- a/premake5.lua +++ b/premake5.lua @@ -158,7 +158,7 @@ workspace "MTASA" include "vendor/cef3" include "vendor/discord-rpc" include "vendor/freetype" - include "vendor/jpeg-9e" + include "vendor/jpeg-9f" include "vendor/ksignals" include "vendor/libpng" include "vendor/tinygettext" diff --git a/utils/buildactions/install_cef.lua b/utils/buildactions/install_cef.lua index 288fe10362..906de66a89 100644 --- a/utils/buildactions/install_cef.lua +++ b/utils/buildactions/install_cef.lua @@ -9,8 +9,8 @@ local CEF_URL_PREFIX = "https://cef-builds.spotifycdn.com/cef_binary_" local CEF_URL_SUFFIX = "_windows32_minimal.tar.bz2" -- Change here to update CEF version -local CEF_VERSION = "126.2.0+g5c56e98+chromium-126.0.6478.62" -local CEF_HASH = "c32e4fc19ad8ffae54eba08c8d57148b6d25487a8ab0c37db5fd20ccf19fd34d" +local CEF_VERSION = "126.2.6+gc7c4ac9+chromium-126.0.6478.115" +local CEF_HASH = "e8392f2abc7d392a104fcb10bbd35ca7ddc1353ce5957c92bddcef3acd91f09c" function make_cef_download_url() return CEF_URL_PREFIX..http.escapeUrlParam(CEF_VERSION)..CEF_URL_SUFFIX diff --git a/utils/localization/generate-images/package-lock.json b/utils/localization/generate-images/package-lock.json index 26fac5a614..2dadb06346 100644 --- a/utils/localization/generate-images/package-lock.json +++ b/utils/localization/generate-images/package-lock.json @@ -964,9 +964,9 @@ "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" }, "node_modules/ws": { - "version": "8.13.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", - "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz", + "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==", "engines": { "node": ">=10.0.0" }, diff --git a/vendor/cryptopp/aria_simd.cpp b/vendor/cryptopp/aria_simd.cpp deleted file mode 100644 index 3a390edf07..0000000000 --- a/vendor/cryptopp/aria_simd.cpp +++ /dev/null @@ -1,194 +0,0 @@ -// aria_simd.cpp - written and placed in the public domain by -// Jeffrey Walton, Uri Blumenthal and Marcel Raad. -// -// This source file uses intrinsics to gain access to ARMv7a and -// ARMv8a NEON instructions. A separate source file is needed -// because additional CXXFLAGS are required to enable the -// appropriate instructions sets in some build configurations. - -#include "pch.h" -#include "config.h" -#include "misc.h" - -#if (CRYPTOPP_SSSE3_AVAILABLE) -# include -#endif - -#if (CRYPTOPP_ARM_NEON_HEADER) -# include -#endif - -#if (CRYPTOPP_ARM_ACLE_HEADER) -# include -# include -#endif - -// Squash MS LNK4221 and libtool warnings -extern const char ARIA_SIMD_FNAME[] = __FILE__; - -NAMESPACE_BEGIN(CryptoPP) -NAMESPACE_BEGIN(ARIATab) - -extern const word32 S1[256]; -extern const word32 S2[256]; -extern const word32 X1[256]; -extern const word32 X2[256]; -extern const word32 KRK[3][4]; - -NAMESPACE_END -NAMESPACE_END - -ANONYMOUS_NAMESPACE_BEGIN - -using CryptoPP::byte; -using CryptoPP::word32; - -inline byte ARIA_BRF(const word32 x, const int y) { - return static_cast(GETBYTE(x, y)); -} - -ANONYMOUS_NAMESPACE_END - -NAMESPACE_BEGIN(CryptoPP) - -using CryptoPP::ARIATab::S1; -using CryptoPP::ARIATab::S2; -using CryptoPP::ARIATab::X1; -using CryptoPP::ARIATab::X2; -using CryptoPP::ARIATab::KRK; - -#if (CRYPTOPP_ARM_NEON_AVAILABLE) - -template -inline void ARIA_GSRK_NEON(const uint32x4_t X, const uint32x4_t Y, byte RK[16]) -{ - enum { Q1 = (4-(N/32)) % 4, - Q2 = (3-(N/32)) % 4, - R = N % 32 - }; - - vst1q_u8(RK, vreinterpretq_u8_u32( - veorq_u32(X, veorq_u32( - vshrq_n_u32(vextq_u32(Y, Y, Q1), R), - vshlq_n_u32(vextq_u32(Y, Y, Q2), 32-R))))); -} - -void ARIA_UncheckedSetKey_Schedule_NEON(byte* rk, word32* ws, unsigned int keylen) -{ - const uint32x4_t w0 = vld1q_u32(ws+ 0); - const uint32x4_t w1 = vld1q_u32(ws+ 8); - const uint32x4_t w2 = vld1q_u32(ws+12); - const uint32x4_t w3 = vld1q_u32(ws+16); - - ARIA_GSRK_NEON<19>(w0, w1, rk + 0); - ARIA_GSRK_NEON<19>(w1, w2, rk + 16); - ARIA_GSRK_NEON<19>(w2, w3, rk + 32); - ARIA_GSRK_NEON<19>(w3, w0, rk + 48); - ARIA_GSRK_NEON<31>(w0, w1, rk + 64); - ARIA_GSRK_NEON<31>(w1, w2, rk + 80); - ARIA_GSRK_NEON<31>(w2, w3, rk + 96); - ARIA_GSRK_NEON<31>(w3, w0, rk + 112); - ARIA_GSRK_NEON<67>(w0, w1, rk + 128); - ARIA_GSRK_NEON<67>(w1, w2, rk + 144); - ARIA_GSRK_NEON<67>(w2, w3, rk + 160); - ARIA_GSRK_NEON<67>(w3, w0, rk + 176); - ARIA_GSRK_NEON<97>(w0, w1, rk + 192); - - if (keylen > 16) - { - ARIA_GSRK_NEON<97>(w1, w2, rk + 208); - ARIA_GSRK_NEON<97>(w2, w3, rk + 224); - - if (keylen > 24) - { - ARIA_GSRK_NEON< 97>(w3, w0, rk + 240); - ARIA_GSRK_NEON<109>(w0, w1, rk + 256); - } - } -} - -void ARIA_ProcessAndXorBlock_NEON(const byte* xorBlock, byte* outBlock, const byte *rk, word32 *t) -{ - outBlock[ 0] = (byte)(X1[ARIA_BRF(t[0],3)] ); - outBlock[ 1] = (byte)(X2[ARIA_BRF(t[0],2)]>>8); - outBlock[ 2] = (byte)(S1[ARIA_BRF(t[0],1)] ); - outBlock[ 3] = (byte)(S2[ARIA_BRF(t[0],0)] ); - outBlock[ 4] = (byte)(X1[ARIA_BRF(t[1],3)] ); - outBlock[ 5] = (byte)(X2[ARIA_BRF(t[1],2)]>>8); - outBlock[ 6] = (byte)(S1[ARIA_BRF(t[1],1)] ); - outBlock[ 7] = (byte)(S2[ARIA_BRF(t[1],0)] ); - outBlock[ 8] = (byte)(X1[ARIA_BRF(t[2],3)] ); - outBlock[ 9] = (byte)(X2[ARIA_BRF(t[2],2)]>>8); - outBlock[10] = (byte)(S1[ARIA_BRF(t[2],1)] ); - outBlock[11] = (byte)(S2[ARIA_BRF(t[2],0)] ); - outBlock[12] = (byte)(X1[ARIA_BRF(t[3],3)] ); - outBlock[13] = (byte)(X2[ARIA_BRF(t[3],2)]>>8); - outBlock[14] = (byte)(S1[ARIA_BRF(t[3],1)] ); - outBlock[15] = (byte)(S2[ARIA_BRF(t[3],0)] ); - - // 'outBlock' and 'xorBlock' may be unaligned. - if (xorBlock != NULLPTR) - { - vst1q_u8(outBlock, - veorq_u8( - vld1q_u8(xorBlock), - veorq_u8( - vld1q_u8(outBlock), - vrev32q_u8(vld1q_u8((rk)))))); - } - else - { - vst1q_u8(outBlock, - veorq_u8( - vld1q_u8(outBlock), - vrev32q_u8(vld1q_u8(rk)))); - } -} - -#endif // CRYPTOPP_ARM_NEON_AVAILABLE - -#if (CRYPTOPP_SSSE3_AVAILABLE) - -void ARIA_ProcessAndXorBlock_SSSE3(const byte* xorBlock, byte* outBlock, const byte *rk, word32 *t) -{ - const __m128i MASK = _mm_set_epi8(12,13,14,15, 8,9,10,11, 4,5,6,7, 0,1,2,3); - - outBlock[ 0] = (byte)(X1[ARIA_BRF(t[0],3)] ); - outBlock[ 1] = (byte)(X2[ARIA_BRF(t[0],2)]>>8); - outBlock[ 2] = (byte)(S1[ARIA_BRF(t[0],1)] ); - outBlock[ 3] = (byte)(S2[ARIA_BRF(t[0],0)] ); - outBlock[ 4] = (byte)(X1[ARIA_BRF(t[1],3)] ); - outBlock[ 5] = (byte)(X2[ARIA_BRF(t[1],2)]>>8); - outBlock[ 6] = (byte)(S1[ARIA_BRF(t[1],1)] ); - outBlock[ 7] = (byte)(S2[ARIA_BRF(t[1],0)] ); - outBlock[ 8] = (byte)(X1[ARIA_BRF(t[2],3)] ); - outBlock[ 9] = (byte)(X2[ARIA_BRF(t[2],2)]>>8); - outBlock[10] = (byte)(S1[ARIA_BRF(t[2],1)] ); - outBlock[11] = (byte)(S2[ARIA_BRF(t[2],0)] ); - outBlock[12] = (byte)(X1[ARIA_BRF(t[3],3)] ); - outBlock[13] = (byte)(X2[ARIA_BRF(t[3],2)]>>8); - outBlock[14] = (byte)(S1[ARIA_BRF(t[3],1)] ); - outBlock[15] = (byte)(S2[ARIA_BRF(t[3],0)] ); - - // 'outBlock' and 'xorBlock' may be unaligned. - if (xorBlock != NULLPTR) - { - _mm_storeu_si128(M128_CAST(outBlock), - _mm_xor_si128( - _mm_loadu_si128(CONST_M128_CAST(xorBlock)), - _mm_xor_si128( - _mm_loadu_si128(CONST_M128_CAST(outBlock)), - _mm_shuffle_epi8(_mm_load_si128(CONST_M128_CAST(rk)), MASK))) - ); - } - else - { - _mm_storeu_si128(M128_CAST(outBlock), - _mm_xor_si128(_mm_loadu_si128(CONST_M128_CAST(outBlock)), - _mm_shuffle_epi8(_mm_load_si128(CONST_M128_CAST(rk)), MASK))); - } -} - -#endif // CRYPTOPP_SSSE3_AVAILABLE - -NAMESPACE_END diff --git a/vendor/cryptopp/asn.h b/vendor/cryptopp/asn.h index cf44fc7278..beb20cd0f5 100644 --- a/vendor/cryptopp/asn.h +++ b/vendor/cryptopp/asn.h @@ -331,7 +331,8 @@ class CRYPTOPP_DLL OID protected: friend bool operator==(const OID &lhs, const OID &rhs); friend bool operator!=(const OID &lhs, const OID &rhs); - friend bool operator<(const OID &lhs, const OID &rhs); + friend bool operator< (const OID &lhs, const OID &rhs); + friend bool operator> (const OID &lhs, const OID &rhs); friend bool operator<=(const OID &lhs, const OID &rhs); friend bool operator>=(const OID &lhs, const OID &rhs); @@ -913,11 +914,18 @@ inline bool operator!=(const OID &lhs, const OID &rhs); /// \param lhs the first OID /// \param rhs the second OID /// \return true if the first OID is less than the second OID, false otherwise -/// \details operator<() calls std::lexicographical_compare() on each element in the array of values. +/// \details operator<() calls std::lexicographical_compare() on the values. inline bool operator<(const OID &lhs, const OID &rhs); /// \brief Compare two OIDs for ordering /// \param lhs the first OID /// \param rhs the second OID +/// \return true if the first OID is greater than the second OID, false otherwise +/// \details operator>() is implemented in terms of operator==() and operator<(). +/// \since Crypto++ 8.3 +inline bool operator>(const OID &lhs, const OID &rhs); +/// \brief Compare two OIDs for ordering +/// \param lhs the first OID +/// \param rhs the second OID /// \return true if the first OID is less than or equal to the second OID, false otherwise /// \details operator<=() is implemented in terms of operator==() and operator<(). /// \since Crypto++ 8.3 @@ -936,8 +944,7 @@ inline OID operator+(const OID &lhs, unsigned long rhs); /// \brief Print a OID value /// \param out the output stream /// \param oid the OID -inline std::ostream& operator<<(std::ostream& out, const OID &oid) - { return oid.Print(out); } +inline std::ostream& operator<<(std::ostream& out, const OID &oid); #else inline bool operator==(const ::CryptoPP::OID &lhs, const ::CryptoPP::OID &rhs) {return lhs.m_values == rhs.m_values;} @@ -945,6 +952,8 @@ inline bool operator!=(const ::CryptoPP::OID &lhs, const ::CryptoPP::OID &rhs) {return lhs.m_values != rhs.m_values;} inline bool operator<(const ::CryptoPP::OID &lhs, const ::CryptoPP::OID &rhs) {return std::lexicographical_compare(lhs.m_values.begin(), lhs.m_values.end(), rhs.m_values.begin(), rhs.m_values.end());} +inline bool operator>(const ::CryptoPP::OID &lhs, const ::CryptoPP::OID &rhs) + {return ! (lhs=(const ::CryptoPP::OID &lhs, const ::CryptoPP::OID &rhs) diff --git a/vendor/cryptopp/config_asm.h b/vendor/cryptopp/config_asm.h index d5629c7714..edfbdefb80 100644 --- a/vendor/cryptopp/config_asm.h +++ b/vendor/cryptopp/config_asm.h @@ -27,12 +27,12 @@ #include "config_cpu.h" #include "config_ver.h" -// Define this to disable ASM, intrinsics and built-ins. The library will be -// compiled using C++ only. The library code will not include SSE2 (and -// above), NEON, Aarch32, Aarch64, or Altivec (and above). Note the compiler -// may use higher ISAs depending on compiler options, but the library will not -// explicitly use the ISAs. When disabling ASM, it is best to do it from -// config.h to ensure the library and all programs share the setting. +// Define this to disable ASM, intrinsics and built-ins. The library code will +// not explicitly include SSE2 (and above), NEON, Aarch32, Aarch64, or Altivec +// (and above). Note the compiler may use higher ISAs depending on compiler +// options, but the library will not explicitly use the ISAs. When disabling ASM, +// it is best to do it from config_asm.h to ensure the library and all programs +// share the setting. // #define CRYPTOPP_DISABLE_ASM 1 // https://github.com/weidai11/cryptopp/issues/719 diff --git a/vendor/cryptopp/config_cpu.h b/vendor/cryptopp/config_cpu.h index 4020b1be54..15f694e793 100644 --- a/vendor/cryptopp/config_cpu.h +++ b/vendor/cryptopp/config_cpu.h @@ -203,7 +203,7 @@ /// _MSC_VER nor __BORLANDC__ are defined. #define CRYPTOPP_GNU_STYLE_INLINE_ASSEMBLY ... #elif defined(CRYPTOPP_MSC_VERSION) || defined(__BORLANDC__) || \ - (defined(CRYPTOPP_WIN32_AVAILABLE) && defined(CRYPTOPP_LLVM_CLANG_VERSION)) + defined(CRYPTOPP_MSVC_CLANG_VERSION) #define CRYPTOPP_MS_STYLE_INLINE_ASSEMBLY 1 #else #define CRYPTOPP_GNU_STYLE_INLINE_ASSEMBLY 1 diff --git a/vendor/cryptopp/config_ver.h b/vendor/cryptopp/config_ver.h index 4752692ac2..c7e457c2aa 100644 --- a/vendor/cryptopp/config_ver.h +++ b/vendor/cryptopp/config_ver.h @@ -58,6 +58,8 @@ // LLVM Clang version 3.7. Also see https://gist.github.com/yamaya/2924292 #if defined(__clang__) && defined(__apple_build_version__) # define CRYPTOPP_APPLE_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) +#elif defined(__clang__) && defined(_MSC_VER) +# define CRYPTOPP_MSVC_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) #elif defined(__clang__) # define CRYPTOPP_LLVM_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) #endif diff --git a/vendor/cryptopp/cpu.cpp b/vendor/cryptopp/cpu.cpp index 607726fcf3..f61fef39ba 100644 --- a/vendor/cryptopp/cpu.cpp +++ b/vendor/cryptopp/cpu.cpp @@ -388,9 +388,14 @@ extern bool CPU_ProbeSSE2(); // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85684. word64 XGetBV(word32 num) { +// Explicitly handle CRYPTOPP_DISABLE_ASM case. +// https://github.com/weidai11/cryptopp/issues/1240 +#if defined(CRYPTOPP_DISABLE_ASM) + return 0; + // Required by Visual Studio 2008 and below and Clang on Windows. // Use it for all MSVC-compatible compilers. -#if defined(_M_X64) && defined(CRYPTOPP_MS_STYLE_INLINE_ASSEMBLY) +#elif defined(_M_X64) && defined(CRYPTOPP_MS_STYLE_INLINE_ASSEMBLY) return XGETBV64(num); @@ -446,9 +451,15 @@ word64 XGetBV(word32 num) // cpu.cpp (131): E2211 Inline assembly not allowed in inline and template functions bool CpuId(word32 func, word32 subfunc, word32 output[4]) { +// Explicitly handle CRYPTOPP_DISABLE_ASM case. +// https://github.com/weidai11/cryptopp/issues/1240 +#if defined(CRYPTOPP_DISABLE_ASM) + output[0] = output[1] = output[2] = output[3] = 0; + return false; + // Required by Visual Studio 2008 and below and Clang on Windows. // Use it for all MSVC-compatible compilers. -#if defined(_M_X64) && defined(CRYPTOPP_MS_STYLE_INLINE_ASSEMBLY) +#elif defined(_M_X64) && defined(CRYPTOPP_MS_STYLE_INLINE_ASSEMBLY) CPUID64(func, subfunc, output); return true; diff --git a/vendor/cryptopp/cpuid64.asm b/vendor/cryptopp/cpuid64.asm new file mode 100644 index 0000000000..6951bbc88e --- /dev/null +++ b/vendor/cryptopp/cpuid64.asm @@ -0,0 +1,63 @@ +;; https://docs.microsoft.com/en-us/cpp/build/x64-calling-convention +;; The first four integer arguments are passed in registers. +;; Integer values are passed in left-to-right order in RCX, +;; RDX, R8, and R9, respectively. Arguments five and higher +;; are passed on the stack. + +;; The registers RAX, RCX, RDX, R8, R9, R10, R11, XMM0-5, +;; and the upper portions of YMM0-15 and ZMM0-15 are +;; considered volatile and must be considered destroyed on +;; function calls. + +.CODE + +TITLE CPU features source file +SUBTITLE Microsoft specific ASM code to utilize CPUID and XGETBV64 for down level Microsoft toolchains + +;; http://www.agner.org/optimize/vectorclass/read.php?i=65 +;; word64 Xgetbv(word32 ctrl) +;; ctrl = rcx + + ALIGN 8 +XGETBV64 PROC FRAME +.endprolog + ;; query + DB 0fh, 01h, 0d0h + ;; xcr = (EDX << 32) | EAX + and rax, 0ffffffffh + shl rdx, 32 + or rax, rdx + ret +XGETBV64 ENDP + +;; word64 CpuId(word32 func, word32 subfunc, word32 output[4]) +;; func = rcx +;; subfunc = rdx +;; output = r8 + + ALIGN 8 +CPUID64 PROC FRAME + ;; preserve per ABI + mov [rsp+8], rbx +.savereg rbx, 8 +.endprolog + ;; eax = func + mov rax, rcx + ;; ecx = subfunc + mov rcx, rdx + ;; query + cpuid + ;; save + mov [r8+0], eax + mov [r8+4], ebx + mov [r8+8], ecx + mov [r8+12], edx + ;; return value + mov rax, 1 + ;; restore + mov rbx, [rsp+8] + ret +CPUID64 ENDP + +_TEXT ENDS +END diff --git a/vendor/cryptopp/ecp.cpp b/vendor/cryptopp/ecp.cpp index f8ba60f637..2c70c48ed4 100644 --- a/vendor/cryptopp/ecp.cpp +++ b/vendor/cryptopp/ecp.cpp @@ -119,7 +119,11 @@ bool ECP::DecodePoint(ECP::Point &P, BufferedTransformation &bt, size_t encodedP if (encodedPointLen != EncodedPointSize(true)) return false; - Integer p = FieldSize(); + // Check for p is prime due to GH #1249 + const Integer p = FieldSize(); + CRYPTOPP_ASSERT(IsPrime(p)); + if (!IsPrime(p)) + return false; P.identity = false; P.x.Decode(bt, GetField().MaxElementByteLength()); @@ -128,6 +132,7 @@ bool ECP::DecodePoint(ECP::Point &P, BufferedTransformation &bt, size_t encodedP if (Jacobi(P.y, p) !=1) return false; + // Callers must ensure p is prime, GH #1249 P.y = ModularSquareRoot(P.y, p); if ((type & 1) != P.y.GetBit(0)) diff --git a/vendor/cryptopp/esign.cpp b/vendor/cryptopp/esign.cpp index 70dde2fbd2..932490c87b 100644 --- a/vendor/cryptopp/esign.cpp +++ b/vendor/cryptopp/esign.cpp @@ -111,6 +111,9 @@ void InvertibleESIGNFunction::GenerateRandom(RandomNumberGenerator &rng, const N if (param.GetValue("Seed", seedParam)) { + if (seedParam.size() > seed.ELEMS_MAX - 4) + throw InvalidArgument("InvertibleESIGNFunction::GenerateRandom: buffer overflow"); + seed.resize(seedParam.size() + 4); std::memcpy(seed + 4, seedParam.begin(), seedParam.size()); diff --git a/vendor/cryptopp/nbtheory.cpp b/vendor/cryptopp/nbtheory.cpp index da6f1b923f..67f63a64be 100644 --- a/vendor/cryptopp/nbtheory.cpp +++ b/vendor/cryptopp/nbtheory.cpp @@ -11,6 +11,7 @@ #include "smartptr.h" #include "misc.h" #include "stdcpp.h" +#include "trap.h" #ifdef _OPENMP # include @@ -524,6 +525,9 @@ Integer MaurerProvablePrime(RandomNumberGenerator &rng, unsigned int bits) Integer CRT(const Integer &xp, const Integer &p, const Integer &xq, const Integer &q, const Integer &u) { + // Callers must ensure p and q are prime, GH #1249 + CRYPTOPP_ASSERT(IsPrime(p) && IsPrime(q)); + // isn't operator overloading great? return p * (u * (xq-xp) % q) + xp; /* @@ -543,6 +547,9 @@ Integer CRT(const Integer &xp, const Integer &p, const Integer &xq, const Intege Integer ModularSquareRoot(const Integer &a, const Integer &p) { + // Callers must ensure p is prime, GH #1249 + CRYPTOPP_ASSERT(IsPrime(p)); + if (p%4 == 3) return a_exp_b_mod_c(a, (p+1)/4, p); @@ -592,6 +599,9 @@ Integer ModularSquareRoot(const Integer &a, const Integer &p) bool SolveModularQuadraticEquation(Integer &r1, Integer &r2, const Integer &a, const Integer &b, const Integer &c, const Integer &p) { + // Callers must ensure p is prime, GH #1249 + CRYPTOPP_ASSERT(IsPrime(p)); + Integer D = (b.Squared() - 4*a*c) % p; switch (Jacobi(D, p)) { @@ -618,6 +628,9 @@ bool SolveModularQuadraticEquation(Integer &r1, Integer &r2, const Integer &a, c Integer ModularRoot(const Integer &a, const Integer &dp, const Integer &dq, const Integer &p, const Integer &q, const Integer &u) { + // Callers must ensure p and q are prime, GH #1249 + CRYPTOPP_ASSERT(IsPrime(p) && IsPrime(q)); + // GCC warning bug, https://stackoverflow.com/q/12842306/608639 #ifdef _OPENMP Integer p2, q2; @@ -640,6 +653,9 @@ Integer ModularRoot(const Integer &a, const Integer &dp, const Integer &dq, Integer ModularRoot(const Integer &a, const Integer &e, const Integer &p, const Integer &q) { + // Callers must ensure p and q are prime, GH #1249 + CRYPTOPP_ASSERT(IsPrime(p) && IsPrime(q)); + Integer dp = EuclideanMultiplicativeInverse(e, p-1); Integer dq = EuclideanMultiplicativeInverse(e, q-1); Integer u = EuclideanMultiplicativeInverse(p, q); @@ -976,6 +992,8 @@ Integer Lucas(const Integer &n, const Integer &P, const Integer &modulus) Integer InverseLucas(const Integer &e, const Integer &m, const Integer &p, const Integer &q, const Integer &u) { + // Callers must ensure p and q are prime, GH #1249 + CRYPTOPP_ASSERT(IsPrime(p) && IsPrime(q)); // GCC warning bug, https://stackoverflow.com/q/12842306/608639 #ifdef _OPENMP diff --git a/vendor/cryptopp/nbtheory.h b/vendor/cryptopp/nbtheory.h index a494110d19..611e3d319a 100644 --- a/vendor/cryptopp/nbtheory.h +++ b/vendor/cryptopp/nbtheory.h @@ -112,7 +112,7 @@ CRYPTOPP_DLL bool CRYPTOPP_API IsPrime(const Integer &p); /// level is greater than 1, then 10 round RabinMillerTest() primality testing is performed. CRYPTOPP_DLL bool CRYPTOPP_API VerifyPrime(RandomNumberGenerator &rng, const Integer &p, unsigned int level = 1); -/// \brief Application callback to signal suitability of a cabdidate prime +/// \brief Application callback to signal suitability of a candidate prime class CRYPTOPP_DLL PrimeSelector { public: diff --git a/vendor/cryptopp/osrng.cpp b/vendor/cryptopp/osrng.cpp index 6c72dca170..d61d08f5f4 100644 --- a/vendor/cryptopp/osrng.cpp +++ b/vendor/cryptopp/osrng.cpp @@ -23,7 +23,7 @@ // FreeBSD links /dev/urandom -> /dev/random. It showed up when we added // O_NOFOLLOW to harden the non-blocking generator. Use Arc4Random instead -// for a non-blocking generator. Arc4Random is cryptograhic quality prng +// for a non-blocking generator. Arc4Random is cryptographic quality prng // based on ChaCha20. The ChaCha20 generator is seeded from /dev/random, // so we can't completely avoid the blocking. // https://www.freebsd.org/cgi/man.cgi?query=arc4random_buf. diff --git a/vendor/cryptopp/premake5.lua b/vendor/cryptopp/premake5.lua index 2a509e195d..ba09c3f6a8 100644 --- a/vendor/cryptopp/premake5.lua +++ b/vendor/cryptopp/premake5.lua @@ -28,7 +28,6 @@ project "cryptopp" "arc4.cpp", "aria.cpp", "ariatab.cpp", - "aria_simd.cpp", "asn.cpp", "authenc.cpp", "base32.cpp", @@ -214,7 +213,8 @@ project "cryptopp" filter "platforms:x64" files { "x64dll.asm", - "x64masm.asm" + "x64masm.asm", + "cpuid64.asm" } filter { "system:windows" } diff --git a/vendor/cryptopp/rabin.cpp b/vendor/cryptopp/rabin.cpp index b942dee8a0..672b5db06f 100644 --- a/vendor/cryptopp/rabin.cpp +++ b/vendor/cryptopp/rabin.cpp @@ -7,6 +7,7 @@ #include "modarith.h" #include "asn.h" #include "sha.h" +#include "trap.h" NAMESPACE_BEGIN(CryptoPP) @@ -130,6 +131,9 @@ void InvertibleRabinFunction::BERDecode(BufferedTransformation &bt) m_q.BERDecode(seq); m_u.BERDecode(seq); seq.MessageEnd(); + + CRYPTOPP_ASSERT(IsPrime(m_p)); + CRYPTOPP_ASSERT(IsPrime(m_q)); } void InvertibleRabinFunction::DEREncode(BufferedTransformation &bt) const @@ -146,6 +150,9 @@ void InvertibleRabinFunction::DEREncode(BufferedTransformation &bt) const Integer InvertibleRabinFunction::CalculateInverse(RandomNumberGenerator &rng, const Integer &in) const { + CRYPTOPP_ASSERT(IsPrime(m_p)); + CRYPTOPP_ASSERT(IsPrime(m_q)); + DoQuickSanityCheck(); ModularArithmetic modn(m_n); diff --git a/vendor/cryptopp/rdrand.h b/vendor/cryptopp/rdrand.h index d1f3c4129e..6849c8dde2 100644 --- a/vendor/cryptopp/rdrand.h +++ b/vendor/cryptopp/rdrand.h @@ -20,7 +20,7 @@ // GenerateBlock unconditionally retries and always fulfills the request. // Throughput varies wildly depending on processor and manufacturer. A Core i5 or -// Core i7 RDRAND can generate at over 200 MiB/s. It is below theroetical +// Core i7 RDRAND can generate at over 200 MiB/s. It is below theoretical // maximum, but it takes about 5 instructions to generate, retry and store a // result. A low-end Celeron may perform RDRAND at about 7 MiB/s. RDSEED // performs at about 1/4 to 1/2 the rate of RDRAND. AMD RDRAND performed poorly diff --git a/vendor/cryptopp/x64dll.asm b/vendor/cryptopp/x64dll.asm index 557afa02b9..440b3c9674 100644 --- a/vendor/cryptopp/x64dll.asm +++ b/vendor/cryptopp/x64dll.asm @@ -1975,50 +1975,5 @@ pop rsi ret SHA256_HashMultipleBlocks_SSE2 ENDP -;; http://www.agner.org/optimize/vectorclass/read.php?i=65 -;; word64 Xgetbv(word32 ctrl) -;; ctrl = rcx - - ALIGN 8 -XGETBV64 PROC FRAME -.endprolog - ;; query - DB 0fh, 01h, 0d0h - ;; xcr = (EDX << 32) | EAX - and rax, 0ffffffffh - shl rdx, 32 - or rax, rdx - ret -XGETBV64 ENDP - -;; word64 CpuId(word32 func, word32 subfunc, word32 output[4]) -;; func = rcx -;; subfunc = rdx -;; output = r8 - - ALIGN 8 -CPUID64 PROC FRAME - ;; preserve per ABI - mov [rsp+8], rbx -.savereg rbx, 8 -.endprolog - ;; eax = func - mov rax, rcx - ;; ecx = subfunc - mov rcx, rdx - ;; query - cpuid - ;; save - mov [r8+0], eax - mov [r8+4], ebx - mov [r8+8], ecx - mov [r8+12], edx - ;; return value - mov rax, 1 - ;; restore - mov rbx, [rsp+8] - ret -CPUID64 ENDP - _TEXT ENDS END diff --git a/vendor/jpeg-9e/cderror.h b/vendor/jpeg-9f/cderror.h similarity index 100% rename from vendor/jpeg-9e/cderror.h rename to vendor/jpeg-9f/cderror.h diff --git a/vendor/jpeg-9e/cdjpeg.c b/vendor/jpeg-9f/cdjpeg.c similarity index 100% rename from vendor/jpeg-9e/cdjpeg.c rename to vendor/jpeg-9f/cdjpeg.c diff --git a/vendor/jpeg-9e/cdjpeg.h b/vendor/jpeg-9f/cdjpeg.h similarity index 100% rename from vendor/jpeg-9e/cdjpeg.h rename to vendor/jpeg-9f/cdjpeg.h diff --git a/vendor/jpeg-9e/cjpeg.c b/vendor/jpeg-9f/cjpeg.c similarity index 100% rename from vendor/jpeg-9e/cjpeg.c rename to vendor/jpeg-9f/cjpeg.c diff --git a/vendor/jpeg-9f/cjpegalt.c b/vendor/jpeg-9f/cjpegalt.c new file mode 100644 index 0000000000..c89827e26b --- /dev/null +++ b/vendor/jpeg-9f/cjpegalt.c @@ -0,0 +1,791 @@ +/* + * alternate cjpeg.c + * + * Copyright (C) 1991-1998, Thomas G. Lane. + * Modified 2009-2023 by Guido Vollbeding. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains an alternate user interface for the JPEG compressor. + * One or more input files are named on the command line, and output file + * names are created by substituting ".jpg" for the input file's extension. + */ + +#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ +#include "jversion.h" /* for version message */ + +#ifdef USE_CCOMMAND /* command-line reader for Macintosh */ +#ifdef __MWERKS__ +#include /* Metrowerks needs this */ +#include /* ... and this */ +#endif +#ifdef THINK_C +#include /* Think declares it here */ +#endif +#endif + +#ifndef PATH_MAX /* ANSI maximum-pathname-length constant */ +#define PATH_MAX 256 +#endif + + +/* Create the add-on message string table. */ + +#define JMESSAGE(code,string) string , + +static const char * const cdjpeg_message_table[] = { +#include "cderror.h" + NULL +}; + + +/* + * Automatic determination of available memory. + */ + +static long default_maxmem; /* saves value determined at startup, or 0 */ + +#ifndef FREE_MEM_ESTIMATE /* may be defined from command line */ + +#ifdef MSDOS /* For MS-DOS (unless flat-memory model) */ + +#include /* for access to intdos() call */ + +LOCAL(long) +unused_dos_memory (void) +/* Obtain total amount of unallocated DOS memory */ +{ + union REGS regs; + long nparas; + + regs.h.ah = 0x48; /* DOS function Allocate Memory Block */ + regs.x.bx = 0xFFFF; /* Ask for more memory than DOS can have */ + (void) intdos(®s, ®s); + /* DOS will fail and return # of paragraphs actually available in BX. */ + nparas = (unsigned int) regs.x.bx; + /* Times 16 to convert to bytes. */ + return nparas << 4; +} + +/* The default memory setting is 95% of the available space. */ +#define FREE_MEM_ESTIMATE ((unused_dos_memory() * 95L) / 100L) + +#endif /* MSDOS */ + +#ifdef ATARI /* For Atari ST/Mega/STE/TT/Falcon, Pure C or Turbo C */ + +#include + +/* The default memory setting is 90% of the available space. */ +#define FREE_MEM_ESTIMATE (((long) coreleft() * 90L) / 100L) + +#endif /* ATARI */ + +/* Add memory-estimation procedures for other operating systems here, + * with appropriate #ifdef's around them. + */ + +#endif /* !FREE_MEM_ESTIMATE */ + + +/* + * This routine determines what format the input file is, + * and selects the appropriate input-reading module. + * + * To determine which family of input formats the file belongs to, + * we may look only at the first byte of the file, since C does not + * guarantee that more than one character can be pushed back with ungetc. + * Looking at additional bytes would require one of these approaches: + * 1) assume we can fseek() the input file (fails for piped input); + * 2) assume we can push back more than one character (works in + * some C implementations, but unportable); + * 3) provide our own buffering (breaks input readers that want to use + * stdio directly, such as the RLE library); + * or 4) don't put back the data, and modify the input_init methods to assume + * they start reading after the start of file (also breaks RLE library). + * #1 is attractive for MS-DOS but is untenable on Unix. + * + * The most portable solution for file types that can't be identified by their + * first byte is to make the user tell us what they are. This is also the + * only approach for "raw" file types that contain only arbitrary values. + * We presently apply this method for Targa files. Most of the time Targa + * files start with 0x00, so we recognize that case. Potentially, however, + * a Targa file could start with any byte value (byte 0 is the length of the + * seldom-used ID field), so we provide a switch to force Targa input mode. + */ + +static boolean is_targa; /* records user -targa switch */ + + +LOCAL(cjpeg_source_ptr) +select_file_type (j_compress_ptr cinfo, FILE * infile) +{ + int c; + + if (is_targa) { +#ifdef TARGA_SUPPORTED + return jinit_read_targa(cinfo); +#else + ERREXIT(cinfo, JERR_TGA_NOTCOMP); +#endif + } + + if ((c = getc(infile)) == EOF) + ERREXIT(cinfo, JERR_INPUT_EMPTY); + if (ungetc(c, infile) == EOF) + ERREXIT(cinfo, JERR_UNGETC_FAILED); + + switch (c) { +#ifdef BMP_SUPPORTED + case 'B': + return jinit_read_bmp(cinfo); +#endif +#ifdef GIF_SUPPORTED + case 'G': + return jinit_read_gif(cinfo); +#endif +#ifdef PPM_SUPPORTED + case 'P': + return jinit_read_ppm(cinfo); +#endif +#ifdef RLE_SUPPORTED + case 'R': + return jinit_read_rle(cinfo); +#endif +#ifdef TARGA_SUPPORTED + case 0x00: + return jinit_read_targa(cinfo); +#endif + default: + ERREXIT(cinfo, JERR_UNKNOWN_FORMAT); + break; + } + + return NULL; /* suppress compiler warnings */ +} + + +/* + * Argument-parsing code. + * The switch parser is designed to be useful with DOS-style command line + * syntax, ie, intermixed switches and file names, where only the switches + * to the left of a given file name affect processing of that file. + */ + + +static const char * progname; /* program name for error messages */ +static char * outfilename; /* for -outfile switch */ + + +LOCAL(void) +usage (void) +/* complain about bad command line */ +{ + fprintf(stderr, "usage: %s [switches] inputfile(s)\n", progname); + fprintf(stderr, "List of input files may use wildcards (* and ?)\n"); + fprintf(stderr, "Output filename is same as input filename, but extension .jpg\n"); + + fprintf(stderr, "Switches (names may be abbreviated):\n"); + fprintf(stderr, " -quality N[,...] Compression quality (0..100; 5-95 is useful range)\n"); + fprintf(stderr, " -grayscale Create monochrome JPEG file\n"); + fprintf(stderr, " -rgb Create RGB JPEG file\n"); +#ifdef ENTROPY_OPT_SUPPORTED + fprintf(stderr, " -optimize Optimize Huffman table (smaller file, but slow compression)\n"); +#endif +#ifdef C_PROGRESSIVE_SUPPORTED + fprintf(stderr, " -progressive Create progressive JPEG file\n"); +#endif +#ifdef DCT_SCALING_SUPPORTED + fprintf(stderr, " -scale M/N Scale image by fraction M/N, eg, 1/2\n"); +#endif +#ifdef TARGA_SUPPORTED + fprintf(stderr, " -targa Input file is Targa format (usually not needed)\n"); +#endif + fprintf(stderr, "Switches for advanced users:\n"); +#ifdef C_ARITH_CODING_SUPPORTED + fprintf(stderr, " -arithmetic Use arithmetic coding\n"); +#endif +#ifdef DCT_SCALING_SUPPORTED + fprintf(stderr, " -block N DCT block size (1..16; default is 8)\n"); +#endif +#if JPEG_LIB_VERSION_MAJOR >= 9 + fprintf(stderr, " -rgb1 Create RGB JPEG file with reversible color transform\n"); + fprintf(stderr, " -bgycc Create big gamut YCC JPEG file\n"); +#endif +#ifdef DCT_ISLOW_SUPPORTED + fprintf(stderr, " -dct int Use integer DCT method%s\n", + (JDCT_DEFAULT == JDCT_ISLOW ? " (default)" : "")); +#endif +#ifdef DCT_IFAST_SUPPORTED + fprintf(stderr, " -dct fast Use fast integer DCT (less accurate)%s\n", + (JDCT_DEFAULT == JDCT_IFAST ? " (default)" : "")); +#endif +#ifdef DCT_FLOAT_SUPPORTED + fprintf(stderr, " -dct float Use floating-point DCT method%s\n", + (JDCT_DEFAULT == JDCT_FLOAT ? " (default)" : "")); +#endif + fprintf(stderr, " -nosmooth Don't use high-quality downsampling\n"); + fprintf(stderr, " -restart N Set restart interval in rows, or in blocks with B\n"); +#ifdef INPUT_SMOOTHING_SUPPORTED + fprintf(stderr, " -smooth N Smooth dithered input (N=1..100 is strength)\n"); +#endif +#ifndef FREE_MEM_ESTIMATE + fprintf(stderr, " -maxmemory N Maximum memory to use (in kbytes)\n"); +#endif + fprintf(stderr, " -outfile name Specify name for output file\n"); + fprintf(stderr, " -verbose or -debug Emit debug output\n"); + fprintf(stderr, "Switches for wizards:\n"); + fprintf(stderr, " -baseline Force baseline quantization tables\n"); + fprintf(stderr, " -qtables file Use quantization tables given in file\n"); + fprintf(stderr, " -qslots N[,...] Set component quantization tables\n"); + fprintf(stderr, " -sample HxV[,...] Set component sampling factors\n"); +#ifdef C_MULTISCAN_FILES_SUPPORTED + fprintf(stderr, " -scans file Create multi-scan JPEG per script file\n"); +#endif + exit(EXIT_FAILURE); +} + + +LOCAL(int) +parse_switches (j_compress_ptr cinfo, int argc, char **argv, + int last_file_arg_seen, boolean for_real) +/* Parse optional switches. + * Returns argv[] index of first file-name argument (== argc if none). + * Any file names with indexes <= last_file_arg_seen are ignored; + * they have presumably been processed in a previous iteration. + * (Pass 0 for last_file_arg_seen on the first or only iteration.) + * for_real is FALSE on the first (dummy) pass; we may skip any expensive + * processing. + */ +{ + int argn; + char * arg; + boolean force_baseline; + boolean simple_progressive; + char * qualityarg = NULL; /* saves -quality parm if any */ + char * qtablefile = NULL; /* saves -qtables filename if any */ + char * qslotsarg = NULL; /* saves -qslots parm if any */ + char * samplearg = NULL; /* saves -sample parm if any */ + char * scansarg = NULL; /* saves -scans parm if any */ + + /* Set up default JPEG parameters. */ + + force_baseline = FALSE; /* by default, allow 16-bit quantizers */ + simple_progressive = FALSE; + is_targa = FALSE; + outfilename = NULL; + cinfo->err->trace_level = 0; + if (default_maxmem > 0) /* override library's default value */ + cinfo->mem->max_memory_to_use = default_maxmem; + + /* Scan command line options, adjust parameters */ + + for (argn = 1; argn < argc; argn++) { + arg = argv[argn]; + if (*arg != '-') { + /* Not a switch, must be a file name argument */ + if (argn <= last_file_arg_seen) { + outfilename = NULL; /* -outfile applies to just one input file */ + continue; /* ignore this name if previously processed */ + } + break; /* else done parsing switches */ + } + arg++; /* advance past switch marker character */ + + if (keymatch(arg, "arithmetic", 1)) { + /* Use arithmetic coding. */ +#ifdef C_ARITH_CODING_SUPPORTED + cinfo->arith_code = TRUE; +#else + fprintf(stderr, "%s: sorry, arithmetic coding not supported\n", + progname); + exit(EXIT_FAILURE); +#endif + + } else if (keymatch(arg, "baseline", 2)) { + /* Force baseline-compatible output (8-bit quantizer values). */ + force_baseline = TRUE; + + } else if (keymatch(arg, "block", 2)) { + /* Set DCT block size. */ +#if defined DCT_SCALING_SUPPORTED && JPEG_LIB_VERSION_MAJOR >= 8 && \ + (JPEG_LIB_VERSION_MAJOR > 8 || JPEG_LIB_VERSION_MINOR >= 3) + int val; + + if (++argn >= argc) /* advance to next argument */ + usage(); + if (sscanf(argv[argn], "%d", &val) != 1) + usage(); + if (val < 1 || val > 16) + usage(); + cinfo->block_size = val; +#else + fprintf(stderr, "%s: sorry, block size setting not supported\n", + progname); + exit(EXIT_FAILURE); +#endif + + } else if (keymatch(arg, "dct", 2)) { + /* Select DCT algorithm. */ + if (++argn >= argc) /* advance to next argument */ + usage(); + if (keymatch(argv[argn], "int", 1)) { + cinfo->dct_method = JDCT_ISLOW; + } else if (keymatch(argv[argn], "fast", 2)) { + cinfo->dct_method = JDCT_IFAST; + } else if (keymatch(argv[argn], "float", 2)) { + cinfo->dct_method = JDCT_FLOAT; + } else + usage(); + + } else if (keymatch(arg, "debug", 1) || keymatch(arg, "verbose", 1)) { + /* Enable debug printouts. */ + /* On first -d, print version identification */ + static boolean printed_version = FALSE; + + if (! printed_version) { + fprintf(stderr, "Independent JPEG Group's CJPEG, version %s\n%s\n", + JVERSION, JCOPYRIGHT); + printed_version = TRUE; + } + cinfo->err->trace_level++; + + } else if (keymatch(arg, "grayscale", 2) || keymatch(arg, "greyscale",2)) { + /* Force a monochrome JPEG file to be generated. */ + jpeg_set_colorspace(cinfo, JCS_GRAYSCALE); + + } else if (keymatch(arg, "rgb", 3) || keymatch(arg, "rgb1", 4)) { + /* Force an RGB JPEG file to be generated. */ +#if JPEG_LIB_VERSION_MAJOR >= 9 + /* Note: Entropy table assignment in jpeg_set_colorspace depends + * on color_transform. + */ + cinfo->color_transform = arg[3] ? JCT_SUBTRACT_GREEN : JCT_NONE; +#endif + jpeg_set_colorspace(cinfo, JCS_RGB); + + } else if (keymatch(arg, "bgycc", 5)) { + /* Force a big gamut YCC JPEG file to be generated. */ +#if JPEG_LIB_VERSION_MAJOR >= 9 && \ + (JPEG_LIB_VERSION_MAJOR > 9 || JPEG_LIB_VERSION_MINOR >= 1) + jpeg_set_colorspace(cinfo, JCS_BG_YCC); +#else + fprintf(stderr, "%s: sorry, BG_YCC colorspace not supported\n", + progname); + exit(EXIT_FAILURE); +#endif + + } else if (keymatch(arg, "maxmemory", 3)) { + /* Maximum memory in Kb (or Mb with 'm'). */ + long lval; + char ch = 'x'; + + if (++argn >= argc) /* advance to next argument */ + usage(); + if (sscanf(argv[argn], "%ld%c", &lval, &ch) < 1) + usage(); + if (ch == 'm' || ch == 'M') + lval *= 1000L; + cinfo->mem->max_memory_to_use = lval * 1000L; + + } else if (keymatch(arg, "nosmooth", 3)) { + /* Suppress fancy downsampling. */ + cinfo->do_fancy_downsampling = FALSE; + + } else if (keymatch(arg, "optimize", 1) || keymatch(arg, "optimise", 1)) { + /* Enable entropy parm optimization. */ +#ifdef ENTROPY_OPT_SUPPORTED + cinfo->optimize_coding = TRUE; +#else + fprintf(stderr, "%s: sorry, entropy optimization was not compiled\n", + progname); + exit(EXIT_FAILURE); +#endif + + } else if (keymatch(arg, "outfile", 4)) { + /* Set output file name. */ + if (++argn >= argc) /* advance to next argument */ + usage(); + outfilename = argv[argn]; /* save it away for later use */ + + } else if (keymatch(arg, "progressive", 1)) { + /* Select simple progressive mode. */ +#ifdef C_PROGRESSIVE_SUPPORTED + simple_progressive = TRUE; + /* We must postpone execution until num_components is known. */ +#else + fprintf(stderr, "%s: sorry, progressive output was not compiled\n", + progname); + exit(EXIT_FAILURE); +#endif + + } else if (keymatch(arg, "quality", 1)) { + /* Quality ratings (quantization table scaling factors). */ + if (++argn >= argc) /* advance to next argument */ + usage(); + qualityarg = argv[argn]; + + } else if (keymatch(arg, "qslots", 2)) { + /* Quantization table slot numbers. */ + if (++argn >= argc) /* advance to next argument */ + usage(); + qslotsarg = argv[argn]; + /* Must delay setting qslots until after we have processed any + * colorspace-determining switches, since jpeg_set_colorspace sets + * default quant table numbers. + */ + + } else if (keymatch(arg, "qtables", 2)) { + /* Quantization tables fetched from file. */ + if (++argn >= argc) /* advance to next argument */ + usage(); + qtablefile = argv[argn]; + /* We postpone actually reading the file in case -quality comes later. */ + + } else if (keymatch(arg, "restart", 1)) { + /* Restart interval in MCU rows (or in MCUs with 'b'). */ + long lval; + char ch = 'x'; + + if (++argn >= argc) /* advance to next argument */ + usage(); + if (sscanf(argv[argn], "%ld%c", &lval, &ch) < 1) + usage(); + if (lval < 0 || lval > 65535L) + usage(); + if (ch == 'b' || ch == 'B') { + cinfo->restart_interval = (unsigned int) lval; + cinfo->restart_in_rows = 0; /* else prior '-restart n' overrides me */ + } else { + cinfo->restart_in_rows = (int) lval; + /* restart_interval will be computed during startup */ + } + + } else if (keymatch(arg, "sample", 2)) { + /* Set sampling factors. */ + if (++argn >= argc) /* advance to next argument */ + usage(); + samplearg = argv[argn]; + /* Must delay setting sample factors until after we have processed any + * colorspace-determining switches, since jpeg_set_colorspace sets + * default sampling factors. + */ + + } else if (keymatch(arg, "scale", 4)) { + /* Scale the image by a fraction M/N. */ + if (++argn >= argc) /* advance to next argument */ + usage(); + if (sscanf(argv[argn], "%d/%d", + &cinfo->scale_num, &cinfo->scale_denom) != 2) + usage(); + + } else if (keymatch(arg, "scans", 4)) { + /* Set scan script. */ +#ifdef C_MULTISCAN_FILES_SUPPORTED + if (++argn >= argc) /* advance to next argument */ + usage(); + scansarg = argv[argn]; + /* We must postpone reading the file in case -progressive appears. */ +#else + fprintf(stderr, "%s: sorry, multi-scan output was not compiled\n", + progname); + exit(EXIT_FAILURE); +#endif + + } else if (keymatch(arg, "smooth", 2)) { + /* Set input smoothing factor. */ + int val; + + if (++argn >= argc) /* advance to next argument */ + usage(); + if (sscanf(argv[argn], "%d", &val) != 1) + usage(); + if (val < 0 || val > 100) + usage(); + cinfo->smoothing_factor = val; + + } else if (keymatch(arg, "targa", 1)) { + /* Input file is Targa format. */ + is_targa = TRUE; + + } else { + usage(); /* bogus switch */ + } + } + + /* Post-switch-scanning cleanup */ + + if (for_real) { + + /* Set quantization tables for selected quality. */ + /* Some or all may be overridden if -qtables is present. */ + if (qualityarg != NULL) /* process -quality if it was present */ + if (! set_quality_ratings(cinfo, qualityarg, force_baseline)) + usage(); + + if (qtablefile != NULL) /* process -qtables if it was present */ + if (! read_quant_tables(cinfo, qtablefile, force_baseline)) + usage(); + + if (qslotsarg != NULL) /* process -qslots if it was present */ + if (! set_quant_slots(cinfo, qslotsarg)) + usage(); + + if (samplearg != NULL) /* process -sample if it was present */ + if (! set_sample_factors(cinfo, samplearg)) + usage(); + +#ifdef C_PROGRESSIVE_SUPPORTED + if (simple_progressive) /* process -progressive; -scans can override */ + jpeg_simple_progression(cinfo); +#endif + +#ifdef C_MULTISCAN_FILES_SUPPORTED + if (scansarg != NULL) /* process -scans if it was present */ + if (! read_scan_script(cinfo, scansarg)) + usage(); +#endif + } + + return argn; /* return index of next arg (file name) */ +} + + +/* + * Check for overwrite of an existing file; clear it with user + */ + +#ifndef NO_OVERWRITE_CHECK + +LOCAL(boolean) +is_write_ok (char * outfname) +{ + FILE * ofile; + int ch; + + ofile = fopen(outfname, READ_BINARY); + if (ofile == NULL) + return TRUE; /* not present */ + fclose(ofile); /* oops, it is present */ + + for (;;) { + fprintf(stderr, "%s already exists, overwrite it? [y/n] ", + outfname); + fflush(stderr); + ch = getc(stdin); + if (ch != '\n') /* flush rest of line */ + while (getc(stdin) != '\n') + /* nothing */; + + switch (ch) { + case 'Y': + case 'y': + return TRUE; + case 'N': + case 'n': + return FALSE; + /* otherwise, ask again */ + } + } +} + +#endif + + +/* + * Process a single input file name, and return its index in argv[]. + * File names at or to left of old_file_index have been processed already. + */ + +LOCAL(int) +process_one_file (int argc, char **argv, int old_file_index) +{ + struct jpeg_compress_struct cinfo; + struct jpeg_error_mgr jerr; + char *infilename; + char workfilename[PATH_MAX]; +#ifdef PROGRESS_REPORT + struct cdjpeg_progress_mgr progress; +#endif + int file_index; + cjpeg_source_ptr src_mgr; + FILE * input_file = NULL; + FILE * output_file = NULL; + JDIMENSION num_scanlines; + + /* Initialize the JPEG compression object with default error handling. */ + cinfo.err = jpeg_std_error(&jerr); + jpeg_create_compress(&cinfo); + /* Add some application-specific error messages (from cderror.h) */ + jerr.addon_message_table = cdjpeg_message_table; + jerr.first_addon_message = JMSG_FIRSTADDONCODE; + jerr.last_addon_message = JMSG_LASTADDONCODE; + + /* Now safe to enable signal catcher. */ +#ifdef NEED_SIGNAL_CATCHER + enable_signal_catcher((j_common_ptr) &cinfo); +#endif + + /* Initialize JPEG parameters. + * Much of this may be overridden later. + * In particular, we don't yet know the input file's color space, + * but we need to provide some value for jpeg_set_defaults() to work. + */ + + cinfo.in_color_space = JCS_RGB; /* arbitrary guess */ + jpeg_set_defaults(&cinfo); + + /* Scan command line to find next file name. + * It is convenient to use just one switch-parsing routine, but the switch + * values read here are ignored; we will rescan the switches after opening + * the input file. + */ + + file_index = parse_switches(&cinfo, argc, argv, old_file_index, FALSE); + if (file_index >= argc) { + fprintf(stderr, "%s: missing input file name\n", progname); + usage(); + } + + /* Open the input file. */ + infilename = argv[file_index]; + if ((input_file = fopen(infilename, READ_BINARY)) == NULL) { + fprintf(stderr, "%s: can't open %s\n", progname, infilename); + goto fail; + } + +#ifdef PROGRESS_REPORT + start_progress_monitor((j_common_ptr) &cinfo, &progress); +#endif + + /* Figure out the input file format, and set up to read it. */ + src_mgr = select_file_type(&cinfo, input_file); + src_mgr->input_file = input_file; + + /* Read the input file header to obtain file size & colorspace. */ + (*src_mgr->start_input) (&cinfo, src_mgr); + + /* Now that we know input colorspace, fix colorspace-dependent defaults */ + jpeg_default_colorspace(&cinfo); + + /* Adjust default compression parameters by re-parsing the options */ + file_index = parse_switches(&cinfo, argc, argv, old_file_index, TRUE); + + /* If user didn't supply -outfile switch, select output file name. */ + if (outfilename == NULL) { + int i; + + outfilename = workfilename; + /* Make outfilename be infilename with .jpg substituted for extension */ + strcpy(outfilename, infilename); + for (i = (int)strlen(outfilename)-1; i >= 0; i--) { + switch (outfilename[i]) { + case ':': + case '/': + case '\\': + i = 0; /* stop scanning */ + break; + case '.': + outfilename[i] = '\0'; /* lop off existing extension */ + i = 0; /* stop scanning */ + break; + default: + break; /* keep scanning */ + } + } + strcat(outfilename, ".jpg"); + } + + fprintf(stderr, "Compressing %s => %s\n", infilename, outfilename); +#ifndef NO_OVERWRITE_CHECK + if (! is_write_ok(outfilename)) + goto fail; +#endif + + /* Open the output file. */ + if ((output_file = fopen(outfilename, WRITE_BINARY)) == NULL) { + fprintf(stderr, "%s: can't create %s\n", progname, outfilename); + goto fail; + } + + /* Specify data destination for compression */ + jpeg_stdio_dest(&cinfo, output_file); + + /* Start compressor */ + jpeg_start_compress(&cinfo, TRUE); + + /* Process data */ + while (cinfo.next_scanline < cinfo.image_height) { + num_scanlines = (*src_mgr->get_pixel_rows) (&cinfo, src_mgr); + (void) jpeg_write_scanlines(&cinfo, src_mgr->buffer, num_scanlines); + } + + /* Finish compression and release memory */ + (*src_mgr->finish_input) (&cinfo, src_mgr); + jpeg_finish_compress(&cinfo); + + /* Clean up and exit */ +fail: + jpeg_destroy_compress(&cinfo); + + if (input_file != NULL) fclose(input_file); + if (output_file != NULL) fclose(output_file); + +#ifdef PROGRESS_REPORT + end_progress_monitor((j_common_ptr) &cinfo); +#endif + + /* Disable signal catcher. */ +#ifdef NEED_SIGNAL_CATCHER + enable_signal_catcher((j_common_ptr) NULL); +#endif + + return file_index; +} + + +/* + * The main program. + */ + +int +main (int argc, char **argv) +{ + int file_index; + + /* On Mac, fetch a command line. */ +#ifdef USE_CCOMMAND + argc = ccommand(&argv); +#endif + +#ifdef MSDOS + progname = "cjpeg"; /* DOS tends to be too verbose about argv[0] */ +#else + progname = argv[0]; + if (progname == NULL || progname[0] == 0) + progname = "cjpeg"; /* in case C library doesn't provide it */ +#endif + + /* The default maxmem must be computed only once at program startup, + * since releasing memory with free() won't give it back to the OS. + */ +#ifdef FREE_MEM_ESTIMATE + default_maxmem = FREE_MEM_ESTIMATE; +#else + default_maxmem = 0; +#endif + + /* Scan command line, parse switches and locate input file names */ + + if (argc < 2) + usage(); /* nothing on the command line?? */ + + file_index = 0; + + while (file_index < argc-1) + file_index = process_one_file(argc, argv, file_index); + + /* All done. */ + exit(EXIT_SUCCESS); + return 0; /* suppress no-return-value warnings */ +} diff --git a/vendor/jpeg-9e/ckconfig.c b/vendor/jpeg-9f/ckconfig.c similarity index 100% rename from vendor/jpeg-9e/ckconfig.c rename to vendor/jpeg-9f/ckconfig.c diff --git a/vendor/jpeg-9e/djpeg.c b/vendor/jpeg-9f/djpeg.c similarity index 100% rename from vendor/jpeg-9e/djpeg.c rename to vendor/jpeg-9f/djpeg.c diff --git a/vendor/jpeg-9f/djpegalt.c b/vendor/jpeg-9f/djpegalt.c new file mode 100644 index 0000000000..969c58b49c --- /dev/null +++ b/vendor/jpeg-9f/djpegalt.c @@ -0,0 +1,766 @@ +/* + * alternate djpeg.c + * + * Copyright (C) 1991-1997, Thomas G. Lane. + * Modified 2009-2023 by Guido Vollbeding. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains an alternate user interface for the JPEG decompressor. + * One or more input files are named on the command line, and output file + * names are created by substituting an appropriate extension. + */ + +#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ +#include "jversion.h" /* for version message */ + +#include /* to declare isprint() */ + +#ifdef USE_CCOMMAND /* command-line reader for Macintosh */ +#ifdef __MWERKS__ +#include /* Metrowerks needs this */ +#include /* ... and this */ +#endif +#ifdef THINK_C +#include /* Think declares it here */ +#endif +#endif + +#ifndef PATH_MAX /* ANSI maximum-pathname-length constant */ +#define PATH_MAX 256 +#endif + + +/* Create the add-on message string table. */ + +#define JMESSAGE(code,string) string , + +static const char * const cdjpeg_message_table[] = { +#include "cderror.h" + NULL +}; + + +/* + * Automatic determination of available memory. + */ + +static long default_maxmem; /* saves value determined at startup, or 0 */ + +#ifndef FREE_MEM_ESTIMATE /* may be defined from command line */ + +#ifdef MSDOS /* For MS-DOS (unless flat-memory model) */ + +#include /* for access to intdos() call */ + +LOCAL(long) +unused_dos_memory (void) +/* Obtain total amount of unallocated DOS memory */ +{ + union REGS regs; + long nparas; + + regs.h.ah = 0x48; /* DOS function Allocate Memory Block */ + regs.x.bx = 0xFFFF; /* Ask for more memory than DOS can have */ + (void) intdos(®s, ®s); + /* DOS will fail and return # of paragraphs actually available in BX. */ + nparas = (unsigned int) regs.x.bx; + /* Times 16 to convert to bytes. */ + return nparas << 4; +} + +/* The default memory setting is 95% of the available space. */ +#define FREE_MEM_ESTIMATE ((unused_dos_memory() * 95L) / 100L) + +#endif /* MSDOS */ + +#ifdef ATARI /* For Atari ST/Mega/STE/TT/Falcon, Pure C or Turbo C */ + +#include + +/* The default memory setting is 90% of the available space. */ +#define FREE_MEM_ESTIMATE (((long) coreleft() * 90L) / 100L) + +#endif /* ATARI */ + +/* Add memory-estimation procedures for other operating systems here, + * with appropriate #ifdef's around them. + */ + +#endif /* !FREE_MEM_ESTIMATE */ + + +/* + * This list defines the known output image formats + * (not all of which need be supported by a given version). + * You can change the default output format by defining DEFAULT_FMT; + * indeed, you had better do so if you undefine PPM_SUPPORTED. + */ + +typedef enum { + FMT_BMP, /* BMP format (Windows flavor) */ + FMT_GIF, /* GIF format (LZW compressed) */ + FMT_GIF0, /* GIF format (uncompressed) */ + FMT_OS2, /* BMP format (OS/2 flavor) */ + FMT_PPM, /* PPM/PGM (PBMPLUS formats) */ + FMT_RLE, /* RLE format */ + FMT_TARGA, /* Targa format */ + FMT_TIFF /* TIFF format */ +} IMAGE_FORMATS; + +#ifndef DEFAULT_FMT /* so can override from CFLAGS in Makefile */ +#define DEFAULT_FMT FMT_BMP +#endif + +static IMAGE_FORMATS requested_fmt; + + +/* + * Argument-parsing code. + * The switch parser is designed to be useful with DOS-style command line + * syntax, ie, intermixed switches and file names, where only the switches + * to the left of a given file name affect processing of that file. + */ + + +static const char * progname; /* program name for error messages */ +static char * outfilename; /* for -outfile switch */ + + +LOCAL(void) +usage (void) +/* complain about bad command line */ +{ + fprintf(stderr, "usage: %s [switches] inputfile(s)\n", progname); + fprintf(stderr, "List of input files may use wildcards (* and ?)\n"); + fprintf(stderr, "Output filename is same as input filename except for extension\n"); + + fprintf(stderr, "Switches (names may be abbreviated):\n"); + fprintf(stderr, " -colors N Reduce image to no more than N colors\n"); + fprintf(stderr, " -fast Fast, low-quality processing\n"); + fprintf(stderr, " -grayscale Force grayscale output\n"); + fprintf(stderr, " -rgb Force RGB output\n"); +#ifdef IDCT_SCALING_SUPPORTED + fprintf(stderr, " -scale M/N Scale output image by fraction M/N, eg, 1/8\n"); +#endif +#ifdef BMP_SUPPORTED + fprintf(stderr, " -bmp Select BMP output format (Windows style)%s\n", + (DEFAULT_FMT == FMT_BMP ? " (default)" : "")); +#endif +#ifdef GIF_SUPPORTED + fprintf(stderr, " -gif Select GIF output format (LZW compressed)%s\n", + (DEFAULT_FMT == FMT_GIF ? " (default)" : "")); + fprintf(stderr, " -gif0 Select GIF output format (uncompressed)%s\n", + (DEFAULT_FMT == FMT_GIF0 ? " (default)" : "")); +#endif +#ifdef BMP_SUPPORTED + fprintf(stderr, " -os2 Select BMP output format (OS/2 style)%s\n", + (DEFAULT_FMT == FMT_OS2 ? " (default)" : "")); +#endif +#ifdef PPM_SUPPORTED + fprintf(stderr, " -pnm Select PBMPLUS (PPM/PGM) output format%s\n", + (DEFAULT_FMT == FMT_PPM ? " (default)" : "")); +#endif +#ifdef RLE_SUPPORTED + fprintf(stderr, " -rle Select Utah RLE output format%s\n", + (DEFAULT_FMT == FMT_RLE ? " (default)" : "")); +#endif +#ifdef TARGA_SUPPORTED + fprintf(stderr, " -targa Select Targa output format%s\n", + (DEFAULT_FMT == FMT_TARGA ? " (default)" : "")); +#endif + fprintf(stderr, "Switches for advanced users:\n"); +#ifdef DCT_ISLOW_SUPPORTED + fprintf(stderr, " -dct int Use integer DCT method%s\n", + (JDCT_DEFAULT == JDCT_ISLOW ? " (default)" : "")); +#endif +#ifdef DCT_IFAST_SUPPORTED + fprintf(stderr, " -dct fast Use fast integer DCT (less accurate)%s\n", + (JDCT_DEFAULT == JDCT_IFAST ? " (default)" : "")); +#endif +#ifdef DCT_FLOAT_SUPPORTED + fprintf(stderr, " -dct float Use floating-point DCT method%s\n", + (JDCT_DEFAULT == JDCT_FLOAT ? " (default)" : "")); +#endif + fprintf(stderr, " -dither fs Use F-S dithering (default)\n"); + fprintf(stderr, " -dither none Don't use dithering in quantization\n"); + fprintf(stderr, " -dither ordered Use ordered dither (medium speed, quality)\n"); +#ifdef QUANT_2PASS_SUPPORTED + fprintf(stderr, " -map FILE Map to colors used in named image file\n"); +#endif + fprintf(stderr, " -nosmooth Don't use high-quality upsampling\n"); +#ifdef QUANT_1PASS_SUPPORTED + fprintf(stderr, " -onepass Use 1-pass quantization (fast, low quality)\n"); +#endif +#ifndef FREE_MEM_ESTIMATE + fprintf(stderr, " -maxmemory N Maximum memory to use (in kbytes)\n"); +#endif + fprintf(stderr, " -outfile name Specify name for output file\n"); + fprintf(stderr, " -verbose or -debug Emit debug output\n"); + exit(EXIT_FAILURE); +} + + +LOCAL(int) +parse_switches (j_decompress_ptr cinfo, int argc, char **argv, + int last_file_arg_seen, boolean for_real) +/* Parse optional switches. + * Returns argv[] index of first file-name argument (== argc if none). + * Any file names with indexes <= last_file_arg_seen are ignored; + * they have presumably been processed in a previous iteration. + * (Pass 0 for last_file_arg_seen on the first or only iteration.) + * for_real is FALSE on the first (dummy) pass; we may skip any expensive + * processing. + */ +{ + int argn; + char * arg; + + /* Set up default JPEG parameters. */ + requested_fmt = DEFAULT_FMT; /* set default output file format */ + outfilename = NULL; + cinfo->err->trace_level = 0; + if (default_maxmem > 0) /* override library's default value */ + cinfo->mem->max_memory_to_use = default_maxmem; + + /* Scan command line options, adjust parameters */ + + for (argn = 1; argn < argc; argn++) { + arg = argv[argn]; + if (*arg != '-') { + /* Not a switch, must be a file name argument */ + if (argn <= last_file_arg_seen) { + outfilename = NULL; /* -outfile applies to just one input file */ + continue; /* ignore this name if previously processed */ + } + break; /* else done parsing switches */ + } + arg++; /* advance past switch marker character */ + + if (keymatch(arg, "bmp", 1)) { + /* BMP output format (Windows flavor). */ + requested_fmt = FMT_BMP; + + } else if (keymatch(arg, "colors", 1) || keymatch(arg, "colours", 1) || + keymatch(arg, "quantize", 1) || keymatch(arg, "quantise", 1)) { + /* Do color quantization. */ + int val; + + if (++argn >= argc) /* advance to next argument */ + usage(); + if (sscanf(argv[argn], "%d", &val) != 1) + usage(); + cinfo->desired_number_of_colors = val; + cinfo->quantize_colors = TRUE; + + } else if (keymatch(arg, "dct", 2)) { + /* Select IDCT algorithm. */ + if (++argn >= argc) /* advance to next argument */ + usage(); + if (keymatch(argv[argn], "int", 1)) { + cinfo->dct_method = JDCT_ISLOW; + } else if (keymatch(argv[argn], "fast", 2)) { + cinfo->dct_method = JDCT_IFAST; + } else if (keymatch(argv[argn], "float", 2)) { + cinfo->dct_method = JDCT_FLOAT; + } else + usage(); + + } else if (keymatch(arg, "dither", 2)) { + /* Select dithering algorithm. */ + if (++argn >= argc) /* advance to next argument */ + usage(); + if (keymatch(argv[argn], "fs", 2)) { + cinfo->dither_mode = JDITHER_FS; + } else if (keymatch(argv[argn], "none", 2)) { + cinfo->dither_mode = JDITHER_NONE; + } else if (keymatch(argv[argn], "ordered", 2)) { + cinfo->dither_mode = JDITHER_ORDERED; + } else + usage(); + + } else if (keymatch(arg, "debug", 1) || keymatch(arg, "verbose", 1)) { + /* Enable debug printouts. */ + /* On first -d, print version identification */ + static boolean printed_version = FALSE; + + if (! printed_version) { + fprintf(stderr, "Independent JPEG Group's DJPEG, version %s\n%s\n", + JVERSION, JCOPYRIGHT); + printed_version = TRUE; + } + cinfo->err->trace_level++; + + } else if (keymatch(arg, "fast", 1)) { + /* Select recommended processing options for quick-and-dirty output. */ + cinfo->two_pass_quantize = FALSE; + cinfo->dither_mode = JDITHER_ORDERED; + if (! cinfo->quantize_colors) /* don't override an earlier -colors */ + cinfo->desired_number_of_colors = 216; + cinfo->dct_method = JDCT_FASTEST; + cinfo->do_fancy_upsampling = FALSE; + + } else if (keymatch(arg, "gif", 1)) { + /* GIF output format (LZW compressed). */ + requested_fmt = FMT_GIF; + + } else if (keymatch(arg, "gif0", 4)) { + /* GIF output format (uncompressed). */ + requested_fmt = FMT_GIF0; + + } else if (keymatch(arg, "grayscale", 2) || keymatch(arg, "greyscale",2)) { + /* Force monochrome output. */ + cinfo->out_color_space = JCS_GRAYSCALE; + + } else if (keymatch(arg, "rgb", 3)) { + /* Force RGB output. */ + cinfo->out_color_space = JCS_RGB; + + } else if (keymatch(arg, "map", 3)) { + /* Quantize to a color map taken from an input file. */ + if (++argn >= argc) /* advance to next argument */ + usage(); + if (for_real) { /* too expensive to do twice! */ +#ifdef QUANT_2PASS_SUPPORTED /* otherwise can't quantize to supplied map */ + FILE * mapfile; + + if ((mapfile = fopen(argv[argn], READ_BINARY)) == NULL) { + fprintf(stderr, "%s: can't open %s\n", progname, argv[argn]); + exit(EXIT_FAILURE); + } + read_color_map(cinfo, mapfile); + fclose(mapfile); + cinfo->quantize_colors = TRUE; +#else + ERREXIT(cinfo, JERR_NOT_COMPILED); +#endif + } + + } else if (keymatch(arg, "maxmemory", 3)) { + /* Maximum memory in Kb (or Mb with 'm'). */ + long lval; + char ch = 'x'; + + if (++argn >= argc) /* advance to next argument */ + usage(); + if (sscanf(argv[argn], "%ld%c", &lval, &ch) < 1) + usage(); + if (ch == 'm' || ch == 'M') + lval *= 1000L; + cinfo->mem->max_memory_to_use = lval * 1000L; + + } else if (keymatch(arg, "nosmooth", 3)) { + /* Suppress fancy upsampling. */ + cinfo->do_fancy_upsampling = FALSE; + + } else if (keymatch(arg, "onepass", 3)) { + /* Use fast one-pass quantization. */ + cinfo->two_pass_quantize = FALSE; + + } else if (keymatch(arg, "os2", 3)) { + /* BMP output format (OS/2 flavor). */ + requested_fmt = FMT_OS2; + + } else if (keymatch(arg, "outfile", 4)) { + /* Set output file name. */ + if (++argn >= argc) /* advance to next argument */ + usage(); + outfilename = argv[argn]; /* save it away for later use */ + + } else if (keymatch(arg, "pnm", 1) || keymatch(arg, "ppm", 1)) { + /* PPM/PGM output format. */ + requested_fmt = FMT_PPM; + + } else if (keymatch(arg, "rle", 1)) { + /* RLE output format. */ + requested_fmt = FMT_RLE; + + } else if (keymatch(arg, "scale", 1)) { + /* Scale the output image by a fraction M/N. */ + if (++argn >= argc) /* advance to next argument */ + usage(); + if (sscanf(argv[argn], "%u/%u", + &cinfo->scale_num, &cinfo->scale_denom) < 1) + usage(); + + } else if (keymatch(arg, "targa", 1)) { + /* Targa output format. */ + requested_fmt = FMT_TARGA; + + } else { + usage(); /* bogus switch */ + } + } + + return argn; /* return index of next arg (file name) */ +} + + +/* + * Marker processor for COM and interesting APPn markers. + * This replaces the library's built-in processor, which just skips the marker. + * We want to print out the marker as text, to the extent possible. + * Note this code relies on a non-suspending data source. + */ + +LOCAL(unsigned int) +jpeg_getc (j_decompress_ptr cinfo) +/* Read next byte */ +{ + struct jpeg_source_mgr * datasrc = cinfo->src; + + if (datasrc->bytes_in_buffer == 0) { + if (! (*datasrc->fill_input_buffer) (cinfo)) + ERREXIT(cinfo, JERR_CANT_SUSPEND); + } + datasrc->bytes_in_buffer--; + return GETJOCTET(*datasrc->next_input_byte++); +} + + +METHODDEF(boolean) +print_text_marker (j_decompress_ptr cinfo) +{ + boolean traceit = (cinfo->err->trace_level >= 1); + INT32 length; + unsigned int ch; + unsigned int lastch = 0; + + length = jpeg_getc(cinfo) << 8; + length += jpeg_getc(cinfo); + length -= 2; /* discount the length word itself */ + + if (traceit) { + if (cinfo->unread_marker == JPEG_COM) + fprintf(stderr, "Comment, length %ld:\n", (long) length); + else /* assume it is an APPn otherwise */ + fprintf(stderr, "APP%d, length %ld:\n", + cinfo->unread_marker - JPEG_APP0, (long) length); + } + + while (--length >= 0) { + ch = jpeg_getc(cinfo); + if (traceit) { + /* Emit the character in a readable form. + * Nonprintables are converted to \nnn form, + * while \ is converted to \\. + * Newlines in CR, CR/LF, or LF form will be printed as one newline. + */ + if (ch == '\r') { + fprintf(stderr, "\n"); + } else if (ch == '\n') { + if (lastch != '\r') + fprintf(stderr, "\n"); + } else if (ch == '\\') { + fprintf(stderr, "\\\\"); + } else if (isprint(ch)) { + putc(ch, stderr); + } else { + fprintf(stderr, "\\%03o", ch); + } + lastch = ch; + } + } + + if (traceit) + fprintf(stderr, "\n"); + + return TRUE; +} + + +/* + * Check for overwrite of an existing file; clear it with user + */ + +#ifndef NO_OVERWRITE_CHECK + +LOCAL(boolean) +is_write_ok (char * outfname) +{ + FILE * ofile; + int ch; + + ofile = fopen(outfname, READ_BINARY); + if (ofile == NULL) + return TRUE; /* not present */ + fclose(ofile); /* oops, it is present */ + + for (;;) { + fprintf(stderr, "%s already exists, overwrite it? [y/n] ", + outfname); + fflush(stderr); + ch = getc(stdin); + if (ch != '\n') /* flush rest of line */ + while (getc(stdin) != '\n') + /* nothing */; + + switch (ch) { + case 'Y': + case 'y': + return TRUE; + case 'N': + case 'n': + return FALSE; + /* otherwise, ask again */ + } + } +} + +#endif + + +/* + * Process a single input file name, and return its index in argv[]. + * File names at or to left of old_file_index have been processed already. + */ + +LOCAL(int) +process_one_file (int argc, char **argv, int old_file_index) +{ + struct jpeg_decompress_struct cinfo; + struct jpeg_error_mgr jerr; + char *infilename; + char workfilename[PATH_MAX]; + const char *default_extension = NULL; +#ifdef PROGRESS_REPORT + struct cdjpeg_progress_mgr progress; +#endif + int file_index; + djpeg_dest_ptr dest_mgr = NULL; + FILE * input_file = NULL; + FILE * output_file = NULL; + JDIMENSION num_scanlines; + + /* Initialize the JPEG decompression object with default error handling. */ + cinfo.err = jpeg_std_error(&jerr); + jpeg_create_decompress(&cinfo); + /* Add some application-specific error messages (from cderror.h) */ + jerr.addon_message_table = cdjpeg_message_table; + jerr.first_addon_message = JMSG_FIRSTADDONCODE; + jerr.last_addon_message = JMSG_LASTADDONCODE; + + /* Insert custom marker processor for COM and APP12. + * APP12 is used by some digital camera makers for textual info, + * so we provide the ability to display it as text. + * If you like, additional APPn marker types can be selected for display, + * but don't try to override APP0 or APP14 this way (see libjpeg.txt). + */ + jpeg_set_marker_processor(&cinfo, JPEG_COM, print_text_marker); + jpeg_set_marker_processor(&cinfo, JPEG_APP0+12, print_text_marker); + + /* Now safe to enable signal catcher. */ +#ifdef NEED_SIGNAL_CATCHER + enable_signal_catcher((j_common_ptr) &cinfo); +#endif + + /* Scan command line to find next file name. + * It is convenient to use just one switch-parsing routine, but the switch + * values read here are ignored; we will rescan the switches after opening + * the input file. + * (Exception: tracing level set here controls verbosity for COM markers + * found during jpeg_read_header...) + */ + + file_index = parse_switches(&cinfo, argc, argv, old_file_index, FALSE); + if (file_index >= argc) { + fprintf(stderr, "%s: missing input file name\n", progname); + usage(); + } + + /* Open the input file. */ + infilename = argv[file_index]; + if ((input_file = fopen(infilename, READ_BINARY)) == NULL) { + fprintf(stderr, "%s: can't open %s\n", progname, infilename); + goto fail; + } + +#ifdef PROGRESS_REPORT + start_progress_monitor((j_common_ptr) &cinfo, &progress); +#endif + + /* Specify data source for decompression */ + jpeg_stdio_src(&cinfo, input_file); + + /* Read file header, set default decompression parameters */ + (void) jpeg_read_header(&cinfo, TRUE); + + /* Adjust default decompression parameters by re-parsing the options */ + file_index = parse_switches(&cinfo, argc, argv, old_file_index, TRUE); + + /* Initialize the output module now to let it override any crucial + * option settings (for instance, GIF wants to force color quantization). + */ + switch (requested_fmt) { +#ifdef BMP_SUPPORTED + case FMT_BMP: + dest_mgr = jinit_write_bmp(&cinfo, FALSE); + default_extension = ".bmp"; + break; + case FMT_OS2: + dest_mgr = jinit_write_bmp(&cinfo, TRUE); + default_extension = ".bmp"; + break; +#endif +#ifdef GIF_SUPPORTED + case FMT_GIF: + dest_mgr = jinit_write_gif(&cinfo, TRUE); + default_extension = ".gif"; + break; + case FMT_GIF0: + dest_mgr = jinit_write_gif(&cinfo, FALSE); + default_extension = ".gif"; + break; +#endif +#ifdef PPM_SUPPORTED + case FMT_PPM: + dest_mgr = jinit_write_ppm(&cinfo); + default_extension = ".ppm"; + break; +#endif +#ifdef RLE_SUPPORTED + case FMT_RLE: + dest_mgr = jinit_write_rle(&cinfo); + default_extension = ".rle"; + break; +#endif +#ifdef TARGA_SUPPORTED + case FMT_TARGA: + dest_mgr = jinit_write_targa(&cinfo); + default_extension = ".tga"; + break; +#endif + default: + ERREXIT(&cinfo, JERR_UNSUPPORTED_FORMAT); + } + + /* If user didn't supply -outfile switch, select output file name. */ + if (outfilename == NULL) { + int i; + + outfilename = workfilename; + /* Make outfilename be infilename with appropriate extension */ + strcpy(outfilename, infilename); + for (i = (int)strlen(outfilename)-1; i >= 0; i--) { + switch (outfilename[i]) { + case ':': + case '/': + case '\\': + i = 0; /* stop scanning */ + break; + case '.': + outfilename[i] = '\0'; /* lop off existing extension */ + i = 0; /* stop scanning */ + break; + default: + break; /* keep scanning */ + } + } + strcat(outfilename, default_extension); + } + + fprintf(stderr, "Decompressing %s => %s\n", infilename, outfilename); +#ifndef NO_OVERWRITE_CHECK + if (! is_write_ok(outfilename)) + goto fail; +#endif + + /* Open the output file. */ + if ((output_file = fopen(outfilename, WRITE_BINARY)) == NULL) { + fprintf(stderr, "%s: can't create %s\n", progname, outfilename); + goto fail; + } + dest_mgr->output_file = output_file; + + /* Start decompressor */ + (void) jpeg_start_decompress(&cinfo); + + /* Write output file header */ + (*dest_mgr->start_output) (&cinfo, dest_mgr); + + /* Process data */ + while (cinfo.output_scanline < cinfo.output_height) { + num_scanlines = jpeg_read_scanlines(&cinfo, dest_mgr->buffer, + dest_mgr->buffer_height); + (*dest_mgr->put_pixel_rows) (&cinfo, dest_mgr, num_scanlines); + } + +#ifdef PROGRESS_REPORT + /* Hack: count final pass as done in case finish_output does an extra pass. + * The library won't have updated completed_passes. + */ + progress.pub.completed_passes = progress.pub.total_passes; +#endif + + /* Finish decompression and release memory. + * I must do it in this order because output module has allocated memory + * of lifespan JPOOL_IMAGE; it needs to finish before releasing memory. + */ + (*dest_mgr->finish_output) (&cinfo, dest_mgr); + (void) jpeg_finish_decompress(&cinfo); + + /* Clean up and exit */ +fail: + jpeg_destroy_decompress(&cinfo); + + if (input_file != NULL) fclose(input_file); + if (output_file != NULL) fclose(output_file); + +#ifdef PROGRESS_REPORT + end_progress_monitor((j_common_ptr) &cinfo); +#endif + + /* Disable signal catcher. */ +#ifdef NEED_SIGNAL_CATCHER + enable_signal_catcher((j_common_ptr) NULL); +#endif + + return file_index; +} + + +/* + * The main program. + */ + +int +main (int argc, char **argv) +{ + int file_index; + + /* On Mac, fetch a command line. */ +#ifdef USE_CCOMMAND + argc = ccommand(&argv); +#endif + +#ifdef MSDOS + progname = "djpeg"; /* DOS tends to be too verbose about argv[0] */ +#else + progname = argv[0]; + if (progname == NULL || progname[0] == 0) + progname = "djpeg"; /* in case C library doesn't provide it */ +#endif + + /* The default maxmem must be computed only once at program startup, + * since releasing memory with free() won't give it back to the OS. + */ +#ifdef FREE_MEM_ESTIMATE + default_maxmem = FREE_MEM_ESTIMATE; +#else + default_maxmem = 0; +#endif + + /* Scan command line, parse switches and locate input file names */ + + if (argc < 2) + usage(); /* nothing on the command line?? */ + + file_index = 0; + + while (file_index < argc-1) + file_index = process_one_file(argc, argv, file_index); + + /* All done. */ + exit(EXIT_SUCCESS); + return 0; /* suppress no-return-value warnings */ +} diff --git a/vendor/jpeg-9e/example.c b/vendor/jpeg-9f/example.c similarity index 100% rename from vendor/jpeg-9e/example.c rename to vendor/jpeg-9f/example.c diff --git a/vendor/jpeg-9e/jaricom.c b/vendor/jpeg-9f/jaricom.c similarity index 100% rename from vendor/jpeg-9e/jaricom.c rename to vendor/jpeg-9f/jaricom.c diff --git a/vendor/jpeg-9e/jcapimin.c b/vendor/jpeg-9f/jcapimin.c similarity index 100% rename from vendor/jpeg-9e/jcapimin.c rename to vendor/jpeg-9f/jcapimin.c diff --git a/vendor/jpeg-9e/jcapistd.c b/vendor/jpeg-9f/jcapistd.c similarity index 100% rename from vendor/jpeg-9e/jcapistd.c rename to vendor/jpeg-9f/jcapistd.c diff --git a/vendor/jpeg-9e/jcarith.c b/vendor/jpeg-9f/jcarith.c similarity index 100% rename from vendor/jpeg-9e/jcarith.c rename to vendor/jpeg-9f/jcarith.c diff --git a/vendor/jpeg-9e/jccoefct.c b/vendor/jpeg-9f/jccoefct.c similarity index 98% rename from vendor/jpeg-9e/jccoefct.c rename to vendor/jpeg-9f/jccoefct.c index 77851f390e..494aa22988 100644 --- a/vendor/jpeg-9e/jccoefct.c +++ b/vendor/jpeg-9f/jccoefct.c @@ -2,7 +2,7 @@ * jccoefct.c * * Copyright (C) 1994-1997, Thomas G. Lane. - * Modified 2003-2020 by Guido Vollbeding. + * Modified 2003-2022 by Guido Vollbeding. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -41,9 +41,9 @@ typedef struct { int MCU_rows_per_iMCU_row; /* number of such rows needed */ /* For single-pass compression, it's sufficient to buffer just one MCU - * (although this may prove a bit slow in practice). We append a - * workspace of C_MAX_BLOCKS_IN_MCU coefficient blocks, and reuse it - * for each MCU constructed and sent. + * (although this may prove a bit slow in practice). + * We append a workspace of C_MAX_BLOCKS_IN_MCU coefficient blocks, + * and reuse it for each MCU constructed and sent. * In multi-pass modes, this array points to the current MCU's blocks * within the virtual arrays. */ diff --git a/vendor/jpeg-9e/jccolor.c b/vendor/jpeg-9f/jccolor.c similarity index 95% rename from vendor/jpeg-9e/jccolor.c rename to vendor/jpeg-9f/jccolor.c index db2ca429e8..c028dd9db3 100644 --- a/vendor/jpeg-9e/jccolor.c +++ b/vendor/jpeg-9f/jccolor.c @@ -2,7 +2,7 @@ * jccolor.c * * Copyright (C) 1991-1996, Thomas G. Lane. - * Modified 2011-2019 by Guido Vollbeding. + * Modified 2011-2023 by Guido Vollbeding. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -40,10 +40,10 @@ typedef my_color_converter * my_cconvert_ptr; * Note that the derived conversion coefficients given in some of these * documents are imprecise. The general conversion equations are * Y = Kr * R + (1 - Kr - Kb) * G + Kb * B - * Cb = 0.5 * (B - Y) / (1 - Kb) - * Cr = 0.5 * (R - Y) / (1 - Kr) + * Cb = (B - Y) / (1 - Kb) / K + * Cr = (R - Y) / (1 - Kr) / K * With Kr = 0.299 and Kb = 0.114 (derived according to SMPTE RP 177-1993 - * from the 1953 FCC NTSC primaries and CIE Illuminant C), + * from the 1953 FCC NTSC primaries and CIE Illuminant C), K = 2 for sYCC, * the conversion equations to be implemented are therefore * Y = 0.299 * R + 0.587 * G + 0.114 * B * Cb = -0.168735892 * R - 0.331264108 * G + 0.5 * B + CENTERJSAMPLE @@ -62,8 +62,8 @@ typedef my_color_converter * my_cconvert_ptr; * by precalculating the constants times R,G,B for all possible values. * For 8-bit JSAMPLEs this is very reasonable (only 256 entries per table); * for 9-bit to 12-bit samples it is still acceptable. It's not very - * reasonable for 16-bit samples, but if you want lossless storage you - * shouldn't be changing colorspace anyway. + * reasonable for 16-bit samples, but if you want lossless storage + * you shouldn't be changing colorspace anyway. * The CENTERJSAMPLE offsets and the rounding fudge-factor of 0.5 are included * in the tables to save adding them separately in the inner loop. */ @@ -110,16 +110,16 @@ rgb_ycc_start (j_compress_ptr cinfo) for (i = 0; i <= MAXJSAMPLE; i++) { rgb_ycc_tab[i+R_Y_OFF] = FIX(0.299) * i; rgb_ycc_tab[i+G_Y_OFF] = FIX(0.587) * i; - rgb_ycc_tab[i+B_Y_OFF] = FIX(0.114) * i + ONE_HALF; + rgb_ycc_tab[i+B_Y_OFF] = FIX(0.114) * i + ONE_HALF; rgb_ycc_tab[i+R_CB_OFF] = (- FIX(0.168735892)) * i; rgb_ycc_tab[i+G_CB_OFF] = (- FIX(0.331264108)) * i; /* We use a rounding fudge-factor of 0.5-epsilon for Cb and Cr. * This ensures that the maximum output will round to MAXJSAMPLE * not MAXJSAMPLE+1, and thus that we don't have to range-limit. */ - rgb_ycc_tab[i+B_CB_OFF] = FIX(0.5) * i + CBCR_OFFSET + ONE_HALF-1; + rgb_ycc_tab[i+B_CB_OFF] = (i << (SCALEBITS-1)) + CBCR_OFFSET + ONE_HALF-1; /* B=>Cb and R=>Cr tables are the same - rgb_ycc_tab[i+R_CR_OFF] = FIX(0.5) * i + CBCR_OFFSET + ONE_HALF-1; + rgb_ycc_tab[i+R_CR_OFF] = (i << (SCALEBITS-1)) + CBCR_OFFSET + ONE_HALF-1; */ rgb_ycc_tab[i+G_CR_OFF] = (- FIX(0.418687589)) * i; rgb_ycc_tab[i+B_CR_OFF] = (- FIX(0.081312411)) * i; @@ -190,8 +190,8 @@ rgb_ycc_convert (j_compress_ptr cinfo, /* * Convert some rows of samples to the JPEG colorspace. - * This version handles RGB->grayscale conversion, which is the same - * as the RGB->Y portion of RGB->YCbCr. + * This version handles RGB->grayscale conversion, + * which is the same as the RGB->Y portion of RGB->YCbCr. * We assume rgb_ycc_start has been called (we only use the Y tables). */ @@ -201,7 +201,7 @@ rgb_gray_convert (j_compress_ptr cinfo, JDIMENSION output_row, int num_rows) { my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; - register int r, g, b; + register INT32 y; register INT32 * ctab = cconvert->rgb_ycc_tab; register JSAMPROW inptr; register JSAMPROW outptr; @@ -212,14 +212,11 @@ rgb_gray_convert (j_compress_ptr cinfo, inptr = *input_buf++; outptr = output_buf[0][output_row++]; for (col = 0; col < num_cols; col++) { - r = GETJSAMPLE(inptr[RGB_RED]); - g = GETJSAMPLE(inptr[RGB_GREEN]); - b = GETJSAMPLE(inptr[RGB_BLUE]); + y = ctab[R_Y_OFF + GETJSAMPLE(inptr[RGB_RED])]; + y += ctab[G_Y_OFF + GETJSAMPLE(inptr[RGB_GREEN])]; + y += ctab[B_Y_OFF + GETJSAMPLE(inptr[RGB_BLUE])]; inptr += RGB_PIXELSIZE; - /* Y */ - outptr[col] = (JSAMPLE) - ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF]) - >> SCALEBITS); + outptr[col] = (JSAMPLE) (y >> SCALEBITS); } } } diff --git a/vendor/jpeg-9e/jcdctmgr.c b/vendor/jpeg-9f/jcdctmgr.c similarity index 100% rename from vendor/jpeg-9e/jcdctmgr.c rename to vendor/jpeg-9f/jcdctmgr.c diff --git a/vendor/jpeg-9e/jchuff.c b/vendor/jpeg-9f/jchuff.c similarity index 89% rename from vendor/jpeg-9e/jchuff.c rename to vendor/jpeg-9f/jchuff.c index f3272c9fa6..1f527b2182 100644 --- a/vendor/jpeg-9e/jchuff.c +++ b/vendor/jpeg-9f/jchuff.c @@ -2,7 +2,7 @@ * jchuff.c * * Copyright (C) 1991-1997, Thomas G. Lane. - * Modified 2006-2020 by Guido Vollbeding. + * Modified 2006-2023 by Guido Vollbeding. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -26,17 +26,11 @@ /* The legal range of a DCT coefficient is - * -1024 .. +1023 for 8-bit data; - * -16384 .. +16383 for 12-bit data. - * Hence the magnitude should always fit in 10 or 14 bits respectively. + * -1024 .. +1023 for 8-bit sample data precision; + * -16384 .. +16383 for 12-bit sample data precision. + * Hence the magnitude should always fit in sample data precision + 2 bits. */ -#if BITS_IN_JSAMPLE == 8 -#define MAX_COEF_BITS 10 -#else -#define MAX_COEF_BITS 14 -#endif - /* Derived data constructed for each Huffman table */ typedef struct { @@ -547,6 +541,7 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKARRAY MCU_data) huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; register int temp, temp2; register int nbits; + int max_coef_bits; int blkn, ci, tbl; ISHIFT_TEMPS @@ -558,6 +553,9 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKARRAY MCU_data) if (entropy->restarts_to_go == 0) emit_restart_e(entropy, entropy->next_restart_num); + /* Since we're encoding a difference, the range limit is twice as much. */ + max_coef_bits = cinfo->data_precision + 3; + /* Encode the MCU data blocks */ for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { ci = cinfo->MCU_membership[blkn]; @@ -569,12 +567,17 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKARRAY MCU_data) temp = IRIGHT_SHIFT((int) (MCU_data[blkn][0][0]), cinfo->Al); /* DC differences are figured on the point-transformed values. */ - temp2 = temp - entropy->saved.last_dc_val[ci]; + if ((temp2 = temp - entropy->saved.last_dc_val[ci]) == 0) { + /* Count/emit the Huffman-coded symbol for the number of bits */ + emit_dc_symbol(entropy, tbl, 0); + + continue; + } + entropy->saved.last_dc_val[ci] = temp; /* Encode the DC coefficient difference per section G.1.2.1 */ - temp = temp2; - if (temp < 0) { + if ((temp = temp2) < 0) { temp = -temp; /* temp is abs value of input */ /* For a negative input, want temp2 = bitwise complement of abs(input) */ /* This code assumes we are on a two's complement machine */ @@ -583,14 +586,10 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKARRAY MCU_data) /* Find the number of bits needed for the magnitude of the coefficient */ nbits = 0; - while (temp) { - nbits++; - temp >>= 1; - } - /* Check for out-of-range coefficient values. - * Since we're encoding a difference, the range limit is twice as much. - */ - if (nbits > MAX_COEF_BITS+1) + do nbits++; /* there must be at least one 1 bit */ + while ((temp >>= 1)); + /* Check for out-of-range coefficient values */ + if (nbits > max_coef_bits) ERREXIT(cinfo, JERR_BAD_DCT_COEF); /* Count/emit the Huffman-coded symbol for the number of bits */ @@ -598,8 +597,7 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKARRAY MCU_data) /* Emit that number of bits of the value, if positive, */ /* or the complement of its magnitude, if negative. */ - if (nbits) /* emit_bits rejects calls with size 0 */ - emit_bits_e(entropy, (unsigned int) temp2, nbits); + emit_bits_e(entropy, (unsigned int) temp2, nbits); } cinfo->dest->next_output_byte = entropy->next_output_byte; @@ -633,7 +631,7 @@ encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKARRAY MCU_data) register int temp, temp2; register int nbits; register int r, k; - int Se, Al; + int Se, Al, max_coef_bits; entropy->next_output_byte = cinfo->dest->next_output_byte; entropy->free_in_buffer = cinfo->dest->free_in_buffer; @@ -646,6 +644,7 @@ encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKARRAY MCU_data) Se = cinfo->Se; Al = cinfo->Al; natural_order = cinfo->natural_order; + max_coef_bits = cinfo->data_precision + 2; /* Encode the MCU data block */ block = MCU_data[0]; @@ -666,18 +665,23 @@ encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKARRAY MCU_data) */ if (temp < 0) { temp = -temp; /* temp is abs value of input */ - temp >>= Al; /* apply the point transform */ + /* Apply the point transform, and watch out for case */ + /* that nonzero coef is zero after point transform. */ + if ((temp >>= Al) == 0) { + r++; + continue; + } /* For a negative coef, want temp2 = bitwise complement of abs(coef) */ temp2 = ~temp; } else { - temp >>= Al; /* apply the point transform */ + /* Apply the point transform, and watch out for case */ + /* that nonzero coef is zero after point transform. */ + if ((temp >>= Al) == 0) { + r++; + continue; + } temp2 = temp; } - /* Watch out for case that nonzero coef is zero after point transform */ - if (temp == 0) { - r++; - continue; - } /* Emit any pending EOBRUN */ if (entropy->EOBRUN > 0) @@ -689,11 +693,11 @@ encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKARRAY MCU_data) } /* Find the number of bits needed for the magnitude of the coefficient */ - nbits = 1; /* there must be at least one 1 bit */ - while ((temp >>= 1)) - nbits++; + nbits = 0; + do nbits++; /* there must be at least one 1 bit */ + while ((temp >>= 1)); /* Check for out-of-range coefficient values */ - if (nbits > MAX_COEF_BITS) + if (nbits > max_coef_bits) ERREXIT(cinfo, JERR_BAD_DCT_COEF); /* Count/emit Huffman symbol for run length / number of bits */ @@ -916,83 +920,89 @@ encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val, register int nbits; register int r, k; int Se = state->cinfo->lim_Se; + int max_coef_bits = state->cinfo->data_precision + 3; const int * natural_order = state->cinfo->natural_order; /* Encode the DC coefficient difference per section F.1.2.1 */ - temp = temp2 = block[0] - last_dc_val; - - if (temp < 0) { - temp = -temp; /* temp is abs value of input */ - /* For a negative input, want temp2 = bitwise complement of abs(input) */ - /* This code assumes we are on a two's complement machine */ - temp2--; - } + if ((temp = block[0] - last_dc_val) == 0) { + /* Emit the Huffman-coded symbol for the number of bits */ + if (! emit_bits_s(state, dctbl->ehufco[0], dctbl->ehufsi[0])) + return FALSE; + } else { + if ((temp2 = temp) < 0) { + temp = -temp; /* temp is abs value of input */ + /* For a negative input, want temp2 = bitwise complement of abs(input) */ + /* This code assumes we are on a two's complement machine */ + temp2--; + } - /* Find the number of bits needed for the magnitude of the coefficient */ - nbits = 0; - while (temp) { - nbits++; - temp >>= 1; - } - /* Check for out-of-range coefficient values. - * Since we're encoding a difference, the range limit is twice as much. - */ - if (nbits > MAX_COEF_BITS+1) - ERREXIT(state->cinfo, JERR_BAD_DCT_COEF); + /* Find the number of bits needed for the magnitude of the coefficient */ + nbits = 0; + do nbits++; /* there must be at least one 1 bit */ + while ((temp >>= 1)); + /* Check for out-of-range coefficient values. + * Since we're encoding a difference, the range limit is twice as much. + */ + if (nbits > max_coef_bits) + ERREXIT(state->cinfo, JERR_BAD_DCT_COEF); - /* Emit the Huffman-coded symbol for the number of bits */ - if (! emit_bits_s(state, dctbl->ehufco[nbits], dctbl->ehufsi[nbits])) - return FALSE; + /* Emit the Huffman-coded symbol for the number of bits */ + if (! emit_bits_s(state, dctbl->ehufco[nbits], dctbl->ehufsi[nbits])) + return FALSE; - /* Emit that number of bits of the value, if positive, */ - /* or the complement of its magnitude, if negative. */ - if (nbits) /* emit_bits rejects calls with size 0 */ + /* Emit that number of bits of the value, if positive, */ + /* or the complement of its magnitude, if negative. */ if (! emit_bits_s(state, (unsigned int) temp2, nbits)) return FALSE; + } /* Encode the AC coefficients per section F.1.2.2 */ r = 0; /* r = run length of zeros */ for (k = 1; k <= Se; k++) { - if ((temp2 = block[natural_order[k]]) == 0) { + if ((temp = block[natural_order[k]]) == 0) { r++; - } else { - /* if run length > 15, must emit special run-length-16 codes (0xF0) */ - while (r > 15) { - if (! emit_bits_s(state, actbl->ehufco[0xF0], actbl->ehufsi[0xF0])) - return FALSE; - r -= 16; - } - - temp = temp2; - if (temp < 0) { - temp = -temp; /* temp is abs value of input */ - /* This code assumes we are on a two's complement machine */ - temp2--; - } - - /* Find the number of bits needed for the magnitude of the coefficient */ - nbits = 1; /* there must be at least one 1 bit */ - while ((temp >>= 1)) - nbits++; - /* Check for out-of-range coefficient values */ - if (nbits > MAX_COEF_BITS) - ERREXIT(state->cinfo, JERR_BAD_DCT_COEF); - - /* Emit Huffman symbol for run length / number of bits */ - temp = (r << 4) + nbits; - if (! emit_bits_s(state, actbl->ehufco[temp], actbl->ehufsi[temp])) - return FALSE; + continue; + } - /* Emit that number of bits of the value, if positive, */ - /* or the complement of its magnitude, if negative. */ - if (! emit_bits_s(state, (unsigned int) temp2, nbits)) + /* if run length > 15, must emit special run-length-16 codes (0xF0) */ + while (r > 15) { + if (! emit_bits_s(state, actbl->ehufco[0xF0], actbl->ehufsi[0xF0])) return FALSE; + r -= 16; + } - r = 0; + if ((temp2 = temp) < 0) { + temp = -temp; /* temp is abs value of input */ + /* For a negative coef, want temp2 = bitwise complement of abs(coef) */ + /* This code assumes we are on a two's complement machine */ + temp2--; } + + /* Find the number of bits needed for the magnitude of the coefficient */ + nbits = 0; + do nbits++; /* there must be at least one 1 bit */ + while ((temp >>= 1)); + /* Check for out-of-range coefficient values. + * Use ">=" instead of ">" so can use the + * same one larger limit from DC check here. + */ + if (nbits >= max_coef_bits) + ERREXIT(state->cinfo, JERR_BAD_DCT_COEF); + + /* Emit Huffman symbol for run length / number of bits */ + temp = (r << 4) + nbits; + if (! emit_bits_s(state, actbl->ehufco[temp], actbl->ehufsi[temp])) + return FALSE; + + /* Emit that number of bits of the value, if positive, */ + /* or the complement of its magnitude, if negative. */ + if (! emit_bits_s(state, (unsigned int) temp2, nbits)) + return FALSE; + + r = 0; /* reset zero run length */ } /* If the last coef(s) were zero, emit an end-of-block code */ @@ -1122,28 +1132,31 @@ htest_one_block (j_compress_ptr cinfo, JCOEFPTR block, int last_dc_val, register int nbits; register int r, k; int Se = cinfo->lim_Se; + int max_coef_bits = cinfo->data_precision + 3; const int * natural_order = cinfo->natural_order; /* Encode the DC coefficient difference per section F.1.2.1 */ - temp = block[0] - last_dc_val; - if (temp < 0) - temp = -temp; + if ((temp = block[0] - last_dc_val) == 0) { + /* Count the Huffman symbol for the number of bits */ + dc_counts[0]++; + } else { + if (temp < 0) + temp = -temp; /* temp is abs value of input */ - /* Find the number of bits needed for the magnitude of the coefficient */ - nbits = 0; - while (temp) { - nbits++; - temp >>= 1; - } - /* Check for out-of-range coefficient values. - * Since we're encoding a difference, the range limit is twice as much. - */ - if (nbits > MAX_COEF_BITS+1) - ERREXIT(cinfo, JERR_BAD_DCT_COEF); + /* Find the number of bits needed for the magnitude of the coefficient */ + nbits = 0; + do nbits++; /* there must be at least one 1 bit */ + while ((temp >>= 1)); + /* Check for out-of-range coefficient values. + * Since we're encoding a difference, the range limit is twice as much. + */ + if (nbits > max_coef_bits) + ERREXIT(cinfo, JERR_BAD_DCT_COEF); - /* Count the Huffman symbol for the number of bits */ - dc_counts[nbits]++; + /* Count the Huffman symbol for the number of bits */ + dc_counts[nbits]++; + } /* Encode the AC coefficients per section F.1.2.2 */ @@ -1152,30 +1165,33 @@ htest_one_block (j_compress_ptr cinfo, JCOEFPTR block, int last_dc_val, for (k = 1; k <= Se; k++) { if ((temp = block[natural_order[k]]) == 0) { r++; - } else { - /* if run length > 15, must emit special run-length-16 codes (0xF0) */ - while (r > 15) { - ac_counts[0xF0]++; - r -= 16; - } + continue; + } + + /* if run length > 15, must emit special run-length-16 codes (0xF0) */ + while (r > 15) { + ac_counts[0xF0]++; + r -= 16; + } - /* Find the number of bits needed for the magnitude of the coefficient */ - if (temp < 0) - temp = -temp; + if (temp < 0) + temp = -temp; /* temp is abs value of input */ - /* Find the number of bits needed for the magnitude of the coefficient */ - nbits = 1; /* there must be at least one 1 bit */ - while ((temp >>= 1)) - nbits++; - /* Check for out-of-range coefficient values */ - if (nbits > MAX_COEF_BITS) - ERREXIT(cinfo, JERR_BAD_DCT_COEF); + /* Find the number of bits needed for the magnitude of the coefficient */ + nbits = 0; + do nbits++; /* there must be at least one 1 bit */ + while ((temp >>= 1)); + /* Check for out-of-range coefficient values. + * Use ">=" instead of ">" so can use the + * same one larger limit from DC check here. + */ + if (nbits >= max_coef_bits) + ERREXIT(cinfo, JERR_BAD_DCT_COEF); - /* Count Huffman symbol for run length / number of bits */ - ac_counts[(r << 4) + nbits]++; + /* Count Huffman symbol for run length / number of bits */ + ac_counts[(r << 4) + nbits]++; - r = 0; - } + r = 0; /* reset zero run length */ } /* If the last coef(s) were zero, emit an end-of-block code */ diff --git a/vendor/jpeg-9e/jcinit.c b/vendor/jpeg-9f/jcinit.c similarity index 100% rename from vendor/jpeg-9e/jcinit.c rename to vendor/jpeg-9f/jcinit.c diff --git a/vendor/jpeg-9e/jcmainct.c b/vendor/jpeg-9f/jcmainct.c similarity index 100% rename from vendor/jpeg-9e/jcmainct.c rename to vendor/jpeg-9f/jcmainct.c diff --git a/vendor/jpeg-9e/jcmarker.c b/vendor/jpeg-9f/jcmarker.c similarity index 100% rename from vendor/jpeg-9e/jcmarker.c rename to vendor/jpeg-9f/jcmarker.c diff --git a/vendor/jpeg-9e/jcmaster.c b/vendor/jpeg-9f/jcmaster.c similarity index 100% rename from vendor/jpeg-9e/jcmaster.c rename to vendor/jpeg-9f/jcmaster.c diff --git a/vendor/jpeg-9e/jcomapi.c b/vendor/jpeg-9f/jcomapi.c similarity index 100% rename from vendor/jpeg-9e/jcomapi.c rename to vendor/jpeg-9f/jcomapi.c diff --git a/vendor/jpeg-9e/jconfig.h b/vendor/jpeg-9f/jconfig.h similarity index 100% rename from vendor/jpeg-9e/jconfig.h rename to vendor/jpeg-9f/jconfig.h diff --git a/vendor/jpeg-9e/jcparam.c b/vendor/jpeg-9f/jcparam.c similarity index 100% rename from vendor/jpeg-9e/jcparam.c rename to vendor/jpeg-9f/jcparam.c diff --git a/vendor/jpeg-9e/jcprepct.c b/vendor/jpeg-9f/jcprepct.c similarity index 100% rename from vendor/jpeg-9e/jcprepct.c rename to vendor/jpeg-9f/jcprepct.c diff --git a/vendor/jpeg-9e/jcsample.c b/vendor/jpeg-9f/jcsample.c similarity index 100% rename from vendor/jpeg-9e/jcsample.c rename to vendor/jpeg-9f/jcsample.c diff --git a/vendor/jpeg-9e/jctrans.c b/vendor/jpeg-9f/jctrans.c similarity index 100% rename from vendor/jpeg-9e/jctrans.c rename to vendor/jpeg-9f/jctrans.c diff --git a/vendor/jpeg-9e/jdapimin.c b/vendor/jpeg-9f/jdapimin.c similarity index 100% rename from vendor/jpeg-9e/jdapimin.c rename to vendor/jpeg-9f/jdapimin.c diff --git a/vendor/jpeg-9e/jdapistd.c b/vendor/jpeg-9f/jdapistd.c similarity index 100% rename from vendor/jpeg-9e/jdapistd.c rename to vendor/jpeg-9f/jdapistd.c diff --git a/vendor/jpeg-9e/jdarith.c b/vendor/jpeg-9f/jdarith.c similarity index 100% rename from vendor/jpeg-9e/jdarith.c rename to vendor/jpeg-9f/jdarith.c diff --git a/vendor/jpeg-9e/jdatadst.c b/vendor/jpeg-9f/jdatadst.c similarity index 95% rename from vendor/jpeg-9e/jdatadst.c rename to vendor/jpeg-9f/jdatadst.c index 75ebd7c22d..b3b4798ea4 100644 --- a/vendor/jpeg-9e/jdatadst.c +++ b/vendor/jpeg-9f/jdatadst.c @@ -2,7 +2,7 @@ * jdatadst.c * * Copyright (C) 1994-1996, Thomas G. Lane. - * Modified 2009-2019 by Guido Vollbeding. + * Modified 2009-2022 by Guido Vollbeding. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -28,17 +28,17 @@ extern void free JPP((void *ptr)); /* Expanded data destination object for stdio output */ +#define OUTPUT_BUF_SIZE 4096 /* choose an efficiently fwrite'able size */ + typedef struct { struct jpeg_destination_mgr pub; /* public fields */ FILE * outfile; /* target stream */ - JOCTET * buffer; /* start of buffer */ + JOCTET buffer[OUTPUT_BUF_SIZE]; /* output buffer */ } my_destination_mgr; typedef my_destination_mgr * my_dest_ptr; -#define OUTPUT_BUF_SIZE 4096 /* choose an efficiently fwrite'able size */ - /* Expanded data destination object for memory output */ @@ -65,10 +65,6 @@ init_destination (j_compress_ptr cinfo) { my_dest_ptr dest = (my_dest_ptr) cinfo->dest; - /* Allocate the output buffer --- it will be released when done with image */ - dest->buffer = (JOCTET *) (*cinfo->mem->alloc_small) - ((j_common_ptr) cinfo, JPOOL_IMAGE, OUTPUT_BUF_SIZE * SIZEOF(JOCTET)); - dest->pub.next_output_byte = dest->buffer; dest->pub.free_in_buffer = OUTPUT_BUF_SIZE; } @@ -187,8 +183,8 @@ term_mem_destination (j_compress_ptr cinfo) /* * Prepare for output to a stdio stream. - * The caller must have already opened the stream, and is responsible - * for closing it after finishing compression. + * The caller must have already opened the stream, + * and is responsible for closing it after finishing compression. */ GLOBAL(void) diff --git a/vendor/jpeg-9e/jdatasrc.c b/vendor/jpeg-9f/jdatasrc.c similarity index 92% rename from vendor/jpeg-9e/jdatasrc.c rename to vendor/jpeg-9f/jdatasrc.c index 606ae11b4c..fd7a1a594b 100644 --- a/vendor/jpeg-9e/jdatasrc.c +++ b/vendor/jpeg-9f/jdatasrc.c @@ -2,7 +2,7 @@ * jdatasrc.c * * Copyright (C) 1994-1996, Thomas G. Lane. - * Modified 2009-2019 by Guido Vollbeding. + * Modified 2009-2022 by Guido Vollbeding. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -23,18 +23,18 @@ /* Expanded data source object for stdio input */ +#define INPUT_BUF_SIZE 4096 /* choose an efficiently fread'able size */ + typedef struct { struct jpeg_source_mgr pub; /* public fields */ FILE * infile; /* source stream */ - JOCTET * buffer; /* start of buffer */ + JOCTET buffer[INPUT_BUF_SIZE]; /* input buffer */ boolean start_of_file; /* have we gotten any data yet? */ } my_source_mgr; typedef my_source_mgr * my_src_ptr; -#define INPUT_BUF_SIZE 4096 /* choose an efficiently fread'able size */ - /* * Initialize source --- called by jpeg_read_header @@ -204,8 +204,8 @@ term_source (j_decompress_ptr cinfo) /* * Prepare for input from a stdio stream. - * The caller must have already opened the stream, and is responsible - * for closing it after finishing decompression. + * The caller must have already opened the stream, + * and is responsible for closing it after finishing decompression. */ GLOBAL(void) @@ -213,19 +213,16 @@ jpeg_stdio_src (j_decompress_ptr cinfo, FILE * infile) { my_src_ptr src; - /* The source object and input buffer are made permanent so that a series - * of JPEG images can be read from the same file by calling jpeg_stdio_src - * only before the first one. (If we discarded the buffer at the end of - * one image, we'd likely lose the start of the next one.) + /* The source object including the input buffer is made permanent so that + * a series of JPEG images can be read from the same file by calling + * jpeg_stdio_src only before the first one. (If we discarded the buffer + * at the end of one image, we'd likely lose the start of the next one.) * This makes it unsafe to use this manager and a different source * manager serially with the same JPEG object. Caveat programmer. */ if (cinfo->src == NULL) { /* first time for this JPEG object? */ cinfo->src = (struct jpeg_source_mgr *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, SIZEOF(my_source_mgr)); - src = (my_src_ptr) cinfo->src; - src->buffer = (JOCTET *) (*cinfo->mem->alloc_small) - ((j_common_ptr) cinfo, JPOOL_PERMANENT, INPUT_BUF_SIZE * SIZEOF(JOCTET)); } src = (my_src_ptr) cinfo->src; diff --git a/vendor/jpeg-9e/jdcoefct.c b/vendor/jpeg-9f/jdcoefct.c similarity index 100% rename from vendor/jpeg-9e/jdcoefct.c rename to vendor/jpeg-9f/jdcoefct.c diff --git a/vendor/jpeg-9e/jdcolor.c b/vendor/jpeg-9f/jdcolor.c similarity index 91% rename from vendor/jpeg-9e/jdcolor.c rename to vendor/jpeg-9f/jdcolor.c index 7750df125a..6b40fb5340 100644 --- a/vendor/jpeg-9e/jdcolor.c +++ b/vendor/jpeg-9f/jdcolor.c @@ -2,7 +2,7 @@ * jdcolor.c * * Copyright (C) 1991-1997, Thomas G. Lane. - * Modified 2011-2020 by Guido Vollbeding. + * Modified 2011-2023 by Guido Vollbeding. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -32,7 +32,9 @@ typedef struct { INT32 * Cb_g_tab; /* => table for Cb to G conversion */ /* Private state for RGB->Y conversion */ - INT32 * rgb_y_tab; /* => table for RGB to Y conversion */ + INT32 * R_y_tab; /* => table for R to Y conversion */ + INT32 * G_y_tab; /* => table for G to Y conversion */ + INT32 * B_y_tab; /* => table for B to Y conversion */ } my_color_deconverter; typedef my_color_deconverter * my_cconvert_ptr; @@ -87,29 +89,17 @@ typedef my_color_deconverter * my_cconvert_ptr; * by precalculating the constants times Cb and Cr for all possible values. * For 8-bit JSAMPLEs this is very reasonable (only 256 entries per table); * for 9-bit to 12-bit samples it is still acceptable. It's not very - * reasonable for 16-bit samples, but if you want lossless storage you - * shouldn't be changing colorspace anyway. - * The Cr=>R and Cb=>B values can be rounded to integers in advance; the - * values for the G calculation are left scaled up, since we must add them - * together before rounding. + * reasonable for 16-bit samples, but if you want lossless storage + * you shouldn't be changing colorspace anyway. + * The Cr=>R and Cb=>B values can be rounded to integers in advance; + * the values for the G calculation are left scaled up, + * since we must add them together before rounding. */ #define SCALEBITS 16 /* speediest right-shift on some machines */ #define ONE_HALF ((INT32) 1 << (SCALEBITS-1)) #define FIX(x) ((INT32) ((x) * (1L<Y conversion and divide it up into - * three parts, instead of doing three alloc_small requests. This lets us - * use a single table base address, which can be held in a register in the - * inner loops on many machines (more than can hold all three addresses, - * anyway). - */ - -#define R_Y_OFF 0 /* offset to R => Y section */ -#define G_Y_OFF (1*(MAXJSAMPLE+1)) /* offset to G => Y section */ -#define B_Y_OFF (2*(MAXJSAMPLE+1)) /* etc. */ -#define TABLE_SIZE (3*(MAXJSAMPLE+1)) - /* * Initialize tables for YCbCr->RGB and BG_YCC->RGB colorspace conversion. @@ -249,17 +239,19 @@ LOCAL(void) build_rgb_y_table (j_decompress_ptr cinfo) { my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; - INT32 * rgb_y_tab; INT32 i; - /* Allocate and fill in the conversion tables. */ - cconvert->rgb_y_tab = rgb_y_tab = (INT32 *) (*cinfo->mem->alloc_small) - ((j_common_ptr) cinfo, JPOOL_IMAGE, TABLE_SIZE * SIZEOF(INT32)); + cconvert->R_y_tab = (INT32 *) (*cinfo->mem->alloc_small) + ((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE+1) * SIZEOF(INT32)); + cconvert->G_y_tab = (INT32 *) (*cinfo->mem->alloc_small) + ((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE+1) * SIZEOF(INT32)); + cconvert->B_y_tab = (INT32 *) (*cinfo->mem->alloc_small) + ((j_common_ptr) cinfo, JPOOL_IMAGE, (MAXJSAMPLE+1) * SIZEOF(INT32)); for (i = 0; i <= MAXJSAMPLE; i++) { - rgb_y_tab[i+R_Y_OFF] = FIX(0.299) * i; - rgb_y_tab[i+G_Y_OFF] = FIX(0.587) * i; - rgb_y_tab[i+B_Y_OFF] = FIX(0.114) * i + ONE_HALF; + cconvert->R_y_tab[i] = FIX(0.299) * i; + cconvert->G_y_tab[i] = FIX(0.587) * i; + cconvert->B_y_tab[i] = FIX(0.114) * i + ONE_HALF; } } @@ -274,8 +266,10 @@ rgb_gray_convert (j_decompress_ptr cinfo, JSAMPARRAY output_buf, int num_rows) { my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; - register int r, g, b; - register INT32 * ctab = cconvert->rgb_y_tab; + register INT32 y; + register INT32 * Rytab = cconvert->R_y_tab; + register INT32 * Gytab = cconvert->G_y_tab; + register INT32 * Bytab = cconvert->B_y_tab; register JSAMPROW outptr; register JSAMPROW inptr0, inptr1, inptr2; register JDIMENSION col; @@ -288,13 +282,10 @@ rgb_gray_convert (j_decompress_ptr cinfo, input_row++; outptr = *output_buf++; for (col = 0; col < num_cols; col++) { - r = GETJSAMPLE(inptr0[col]); - g = GETJSAMPLE(inptr1[col]); - b = GETJSAMPLE(inptr2[col]); - /* Y */ - outptr[col] = (JSAMPLE) - ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF]) - >> SCALEBITS); + y = Rytab[GETJSAMPLE(inptr0[col])]; + y += Gytab[GETJSAMPLE(inptr1[col])]; + y += Bytab[GETJSAMPLE(inptr2[col])]; + outptr[col] = (JSAMPLE) (y >> SCALEBITS); } } } @@ -354,7 +345,10 @@ rgb1_gray_convert (j_decompress_ptr cinfo, { my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; register int r, g, b; - register INT32 * ctab = cconvert->rgb_y_tab; + register INT32 y; + register INT32 * Rytab = cconvert->R_y_tab; + register INT32 * Gytab = cconvert->G_y_tab; + register INT32 * Bytab = cconvert->B_y_tab; register JSAMPROW outptr; register JSAMPROW inptr0, inptr1, inptr2; register JDIMENSION col; @@ -373,12 +367,10 @@ rgb1_gray_convert (j_decompress_ptr cinfo, /* Assume that MAXJSAMPLE+1 is a power of 2, so that the MOD * (modulo) operator is equivalent to the bitmask operator AND. */ - r = (r + g - CENTERJSAMPLE) & MAXJSAMPLE; - b = (b + g - CENTERJSAMPLE) & MAXJSAMPLE; - /* Y */ - outptr[col] = (JSAMPLE) - ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF]) - >> SCALEBITS); + y = Rytab[(r + g - CENTERJSAMPLE) & MAXJSAMPLE]; + y += Gytab[g]; + y += Bytab[(b + g - CENTERJSAMPLE) & MAXJSAMPLE]; + outptr[col] = (JSAMPLE) (y >> SCALEBITS); } } } @@ -565,8 +557,10 @@ cmyk_yk_convert (j_decompress_ptr cinfo, JSAMPARRAY output_buf, int num_rows) { my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; - register int r, g, b; - register INT32 * ctab = cconvert->rgb_y_tab; + register INT32 y; + register INT32 * Rytab = cconvert->R_y_tab; + register INT32 * Gytab = cconvert->G_y_tab; + register INT32 * Bytab = cconvert->B_y_tab; register JSAMPROW outptr; register JSAMPROW inptr0, inptr1, inptr2, inptr3; register JDIMENSION col; @@ -580,13 +574,10 @@ cmyk_yk_convert (j_decompress_ptr cinfo, input_row++; outptr = *output_buf++; for (col = 0; col < num_cols; col++) { - r = MAXJSAMPLE - GETJSAMPLE(inptr0[col]); - g = MAXJSAMPLE - GETJSAMPLE(inptr1[col]); - b = MAXJSAMPLE - GETJSAMPLE(inptr2[col]); - /* Y */ - outptr[0] = (JSAMPLE) - ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF]) - >> SCALEBITS); + y = Rytab[MAXJSAMPLE - GETJSAMPLE(inptr0[col])]; + y += Gytab[MAXJSAMPLE - GETJSAMPLE(inptr1[col])]; + y += Bytab[MAXJSAMPLE - GETJSAMPLE(inptr2[col])]; + outptr[0] = (JSAMPLE) (y >> SCALEBITS); /* K passes through unchanged */ outptr[1] = inptr3[col]; /* don't need GETJSAMPLE here */ outptr += 2; diff --git a/vendor/jpeg-9e/jdct.h b/vendor/jpeg-9f/jdct.h similarity index 99% rename from vendor/jpeg-9e/jdct.h rename to vendor/jpeg-9f/jdct.h index c8ec6cd90e..0f251590c4 100644 --- a/vendor/jpeg-9e/jdct.h +++ b/vendor/jpeg-9f/jdct.h @@ -2,7 +2,7 @@ * jdct.h * * Copyright (C) 1994-1996, Thomas G. Lane. - * Modified 2002-2019 by Guido Vollbeding. + * Modified 2002-2023 by Guido Vollbeding. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -158,7 +158,7 @@ typedef FAST_FLOAT FLOAT_MULT_TYPE; /* preferred floating type */ #define jpeg_idct_6x12 jRD6x12 #define jpeg_idct_5x10 jRD5x10 #define jpeg_idct_4x8 jRD4x8 -#define jpeg_idct_3x6 jRD3x8 +#define jpeg_idct_3x6 jRD3x6 #define jpeg_idct_2x4 jRD2x4 #define jpeg_idct_1x2 jRD1x2 #endif /* NEED_SHORT_EXTERNAL_NAMES */ diff --git a/vendor/jpeg-9e/jddctmgr.c b/vendor/jpeg-9f/jddctmgr.c similarity index 100% rename from vendor/jpeg-9e/jddctmgr.c rename to vendor/jpeg-9f/jddctmgr.c diff --git a/vendor/jpeg-9e/jdhuff.c b/vendor/jpeg-9f/jdhuff.c similarity index 100% rename from vendor/jpeg-9e/jdhuff.c rename to vendor/jpeg-9f/jdhuff.c diff --git a/vendor/jpeg-9e/jdinput.c b/vendor/jpeg-9f/jdinput.c similarity index 100% rename from vendor/jpeg-9e/jdinput.c rename to vendor/jpeg-9f/jdinput.c diff --git a/vendor/jpeg-9e/jdmainct.c b/vendor/jpeg-9f/jdmainct.c similarity index 100% rename from vendor/jpeg-9e/jdmainct.c rename to vendor/jpeg-9f/jdmainct.c diff --git a/vendor/jpeg-9e/jdmarker.c b/vendor/jpeg-9f/jdmarker.c similarity index 100% rename from vendor/jpeg-9e/jdmarker.c rename to vendor/jpeg-9f/jdmarker.c diff --git a/vendor/jpeg-9e/jdmaster.c b/vendor/jpeg-9f/jdmaster.c similarity index 100% rename from vendor/jpeg-9e/jdmaster.c rename to vendor/jpeg-9f/jdmaster.c diff --git a/vendor/jpeg-9e/jdmerge.c b/vendor/jpeg-9f/jdmerge.c similarity index 96% rename from vendor/jpeg-9e/jdmerge.c rename to vendor/jpeg-9f/jdmerge.c index 8ff13143af..0d16821bed 100644 --- a/vendor/jpeg-9e/jdmerge.c +++ b/vendor/jpeg-9f/jdmerge.c @@ -2,7 +2,7 @@ * jdmerge.c * * Copyright (C) 1994-1996, Thomas G. Lane. - * Modified 2013-2020 by Guido Vollbeding. + * Modified 2013-2022 by Guido Vollbeding. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -20,17 +20,17 @@ * B = Y + K4 * Cb * only the Y term varies among the group of pixels corresponding to a pair * of chroma samples, so the rest of the terms can be calculated just once. - * At typical sampling ratios, this eliminates half or three-quarters of the - * multiplications needed for color conversion. + * At typical sampling ratios, this eliminates half or three-quarters + * of the multiplications needed for color conversion. * * This file currently provides implementations for the following cases: * YCC => RGB color conversion only (YCbCr or BG_YCC). * Sampling ratios of 2h1v or 2h2v. * No scaling needed at upsample time. * Corner-aligned (non-CCIR601) sampling alignment. - * Other special cases could be added, but in most applications these are - * the only common cases. (For uncommon cases we fall back on the more - * general code in jdsample.c and jdcolor.c.) + * Other special cases could be added, but in most applications these + * are the only common cases. (For uncommon cases we fall back on + * the more general code in jdsample.c and jdcolor.c.) */ #define JPEG_INTERNALS @@ -286,9 +286,9 @@ h2v1_merged_upsample (j_decompress_ptr cinfo, /* Do the chroma part of the calculation */ cb = GETJSAMPLE(*inptr1++); cr = GETJSAMPLE(*inptr2++); - cred = Crrtab[cr]; cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); cblue = Cbbtab[cb]; + cred = Crrtab[cr]; /* Fetch 2 Y values and emit 2 pixels */ y = GETJSAMPLE(*inptr0++); outptr[RGB_RED] = range_limit[y + cred]; @@ -303,15 +303,14 @@ h2v1_merged_upsample (j_decompress_ptr cinfo, } /* If image width is odd, do the last output column separately */ if (cinfo->output_width & 1) { + y = GETJSAMPLE(*inptr0); cb = GETJSAMPLE(*inptr1); cr = GETJSAMPLE(*inptr2); - cred = Crrtab[cr]; - cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); - cblue = Cbbtab[cb]; - y = GETJSAMPLE(*inptr0); - outptr[RGB_RED] = range_limit[y + cred]; - outptr[RGB_GREEN] = range_limit[y + cgreen]; - outptr[RGB_BLUE] = range_limit[y + cblue]; + outptr[RGB_RED] = range_limit[y + Crrtab[cr]]; + outptr[RGB_GREEN] = range_limit[y + + ((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], + SCALEBITS))]; + outptr[RGB_BLUE] = range_limit[y + Cbbtab[cb]]; } } @@ -350,9 +349,9 @@ h2v2_merged_upsample (j_decompress_ptr cinfo, /* Do the chroma part of the calculation */ cb = GETJSAMPLE(*inptr1++); cr = GETJSAMPLE(*inptr2++); - cred = Crrtab[cr]; cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); cblue = Cbbtab[cb]; + cred = Crrtab[cr]; /* Fetch 4 Y values and emit 4 pixels */ y = GETJSAMPLE(*inptr00++); outptr0[RGB_RED] = range_limit[y + cred]; @@ -379,9 +378,9 @@ h2v2_merged_upsample (j_decompress_ptr cinfo, if (cinfo->output_width & 1) { cb = GETJSAMPLE(*inptr1); cr = GETJSAMPLE(*inptr2); - cred = Crrtab[cr]; cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS); cblue = Cbbtab[cb]; + cred = Crrtab[cr]; y = GETJSAMPLE(*inptr00); outptr0[RGB_RED] = range_limit[y + cred]; outptr0[RGB_GREEN] = range_limit[y + cgreen]; diff --git a/vendor/jpeg-9e/jdpostct.c b/vendor/jpeg-9f/jdpostct.c similarity index 100% rename from vendor/jpeg-9e/jdpostct.c rename to vendor/jpeg-9f/jdpostct.c diff --git a/vendor/jpeg-9e/jdsample.c b/vendor/jpeg-9f/jdsample.c similarity index 100% rename from vendor/jpeg-9e/jdsample.c rename to vendor/jpeg-9f/jdsample.c diff --git a/vendor/jpeg-9e/jdtrans.c b/vendor/jpeg-9f/jdtrans.c similarity index 100% rename from vendor/jpeg-9e/jdtrans.c rename to vendor/jpeg-9f/jdtrans.c diff --git a/vendor/jpeg-9e/jerror.c b/vendor/jpeg-9f/jerror.c similarity index 100% rename from vendor/jpeg-9e/jerror.c rename to vendor/jpeg-9f/jerror.c diff --git a/vendor/jpeg-9e/jerror.h b/vendor/jpeg-9f/jerror.h similarity index 100% rename from vendor/jpeg-9e/jerror.h rename to vendor/jpeg-9f/jerror.h diff --git a/vendor/jpeg-9e/jfdctflt.c b/vendor/jpeg-9f/jfdctflt.c similarity index 100% rename from vendor/jpeg-9e/jfdctflt.c rename to vendor/jpeg-9f/jfdctflt.c diff --git a/vendor/jpeg-9e/jfdctfst.c b/vendor/jpeg-9f/jfdctfst.c similarity index 100% rename from vendor/jpeg-9e/jfdctfst.c rename to vendor/jpeg-9f/jfdctfst.c diff --git a/vendor/jpeg-9e/jfdctint.c b/vendor/jpeg-9f/jfdctint.c similarity index 100% rename from vendor/jpeg-9e/jfdctint.c rename to vendor/jpeg-9f/jfdctint.c diff --git a/vendor/jpeg-9e/jidctflt.c b/vendor/jpeg-9f/jidctflt.c similarity index 100% rename from vendor/jpeg-9e/jidctflt.c rename to vendor/jpeg-9f/jidctflt.c diff --git a/vendor/jpeg-9e/jidctfst.c b/vendor/jpeg-9f/jidctfst.c similarity index 100% rename from vendor/jpeg-9e/jidctfst.c rename to vendor/jpeg-9f/jidctfst.c diff --git a/vendor/jpeg-9e/jidctint.c b/vendor/jpeg-9f/jidctint.c similarity index 100% rename from vendor/jpeg-9e/jidctint.c rename to vendor/jpeg-9f/jidctint.c diff --git a/vendor/jpeg-9e/jinclude.h b/vendor/jpeg-9f/jinclude.h similarity index 57% rename from vendor/jpeg-9e/jinclude.h rename to vendor/jpeg-9f/jinclude.h index 20ed4ef11f..12ea8cd2fd 100644 --- a/vendor/jpeg-9e/jinclude.h +++ b/vendor/jpeg-9f/jinclude.h @@ -2,7 +2,7 @@ * jinclude.h * * Copyright (C) 1991-1994, Thomas G. Lane. - * Modified 2017 by Guido Vollbeding. + * Modified 2017-2022 by Guido Vollbeding. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -11,8 +11,8 @@ * care of by the standard jconfig symbols, but on really weird systems * you may have to edit this file.) * - * NOTE: this file is NOT intended to be included by applications using the - * JPEG library. Most applications need only include jpeglib.h. + * NOTE: this file is NOT intended to be included by applications using + * the JPEG library. Most applications need only include jpeglib.h. */ @@ -87,11 +87,71 @@ * * Furthermore, macros are provided for fflush() and ferror() in order * to facilitate adaption by applications using an own FILE class. + * + * You can define your own custom file I/O functions in jconfig.h and + * #define JPEG_HAVE_FILE_IO_CUSTOM there to prevent redefinition here. + * + * You can #define JPEG_USE_FILE_IO_CUSTOM in jconfig.h to use custom file + * I/O functions implemented in Delphi VCL (Visual Component Library) + * in Vcl.Imaging.jpeg.pas for the TJPEGImage component utilizing + * the Delphi RTL (Run-Time Library) TMemoryStream component: + * + * procedure jpeg_stdio_src(var cinfo: jpeg_decompress_struct; + * input_file: TStream); external; + * + * procedure jpeg_stdio_dest(var cinfo: jpeg_compress_struct; + * output_file: TStream); external; + * + * function jfread(var buf; recsize, reccount: Integer; S: TStream): Integer; + * begin + * Result := S.Read(buf, recsize * reccount); + * end; + * + * function jfwrite(const buf; recsize, reccount: Integer; S: TStream): Integer; + * begin + * Result := S.Write(buf, recsize * reccount); + * end; + * + * function jfflush(S: TStream): Integer; + * begin + * Result := 0; + * end; + * + * function jferror(S: TStream): Integer; + * begin + * Result := 0; + * end; + * + * TMemoryStream of Delphi RTL has the distinctive feature to provide dynamic + * memory buffer management with a file/stream-based interface, particularly for + * the write (output) operation, which is easier to apply compared with direct + * implementations as given in jdatadst.c for memory destination. Those direct + * implementations of dynamic memory write tend to be more difficult to use, + * so providing an option like TMemoryStream may be a useful alternative. + * + * The CFile/CMemFile classes of the Microsoft Foundation Class (MFC) Library + * may be used in a similar fashion. */ +#ifndef JPEG_HAVE_FILE_IO_CUSTOM +#ifdef JPEG_USE_FILE_IO_CUSTOM +extern size_t jfread(void * __ptr, size_t __size, size_t __n, FILE * __stream); +extern size_t jfwrite(const void * __ptr, size_t __size, size_t __n, FILE * __stream); +extern int jfflush(FILE * __stream); +extern int jferror(FILE * __fp); + +#define JFREAD(file,buf,sizeofbuf) \ + ((size_t) jfread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file))) +#define JFWRITE(file,buf,sizeofbuf) \ + ((size_t) jfwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file))) +#define JFFLUSH(file) jfflush(file) +#define JFERROR(file) jferror(file) +#else #define JFREAD(file,buf,sizeofbuf) \ ((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file))) #define JFWRITE(file,buf,sizeofbuf) \ ((size_t) fwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file))) #define JFFLUSH(file) fflush(file) #define JFERROR(file) ferror(file) +#endif +#endif diff --git a/vendor/jpeg-9e/jmemansi.c b/vendor/jpeg-9f/jmemansi.c similarity index 100% rename from vendor/jpeg-9e/jmemansi.c rename to vendor/jpeg-9f/jmemansi.c diff --git a/vendor/jpeg-9e/jmemdos.c b/vendor/jpeg-9f/jmemdos.c similarity index 100% rename from vendor/jpeg-9e/jmemdos.c rename to vendor/jpeg-9f/jmemdos.c diff --git a/vendor/jpeg-9e/jmemmac.c b/vendor/jpeg-9f/jmemmac.c similarity index 100% rename from vendor/jpeg-9e/jmemmac.c rename to vendor/jpeg-9f/jmemmac.c diff --git a/vendor/jpeg-9e/jmemmgr.c b/vendor/jpeg-9f/jmemmgr.c similarity index 100% rename from vendor/jpeg-9e/jmemmgr.c rename to vendor/jpeg-9f/jmemmgr.c diff --git a/vendor/jpeg-9e/jmemname.c b/vendor/jpeg-9f/jmemname.c similarity index 100% rename from vendor/jpeg-9e/jmemname.c rename to vendor/jpeg-9f/jmemname.c diff --git a/vendor/jpeg-9e/jmemnobs.c b/vendor/jpeg-9f/jmemnobs.c similarity index 100% rename from vendor/jpeg-9e/jmemnobs.c rename to vendor/jpeg-9f/jmemnobs.c diff --git a/vendor/jpeg-9e/jmemsys.h b/vendor/jpeg-9f/jmemsys.h similarity index 100% rename from vendor/jpeg-9e/jmemsys.h rename to vendor/jpeg-9f/jmemsys.h diff --git a/vendor/jpeg-9e/jmorecfg.h b/vendor/jpeg-9f/jmorecfg.h similarity index 94% rename from vendor/jpeg-9e/jmorecfg.h rename to vendor/jpeg-9f/jmorecfg.h index 679d68bdc5..4638d6af2d 100644 --- a/vendor/jpeg-9e/jmorecfg.h +++ b/vendor/jpeg-9f/jmorecfg.h @@ -2,7 +2,7 @@ * jmorecfg.h * * Copyright (C) 1991-1997, Thomas G. Lane. - * Modified 1997-2013 by Guido Vollbeding. + * Modified 1997-2022 by Guido Vollbeding. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -351,8 +351,8 @@ typedef enum { FALSE = 0, TRUE = 1 } boolean; #define C_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */ #define C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */ -#define C_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/ -#define DCT_SCALING_SUPPORTED /* Input rescaling via DCT? (Requires DCT_ISLOW)*/ +#define C_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN) */ +#define DCT_SCALING_SUPPORTED /* Input rescaling via DCT? (Requires DCT_ISLOW) */ #define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parms? */ /* Note: if you selected more than 8-bit data precision, it is dangerous to * turn off ENTROPY_OPT_SUPPORTED. The standard Huffman tables are only @@ -369,8 +369,8 @@ typedef enum { FALSE = 0, TRUE = 1 } boolean; #define D_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */ #define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */ -#define D_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/ -#define IDCT_SCALING_SUPPORTED /* Output rescaling via IDCT? (Requires DCT_ISLOW)*/ +#define D_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN) */ +#define IDCT_SCALING_SUPPORTED /* Output rescaling via IDCT? (Requires DCT_ISLOW) */ #define SAVE_MARKERS_SUPPORTED /* jpeg_save_markers() needed? */ #define BLOCK_SMOOTHING_SUPPORTED /* Block smoothing? (Progressive only) */ #undef UPSAMPLE_SCALING_SUPPORTED /* Output rescaling at upsample stage? */ @@ -384,20 +384,31 @@ typedef enum { FALSE = 0, TRUE = 1 } boolean; /* * Ordering of RGB data in scanlines passed to or from the application. * If your application wants to deal with data in the order B,G,R, just - * change these macros. You can also deal with formats such as R,G,B,X - * (one extra byte per pixel) by changing RGB_PIXELSIZE. Note that changing - * the offsets will also change the order in which colormap data is organized. + * #define JPEG_USE_RGB_CUSTOM in jconfig.h, or define your own custom + * order in jconfig.h and #define JPEG_HAVE_RGB_CUSTOM. + * You can also deal with formats such as R,G,B,X (one extra byte per pixel) + * by changing RGB_PIXELSIZE. + * Note that changing the offsets will also change + * the order in which colormap data is organized. * RESTRICTIONS: * 1. The sample applications cjpeg,djpeg do NOT support modified RGB formats. * 2. The color quantizer modules will not behave desirably if RGB_PIXELSIZE - * is not 3 (they don't understand about dummy color components!). So you - * can't use color quantization if you change that value. + * is not 3 (they don't understand about dummy color components!). + * So you can't use color quantization if you change that value. */ +#ifndef JPEG_HAVE_RGB_CUSTOM +#ifdef JPEG_USE_RGB_CUSTOM +#define RGB_RED 2 /* Offset of Red in an RGB scanline element */ +#define RGB_GREEN 1 /* Offset of Green */ +#define RGB_BLUE 0 /* Offset of Blue */ +#else #define RGB_RED 0 /* Offset of Red in an RGB scanline element */ #define RGB_GREEN 1 /* Offset of Green */ #define RGB_BLUE 2 /* Offset of Blue */ +#endif #define RGB_PIXELSIZE 3 /* JSAMPLEs per RGB scanline element */ +#endif /* Definitions for speed-related optimizations. */ diff --git a/vendor/jpeg-9e/jpegint.h b/vendor/jpeg-9f/jpegint.h similarity index 100% rename from vendor/jpeg-9e/jpegint.h rename to vendor/jpeg-9f/jpegint.h diff --git a/vendor/jpeg-9e/jpeglib.h b/vendor/jpeg-9f/jpeglib.h similarity index 99% rename from vendor/jpeg-9e/jpeglib.h rename to vendor/jpeg-9f/jpeglib.h index b1fa8ea9ad..e7e15ab2cd 100644 --- a/vendor/jpeg-9e/jpeglib.h +++ b/vendor/jpeg-9f/jpeglib.h @@ -2,7 +2,7 @@ * jpeglib.h * * Copyright (C) 1991-1998, Thomas G. Lane. - * Modified 2002-2020 by Guido Vollbeding. + * Modified 2002-2022 by Guido Vollbeding. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -39,7 +39,7 @@ extern "C" { #define JPEG_LIB_VERSION 90 /* Compatibility version 9.0 */ #define JPEG_LIB_VERSION_MAJOR 9 -#define JPEG_LIB_VERSION_MINOR 5 +#define JPEG_LIB_VERSION_MINOR 6 /* Various constants determining the sizes of things. diff --git a/vendor/jpeg-9e/jpegtran.c b/vendor/jpeg-9f/jpegtran.c similarity index 100% rename from vendor/jpeg-9e/jpegtran.c rename to vendor/jpeg-9f/jpegtran.c diff --git a/vendor/jpeg-9e/jquant1.c b/vendor/jpeg-9f/jquant1.c similarity index 100% rename from vendor/jpeg-9e/jquant1.c rename to vendor/jpeg-9f/jquant1.c diff --git a/vendor/jpeg-9e/jquant2.c b/vendor/jpeg-9f/jquant2.c similarity index 100% rename from vendor/jpeg-9e/jquant2.c rename to vendor/jpeg-9f/jquant2.c diff --git a/vendor/jpeg-9e/jutils.c b/vendor/jpeg-9f/jutils.c similarity index 100% rename from vendor/jpeg-9e/jutils.c rename to vendor/jpeg-9f/jutils.c diff --git a/vendor/jpeg-9e/jversion.h b/vendor/jpeg-9f/jversion.h similarity index 59% rename from vendor/jpeg-9e/jversion.h rename to vendor/jpeg-9f/jversion.h index 17134b7a5b..df53ef5e55 100644 --- a/vendor/jpeg-9e/jversion.h +++ b/vendor/jpeg-9f/jversion.h @@ -1,7 +1,7 @@ /* * jversion.h * - * Copyright (C) 1991-2022, Thomas G. Lane, Guido Vollbeding. + * Copyright (C) 1991-2024, Thomas G. Lane, Guido Vollbeding. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -9,6 +9,6 @@ */ -#define JVERSION "9e 16-Jan-2022" +#define JVERSION "9f 14-Jan-2024" -#define JCOPYRIGHT "Copyright (C) 2022, Thomas G. Lane, Guido Vollbeding" +#define JCOPYRIGHT "Copyright (C) 2024, Thomas G. Lane, Guido Vollbeding" diff --git a/vendor/jpeg-9e/premake5.lua b/vendor/jpeg-9f/premake5.lua similarity index 100% rename from vendor/jpeg-9e/premake5.lua rename to vendor/jpeg-9f/premake5.lua diff --git a/vendor/jpeg-9e/rdbmp.c b/vendor/jpeg-9f/rdbmp.c similarity index 100% rename from vendor/jpeg-9e/rdbmp.c rename to vendor/jpeg-9f/rdbmp.c diff --git a/vendor/jpeg-9e/rdcolmap.c b/vendor/jpeg-9f/rdcolmap.c similarity index 100% rename from vendor/jpeg-9e/rdcolmap.c rename to vendor/jpeg-9f/rdcolmap.c diff --git a/vendor/jpeg-9e/rdgif.c b/vendor/jpeg-9f/rdgif.c similarity index 100% rename from vendor/jpeg-9e/rdgif.c rename to vendor/jpeg-9f/rdgif.c diff --git a/vendor/jpeg-9e/rdjpgcom.c b/vendor/jpeg-9f/rdjpgcom.c similarity index 100% rename from vendor/jpeg-9e/rdjpgcom.c rename to vendor/jpeg-9f/rdjpgcom.c diff --git a/vendor/jpeg-9e/rdppm.c b/vendor/jpeg-9f/rdppm.c similarity index 100% rename from vendor/jpeg-9e/rdppm.c rename to vendor/jpeg-9f/rdppm.c diff --git a/vendor/jpeg-9e/rdrle.c b/vendor/jpeg-9f/rdrle.c similarity index 100% rename from vendor/jpeg-9e/rdrle.c rename to vendor/jpeg-9f/rdrle.c diff --git a/vendor/jpeg-9e/rdswitch.c b/vendor/jpeg-9f/rdswitch.c similarity index 100% rename from vendor/jpeg-9e/rdswitch.c rename to vendor/jpeg-9f/rdswitch.c diff --git a/vendor/jpeg-9e/rdtarga.c b/vendor/jpeg-9f/rdtarga.c similarity index 100% rename from vendor/jpeg-9e/rdtarga.c rename to vendor/jpeg-9f/rdtarga.c diff --git a/vendor/jpeg-9e/transupp.c b/vendor/jpeg-9f/transupp.c similarity index 99% rename from vendor/jpeg-9e/transupp.c rename to vendor/jpeg-9f/transupp.c index 6d7d090234..6518936a0d 100644 --- a/vendor/jpeg-9e/transupp.c +++ b/vendor/jpeg-9f/transupp.c @@ -1,7 +1,7 @@ /* * transupp.c * - * Copyright (C) 1997-2019, Thomas G. Lane, Guido Vollbeding. + * Copyright (C) 1997-2023, Thomas G. Lane, Guido Vollbeding. * This file is part of the Independent JPEG Group's software. * For conditions of distribution and use, see the accompanying README file. * @@ -195,12 +195,11 @@ requant_comp (j_decompress_ptr cinfo, jpeg_component_info *compptr, jvirt_barray_ptr coef_array, JQUANT_TBL *qtblptr1) { JDIMENSION blk_x, blk_y; - int offset_y, k; + int offset_y, k, temp, qval; JQUANT_TBL *qtblptr; JBLOCKARRAY buffer; JBLOCKROW block; JCOEFPTR ptr; - JCOEF temp, qval; qtblptr = compptr->quant_table; for (blk_y = 0; blk_y < compptr->height_in_blocks; @@ -213,27 +212,27 @@ requant_comp (j_decompress_ptr cinfo, jpeg_component_info *compptr, for (blk_x = 0; blk_x < compptr->width_in_blocks; blk_x++) { ptr = block[blk_x]; for (k = 0; k < DCTSIZE2; k++) { - temp = qtblptr->quantval[k]; qval = qtblptr1->quantval[k]; - if (temp != qval) { - temp *= ptr[k]; - /* The following quantization code is a copy from jcdctmgr.c */ + if (qval == 0) continue; + temp = qtblptr->quantval[k]; + if (temp == qval) continue; + temp *= ptr[k]; + /* The following quantization code is a copy from jcdctmgr.c */ #ifdef FAST_DIVIDE #define DIVIDE_BY(a,b) a /= b #else #define DIVIDE_BY(a,b) if (a >= b) a /= b; else a = 0 #endif - if (temp < 0) { - temp = -temp; - temp += qval>>1; /* for rounding */ - DIVIDE_BY(temp, qval); - temp = -temp; - } else { - temp += qval>>1; /* for rounding */ - DIVIDE_BY(temp, qval); - } - ptr[k] = temp; + if (temp < 0) { + temp = -temp; + temp += qval>>1; /* for rounding */ + DIVIDE_BY(temp, qval); + temp = -temp; + } else { + temp += qval>>1; /* for rounding */ + DIVIDE_BY(temp, qval); } + ptr[k] = (JCOEF) temp; } } } @@ -248,11 +247,11 @@ largest_common_denominator(JCOEF a, JCOEF b) { JCOEF c; - do { + while (b) { c = a % b; a = b; b = c; - } while (c); + } return a; } diff --git a/vendor/jpeg-9e/transupp.h b/vendor/jpeg-9f/transupp.h similarity index 100% rename from vendor/jpeg-9e/transupp.h rename to vendor/jpeg-9f/transupp.h diff --git a/vendor/jpeg-9e/wrbmp.c b/vendor/jpeg-9f/wrbmp.c similarity index 100% rename from vendor/jpeg-9e/wrbmp.c rename to vendor/jpeg-9f/wrbmp.c diff --git a/vendor/jpeg-9e/wrgif.c b/vendor/jpeg-9f/wrgif.c similarity index 100% rename from vendor/jpeg-9e/wrgif.c rename to vendor/jpeg-9f/wrgif.c diff --git a/vendor/jpeg-9e/wrjpgcom.c b/vendor/jpeg-9f/wrjpgcom.c similarity index 100% rename from vendor/jpeg-9e/wrjpgcom.c rename to vendor/jpeg-9f/wrjpgcom.c diff --git a/vendor/jpeg-9e/wrppm.c b/vendor/jpeg-9f/wrppm.c similarity index 100% rename from vendor/jpeg-9e/wrppm.c rename to vendor/jpeg-9f/wrppm.c diff --git a/vendor/jpeg-9e/wrrle.c b/vendor/jpeg-9f/wrrle.c similarity index 100% rename from vendor/jpeg-9e/wrrle.c rename to vendor/jpeg-9f/wrrle.c diff --git a/vendor/jpeg-9e/wrtarga.c b/vendor/jpeg-9f/wrtarga.c similarity index 100% rename from vendor/jpeg-9e/wrtarga.c rename to vendor/jpeg-9f/wrtarga.c diff --git a/vendor/libspeex/libspeex/_kiss_fft_guts.h b/vendor/libspeex/libspeex/_kiss_fft_guts.h index 6571e79c0c..f5f2a5fd76 100644 --- a/vendor/libspeex/libspeex/_kiss_fft_guts.h +++ b/vendor/libspeex/libspeex/_kiss_fft_guts.h @@ -23,7 +23,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND #include "math_approx.h" #define MAXFACTORS 32 -/* e.g. an fft of length 128 has 4 factors +/* e.g. an fft of length 128 has 4 factors as far as kissfft is concerned 4*4*4*2 */ @@ -47,7 +47,7 @@ struct kiss_fft_state{ #ifdef FIXED_POINT #include "arch.h" # define FRACBITS 15 -# define SAMPPROD spx_int32_t +# define SAMPPROD spx_int32_t #define SAMP_MAX 32767 #define SAMP_MIN -SAMP_MAX diff --git a/vendor/libspeex/libspeex/arch.h b/vendor/libspeex/libspeex/arch.h index 291cab828c..807469ddb2 100644 --- a/vendor/libspeex/libspeex/arch.h +++ b/vendor/libspeex/libspeex/arch.h @@ -7,18 +7,18 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + - Neither the name of the Xiph.org Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -37,10 +37,10 @@ #ifndef SPEEX_VERSION #define SPEEX_MAJOR_VERSION 1 /**< Major Speex version. */ -#define SPEEX_MINOR_VERSION 1 /**< Minor Speex version. */ -#define SPEEX_MICRO_VERSION 16 /**< Micro Speex version. */ +#define SPEEX_MINOR_VERSION 2 /**< Minor Speex version. */ +#define SPEEX_MICRO_VERSION 1 /**< Micro Speex version. */ #define SPEEX_EXTRA_VERSION "" /**< Extra Speex version. */ -#define SPEEX_VERSION "speex-1.2.0" /**< Speex version string. */ +#define SPEEX_VERSION "speex-1.2.1" /**< Speex version string. */ #endif /* A couple test to catch stupid option combinations */ @@ -215,11 +215,11 @@ typedef float spx_word32_t; #if defined (CONFIG_TI_C54X) || defined (CONFIG_TI_C55X) /* 2 on TI C5x DSP */ -#define BYTES_PER_CHAR 2 +#define BYTES_PER_CHAR 2 #define BITS_PER_CHAR 16 #define LOG2_BITS_PER_CHAR 4 -#else +#else #define BYTES_PER_CHAR 1 #define BITS_PER_CHAR 8 diff --git a/vendor/libspeex/libspeex/bits.c b/vendor/libspeex/libspeex/bits.c index 2d782a2def..4f457af111 100644 --- a/vendor/libspeex/libspeex/bits.c +++ b/vendor/libspeex/libspeex/bits.c @@ -275,7 +275,7 @@ EXPORT int speex_bits_unpack_signed(SpeexBits *bits, int nbBits) /* If number is negative */ if (d>>(nbBits-1)) { - d |= (-1)<max_val) + max_val = in[i]; + if (-in[i]>max_val) + max_val = -in[i]; + } + shift=0; + while (max_val <= (bound>>1) && max_val != 0) + { + max_val <<= 1; + shift++; + } + for (i=0;i + +void *spx_fft_init(int size) +{ + struct drft_lookup *table; + table = speex_alloc(sizeof(struct drft_lookup)); + spx_drft_init((struct drft_lookup *)table, size); + return (void*)table; +} + +void spx_fft_destroy(void *table) +{ + spx_drft_clear(table); + speex_free(table); +} + +void spx_fft(void *table, float *in, float *out) +{ + if (in==out) + { + int i; + float scale = 1./((struct drft_lookup *)table)->n; + speex_warning("FFT should not be done in-place"); + for (i=0;i<((struct drft_lookup *)table)->n;i++) + out[i] = scale*in[i]; + } else { + int i; + float scale = 1./((struct drft_lookup *)table)->n; + for (i=0;i<((struct drft_lookup *)table)->n;i++) + out[i] = scale*in[i]; + } + spx_drft_forward((struct drft_lookup *)table, out); +} + +void spx_ifft(void *table, float *in, float *out) +{ + if (in==out) + { + speex_warning("FFT should not be done in-place"); + } else { + int i; + for (i=0;i<((struct drft_lookup *)table)->n;i++) + out[i] = in[i]; + } + spx_drft_backward((struct drft_lookup *)table, out); +} + +#elif defined(USE_INTEL_MKL) +#include + +struct mkl_config { + DFTI_DESCRIPTOR_HANDLE desc; + int N; +}; + +void *spx_fft_init(int size) +{ + struct mkl_config *table = (struct mkl_config *) speex_alloc(sizeof(struct mkl_config)); + table->N = size; + DftiCreateDescriptor(&table->desc, DFTI_SINGLE, DFTI_REAL, 1, size); + DftiSetValue(table->desc, DFTI_PACKED_FORMAT, DFTI_PACK_FORMAT); + DftiSetValue(table->desc, DFTI_PLACEMENT, DFTI_NOT_INPLACE); + DftiSetValue(table->desc, DFTI_FORWARD_SCALE, 1.0f / size); + DftiCommitDescriptor(table->desc); + return table; +} + +void spx_fft_destroy(void *table) +{ + struct mkl_config *t = (struct mkl_config *) table; + DftiFreeDescriptor(t->desc); + speex_free(table); +} + +void spx_fft(void *table, spx_word16_t *in, spx_word16_t *out) +{ + struct mkl_config *t = (struct mkl_config *) table; + DftiComputeForward(t->desc, in, out); +} + +void spx_ifft(void *table, spx_word16_t *in, spx_word16_t *out) +{ + struct mkl_config *t = (struct mkl_config *) table; + DftiComputeBackward(t->desc, in, out); +} + +#elif defined(USE_INTEL_IPP) + +#include + +struct ipp_fft_config +{ + IppsDFTSpec_R_32f *dftSpec; + Ipp8u *buffer; +}; + +void *spx_fft_init(int size) +{ + int bufferSize = 0; + int hint; + struct ipp_fft_config *table; + + table = (struct ipp_fft_config *)speex_alloc(sizeof(struct ipp_fft_config)); + + /* there appears to be no performance difference between ippAlgHintFast and + ippAlgHintAccurate when using the with the floating point version + of the fft. */ + hint = ippAlgHintAccurate; + + ippsDFTInitAlloc_R_32f(&table->dftSpec, size, IPP_FFT_DIV_FWD_BY_N, hint); + + ippsDFTGetBufSize_R_32f(table->dftSpec, &bufferSize); + table->buffer = ippsMalloc_8u(bufferSize); + + return table; +} + +void spx_fft_destroy(void *table) +{ + struct ipp_fft_config *t = (struct ipp_fft_config *)table; + ippsFree(t->buffer); + ippsDFTFree_R_32f(t->dftSpec); + speex_free(t); +} + +void spx_fft(void *table, spx_word16_t *in, spx_word16_t *out) +{ + struct ipp_fft_config *t = (struct ipp_fft_config *)table; + ippsDFTFwd_RToPack_32f(in, out, t->dftSpec, t->buffer); +} + +void spx_ifft(void *table, spx_word16_t *in, spx_word16_t *out) +{ + struct ipp_fft_config *t = (struct ipp_fft_config *)table; + ippsDFTInv_PackToR_32f(in, out, t->dftSpec, t->buffer); +} + +#elif defined(USE_GPL_FFTW3) + +#include + +struct fftw_config { + float *in; + float *out; + fftwf_plan fft; + fftwf_plan ifft; + int N; +}; + +void *spx_fft_init(int size) +{ + struct fftw_config *table = (struct fftw_config *) speex_alloc(sizeof(struct fftw_config)); + table->in = fftwf_malloc(sizeof(float) * (size+2)); + table->out = fftwf_malloc(sizeof(float) * (size+2)); + + table->fft = fftwf_plan_dft_r2c_1d(size, table->in, (fftwf_complex *) table->out, FFTW_PATIENT); + table->ifft = fftwf_plan_dft_c2r_1d(size, (fftwf_complex *) table->in, table->out, FFTW_PATIENT); + + table->N = size; + return table; +} + +void spx_fft_destroy(void *table) +{ + struct fftw_config *t = (struct fftw_config *) table; + fftwf_destroy_plan(t->fft); + fftwf_destroy_plan(t->ifft); + fftwf_free(t->in); + fftwf_free(t->out); + speex_free(table); +} + + +void spx_fft(void *table, spx_word16_t *in, spx_word16_t *out) +{ + int i; + struct fftw_config *t = (struct fftw_config *) table; + const int N = t->N; + float *iptr = t->in; + float *optr = t->out; + const float m = 1.0 / N; + for(i=0;ifft); + + out[0] = optr[0]; + for(i=1;iN; + float *iptr = t->in; + float *optr = t->out; + + iptr[0] = in[0]; + iptr[1] = 0.0f; + for(i=1;iifft); + + for(i=0;iforward = kiss_fftr_alloc(size,0,NULL,NULL); + table->backward = kiss_fftr_alloc(size,1,NULL,NULL); + table->N = size; + return table; +} + +void spx_fft_destroy(void *table) +{ + struct kiss_config *t = (struct kiss_config *)table; + kiss_fftr_free(t->forward); + kiss_fftr_free(t->backward); + speex_free(table); +} + +#ifdef FIXED_POINT + +void spx_fft(void *table, spx_word16_t *in, spx_word16_t *out) +{ + int shift; + struct kiss_config *t = (struct kiss_config *)table; + shift = maximize_range(in, in, 32000, t->N); + kiss_fftr2(t->forward, in, out); + renorm_range(in, in, shift, t->N); + renorm_range(out, out, shift, t->N); +} + +#else + +void spx_fft(void *table, spx_word16_t *in, spx_word16_t *out) +{ + int i; + float scale; + struct kiss_config *t = (struct kiss_config *)table; + scale = 1./t->N; + kiss_fftr2(t->forward, in, out); + for (i=0;iN;i++) + out[i] *= scale; +} +#endif + +void spx_ifft(void *table, spx_word16_t *in, spx_word16_t *out) +{ + struct kiss_config *t = (struct kiss_config *)table; + kiss_fftri2(t->backward, in, out); +} + + +#else + +#error No other FFT implemented + +#endif + + +#ifdef FIXED_POINT +/*#include "smallft.h"*/ + + +void spx_fft_float(void *table, float *in, float *out) +{ + int i; +#ifdef USE_SMALLFT + int N = ((struct drft_lookup *)table)->n; +#elif defined(USE_KISS_FFT) + int N = ((struct kiss_config *)table)->N; +#else +#endif +#ifdef VAR_ARRAYS + spx_word16_t _in[N]; + spx_word16_t _out[N]; +#else + spx_word16_t _in[MAX_FFT_SIZE]; + spx_word16_t _out[MAX_FFT_SIZE]; +#endif + for (i=0;iN); + scale = 1./((struct kiss_config *)table)->N; + for (i=0;i<((struct kiss_config *)table)->N;i++) + out[i] = scale*in[i]; + spx_drft_forward(&t, out); + spx_drft_clear(&t); + } +#endif +} + +void spx_ifft_float(void *table, float *in, float *out) +{ + int i; +#ifdef USE_SMALLFT + int N = ((struct drft_lookup *)table)->n; +#elif defined(USE_KISS_FFT) + int N = ((struct kiss_config *)table)->N; +#else +#endif +#ifdef VAR_ARRAYS + spx_word16_t _in[N]; + spx_word16_t _out[N]; +#else + spx_word16_t _in[MAX_FFT_SIZE]; + spx_word16_t _out[MAX_FFT_SIZE]; +#endif + for (i=0;iN); + for (i=0;i<((struct kiss_config *)table)->N;i++) + out[i] = in[i]; + spx_drft_backward(&t, out); + spx_drft_clear(&t); + } +#endif +} + +#else + +void spx_fft_float(void *table, float *in, float *out) +{ + spx_fft(table, in, out); +} +void spx_ifft_float(void *table, float *in, float *out) +{ + spx_ifft(table, in, out); +} + +#endif diff --git a/vendor/libspeex/libspeex/fftwrap.h b/vendor/libspeex/libspeex/fftwrap.h index dfaf489441..2c0742559c 100644 --- a/vendor/libspeex/libspeex/fftwrap.h +++ b/vendor/libspeex/libspeex/fftwrap.h @@ -1,23 +1,23 @@ -/* Copyright (C) 2005 Jean-Marc Valin +/* Copyright (C) 2005 Jean-Marc Valin File: fftwrap.h - Wrapper for various FFTs + Wrapper for various FFTs Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + - Neither the name of the Xiph.org Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR diff --git a/vendor/libspeex/libspeex/filters.h b/vendor/libspeex/libspeex/filters.h index df148510c3..455365a661 100644 --- a/vendor/libspeex/libspeex/filters.h +++ b/vendor/libspeex/libspeex/filters.h @@ -7,18 +7,18 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + - Neither the name of the Xiph.org Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR diff --git a/vendor/libspeex/libspeex/filters_arm4.h b/vendor/libspeex/libspeex/filters_arm4.h index 2c64625c30..ed5a4f1493 100644 --- a/vendor/libspeex/libspeex/filters_arm4.h +++ b/vendor/libspeex/libspeex/filters_arm4.h @@ -7,18 +7,18 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + - Neither the name of the Xiph.org Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -68,7 +68,7 @@ int normalize16(const spx_sig_t *x, spx_word16_t *y, spx_sig_t max_scale, int le sig_shift++; max_val >>= 1; } - + __asm__ __volatile__ ( ".normalize16loop%=: \n" diff --git a/vendor/libspeex/libspeex/filters_bfin.h b/vendor/libspeex/libspeex/filters_bfin.h index ccd57b9d1d..a9bc0d2bc6 100644 --- a/vendor/libspeex/libspeex/filters_bfin.h +++ b/vendor/libspeex/libspeex/filters_bfin.h @@ -7,18 +7,18 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + - Neither the name of the Xiph.org Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -39,7 +39,7 @@ int normalize16(const spx_sig_t *x, spx_word16_t *y, spx_sig_t max_scale, int le { spx_sig_t max_val=1; int sig_shift; - __asm__ + __asm__ ( "%0 = 0;\n\t" "I0 = %1;\n\t" @@ -62,7 +62,7 @@ int normalize16(const spx_sig_t *x, spx_word16_t *y, spx_sig_t max_scale, int le max_val >>= 1; } - __asm__ __volatile__ + __asm__ __volatile__ ( "I0 = %0;\n\t" "L0 = 0;\n\t" @@ -94,7 +94,7 @@ void filter_mem16(const spx_word16_t *_x, const spx_coef_t *num, const spx_coef_ ALLOC(xy2, (N+1), spx_word32_t); ALLOC(numden_a, (2*ord+2), spx_word32_t); - xy = xy2+1; + xy = xy2+1; numden = (spx_word16_t*) numden_a; for (i=0;i=(EXTEND32(1)<<(15+Q))) - fprintf (stderr, "MULT16_32_Q%d: second operand too large: %d %d in %s: line %d\n", Q, (int)a, (int)b, file, line); + fprintf (stderr, "MULT16_32_Q%d: second operand too large: %d %d in %s: line %d\n", Q, (int)a, (int)b, file, line); res = (((long long)a)*(long long)b) >> Q; if (!VERIFY_INT(res)) fprintf (stderr, "MULT16_32_Q%d: output is not int: %d*%d=%d in %s: line %d\n", Q, (int)a, (int)b,(int)res, file, line); @@ -296,7 +296,7 @@ static inline int MULT16_32_PX(int a, long long b, int Q) fprintf (stderr, "MULT16_32_P%d: inputs are not short+int: %d %d\n", Q, (int)a, (int)b); } if (ABS32(b)>=(EXTEND32(1)<<(15+Q))) - fprintf (stderr, "MULT16_32_Q%d: second operand too large: %d %d\n", Q, (int)a, (int)b); + fprintf (stderr, "MULT16_32_Q%d: second operand too large: %d %d\n", Q, (int)a, (int)b); res = ((((long long)a)*(long long)b) + ((EXTEND32(1)<>1))>> Q; if (!VERIFY_INT(res)) fprintf (stderr, "MULT16_32_P%d: output is not int: %d*%d=%d\n", Q, (int)a, (int)b,(int)res); @@ -323,7 +323,7 @@ static inline int SATURATE(int a, int b) return a; } -static inline int MULT16_16_Q11_32(int a, int b) +static inline int MULT16_16_Q11_32(int a, int b) { long long res; if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) @@ -337,7 +337,7 @@ static inline int MULT16_16_Q11_32(int a, int b) spx_mips+=3; return res; } -static inline short MULT16_16_Q13(int a, int b) +static inline short MULT16_16_Q13(int a, int b) { long long res; if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) @@ -351,7 +351,7 @@ static inline short MULT16_16_Q13(int a, int b) spx_mips+=3; return res; } -static inline short MULT16_16_Q14(int a, int b) +static inline short MULT16_16_Q14(int a, int b) { long long res; if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) @@ -365,7 +365,7 @@ static inline short MULT16_16_Q14(int a, int b) spx_mips+=3; return res; } -static inline short MULT16_16_Q15(int a, int b) +static inline short MULT16_16_Q15(int a, int b) { long long res; if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) @@ -382,7 +382,7 @@ static inline short MULT16_16_Q15(int a, int b) return res; } -static inline short MULT16_16_P13(int a, int b) +static inline short MULT16_16_P13(int a, int b) { long long res; if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) @@ -399,7 +399,7 @@ static inline short MULT16_16_P13(int a, int b) spx_mips+=4; return res; } -static inline short MULT16_16_P14(int a, int b) +static inline short MULT16_16_P14(int a, int b) { long long res; if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) @@ -416,7 +416,7 @@ static inline short MULT16_16_P14(int a, int b) spx_mips+=4; return res; } -static inline short MULT16_16_P15(int a, int b) +static inline short MULT16_16_P15(int a, int b) { long long res; if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) @@ -436,7 +436,7 @@ static inline short MULT16_16_P15(int a, int b) #define DIV32_16(a, b) _DIV32_16(a, b, __FILE__, __LINE__) -static inline int _DIV32_16(long long a, long long b, char *file, int line) +static inline int _DIV32_16(long long a, long long b, char *file, int line) { long long res; if (b==0) @@ -462,7 +462,7 @@ static inline int _DIV32_16(long long a, long long b, char *file, int line) } #define DIV32(a, b) _DIV32(a, b, __FILE__, __LINE__) -static inline int _DIV32(long long a, long long b, char *file, int line) +static inline int _DIV32(long long a, long long b, char *file, int line) { long long res; if (b==0) diff --git a/vendor/libspeex/libspeex/fixed_generic.h b/vendor/libspeex/libspeex/fixed_generic.h index 3fb096ed90..bb320e301e 100644 --- a/vendor/libspeex/libspeex/fixed_generic.h +++ b/vendor/libspeex/libspeex/fixed_generic.h @@ -7,18 +7,18 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + - Neither the name of the Xiph.org Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -43,9 +43,9 @@ #define EXTRACT16(x) ((spx_word16_t)(x)) #define EXTEND32(x) ((spx_word32_t)(x)) #define SHR16(a,shift) ((a) >> (shift)) -#define SHL16(a,shift) ((a) << (shift)) +#define SHL16(a,shift) ((spx_int16_t)((spx_uint16_t)(a) << (shift))) #define SHR32(a,shift) ((a) >> (shift)) -#define SHL32(a,shift) ((a) << (shift)) +#define SHL32(a,shift) ((spx_int32_t)((spx_uint32_t)(a) << (shift))) #define PSHR16(a,shift) (SHR16((a)+((1<<((shift))>>1)),shift)) #define PSHR32(a,shift) (SHR32((a)+((EXTEND32(1)<<((shift))>>1)),shift)) #define VSHR32(a, shift) (((shift)>0) ? SHR32(a, shift) : SHL32(a, -(shift))) @@ -53,7 +53,7 @@ #define SATURATE32(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x))) #define SHR(a,shift) ((a) >> (shift)) -#define SHL(a,shift) ((spx_word32_t)(a) << (shift)) +#define SHL(a,shift) ((spx_int32_t)((spx_uint32_t)(a) << (shift))) #define PSHR(a,shift) (SHR((a)+((EXTEND32(1)<<((shift))>>1)),shift)) #define SATURATE(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x))) diff --git a/vendor/libspeex/libspeex/kiss_fft.c b/vendor/libspeex/libspeex/kiss_fft.c index 285e557983..8dc9345428 100644 --- a/vendor/libspeex/libspeex/kiss_fft.c +++ b/vendor/libspeex/libspeex/kiss_fft.c @@ -23,7 +23,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND #include "os_support.h" /* The guts header contains all the multiplication and addition macros that are defined for - fixed or floating point complex numbers. It also delares the kf_ internal functions. + fixed or floating point complex numbers. It also declares the kf_ internal functions. */ static void kf_bfly2( diff --git a/vendor/libspeex/libspeex/kiss_fft.h b/vendor/libspeex/libspeex/kiss_fft.h index fa3f2c6042..bb19eadbd9 100644 --- a/vendor/libspeex/libspeex/kiss_fft.h +++ b/vendor/libspeex/libspeex/kiss_fft.h @@ -26,13 +26,13 @@ extern "C" { # include # define kiss_fft_scalar __m128 #define KISS_FFT_MALLOC(nbytes) memalign(16,nbytes) -#else +#else #define KISS_FFT_MALLOC speex_alloc -#endif +#endif #ifdef FIXED_POINT -#include "arch.h" +#include "arch.h" # define kiss_fft_scalar spx_int16_t #else # ifndef kiss_fft_scalar @@ -48,9 +48,9 @@ typedef struct { typedef struct kiss_fft_state* kiss_fft_cfg; -/* +/* * kiss_fft_alloc - * + * * Initialize a FFT (or IFFT) algorithm's cfg/state buffer. * * typical usage: kiss_fft_cfg mycfg=kiss_fft_alloc(1024,0,NULL,NULL); @@ -60,18 +60,18 @@ typedef struct kiss_fft_state* kiss_fft_cfg; * * If lenmem is NULL, then kiss_fft_alloc will allocate a cfg buffer using malloc. * The returned value should be free()d when done to avoid memory leaks. - * + * * The state can be placed in a user supplied buffer 'mem': * If lenmem is not NULL and mem is not NULL and *lenmem is large enough, * then the function places the cfg in mem and the size used in *lenmem * and returns mem. - * + * * If lenmem is not NULL and ( mem is NULL or *lenmem is not large enough), - * then the function returns NULL and places the minimum cfg + * then the function returns NULL and places the minimum cfg * buffer size in *lenmem. * */ -kiss_fft_cfg kiss_fft_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem); +kiss_fft_cfg kiss_fft_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem); /* * kiss_fft(cfg,in_out_buf) @@ -90,19 +90,19 @@ void kiss_fft(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout); * */ void kiss_fft_stride(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout,int fin_stride); -/* If kiss_fft_alloc allocated a buffer, it is one contiguous +/* If kiss_fft_alloc allocated a buffer, it is one contiguous buffer and can be simply free()d when no longer needed*/ #define kiss_fft_free speex_free /* - Cleans up some memory that gets managed internally. Not necessary to call, but it might clean up + Cleans up some memory that gets managed internally. Not necessary to call, but it might clean up your compiler output to call this before you exit. */ void kiss_fft_cleanup(void); - + #ifdef __cplusplus -} +} #endif #endif diff --git a/vendor/libspeex/libspeex/kiss_fftr.h b/vendor/libspeex/libspeex/kiss_fftr.h index 7bfb423340..8cfeda138a 100644 --- a/vendor/libspeex/libspeex/kiss_fftr.h +++ b/vendor/libspeex/libspeex/kiss_fftr.h @@ -6,13 +6,13 @@ extern "C" { #endif - -/* - + +/* + Real optimized version can save about 45% cpu time vs. complex fft of a real seq. - - + + */ typedef struct kiss_fftr_state *kiss_fftr_cfg; @@ -22,7 +22,7 @@ kiss_fftr_cfg kiss_fftr_alloc(int nfft,int inverse_fft,void * mem, size_t * lenm /* nfft must be even - If you don't care to allocate space, use mem = lenmem = NULL + If you don't care to allocate space, use mem = lenmem = NULL */ diff --git a/vendor/libspeex/libspeex/lpc.h b/vendor/libspeex/libspeex/lpc.h index 952ecdd933..8885471f8a 100644 --- a/vendor/libspeex/libspeex/lpc.h +++ b/vendor/libspeex/libspeex/lpc.h @@ -7,18 +7,18 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + - Neither the name of the Xiph.org Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR diff --git a/vendor/libspeex/libspeex/lpc_bfin.h b/vendor/libspeex/libspeex/lpc_bfin.h index d7d11c008e..d2e040656d 100644 --- a/vendor/libspeex/libspeex/lpc_bfin.h +++ b/vendor/libspeex/libspeex/lpc_bfin.h @@ -1,25 +1,25 @@ /* Copyright (C) 2005 Analog Devices */ /** @file lpc_bfin.h - @author Jean-Marc Valin + @author Jean-Marc Valin @brief Functions for LPC (Linear Prediction Coefficients) analysis (Blackfin version) */ /* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + - Neither the name of the Xiph.org Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -39,7 +39,7 @@ void _spx_autocorr( const spx_word16_t *x, /* in: [0...n-1] samples x */ spx_word16_t *ac, /* out: [0...lag-1] ac values */ -int lag, +int lag, int n ) { @@ -69,10 +69,10 @@ int n ac_shift--; ac0 <<= 1; } - + xs = x+lag-1; nshift = -shift; - __asm__ __volatile__ + __asm__ __volatile__ ( "P2 = %0;\n\t" "I0 = P2;\n\t" /* x in I0 */ @@ -102,7 +102,7 @@ int n "LOOP_END inner_prod%=;\n\t" "A0 = ASHIFT A0 by R4.L;\n\t" "A1 = ASHIFT A1 by R4.L;\n\t" - + "R2 = A0, R3 = A1;\n\t" "[P1--] = R2;\n\t" "[P1--] = R3;\n\t" @@ -118,7 +118,7 @@ int n d = ADD32(d,SHR32(MULT16_16(x[j],x[j]), shift)); } ac32[0] = d; - + for (i=0;i>>= 14;\n\t" - "R3 = R3 + R5;\n\t" - + "R3 = R3 + R5;\n\t" + "R0 = R2;\n\t" /* R0: b0 */ "R1 = 16384;\n\t" /* R1: b1 */ "LOOP cpe%= LC0 = %3;\n\t" "LOOP_BEGIN cpe%=;\n\t" - "P1 = R0;\n\t" + "P1 = R0;\n\t" "R0 = R2.L * R0.L (IS) || R5 = W[P0--] (X);\n\t" "R0 >>>= 13;\n\t" "R0 = R0 - R1;\n\t" diff --git a/vendor/libspeex/libspeex/ltp.h b/vendor/libspeex/libspeex/ltp.h index 95bb126997..28d25173e4 100644 --- a/vendor/libspeex/libspeex/ltp.h +++ b/vendor/libspeex/libspeex/ltp.h @@ -7,18 +7,18 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + - Neither the name of the Xiph.org Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR diff --git a/vendor/libspeex/libspeex/ltp_arm4.h b/vendor/libspeex/libspeex/ltp_arm4.h index cdb94e603a..18be0d126e 100644 --- a/vendor/libspeex/libspeex/ltp_arm4.h +++ b/vendor/libspeex/libspeex/ltp_arm4.h @@ -7,18 +7,18 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + - Neither the name of the Xiph.org Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -117,8 +117,8 @@ void pitch_xcorr(const spx_word16_t *_x, const spx_word16_t *_y, spx_word32_t *c "\tmul %6, %10, %2 \n" "\tldrsh %1, [%9], #2 \n" "\tmul %7, %10, %3 \n" - - + + "\tmla %4, %15, %2, %4 \n" "\tldrsh %2, [%9], #2 \n" "\tmla %5, %15, %3, %5 \n" diff --git a/vendor/libspeex/libspeex/ltp_bfin.h b/vendor/libspeex/libspeex/ltp_bfin.h index b7edd37aad..c2ba482112 100644 --- a/vendor/libspeex/libspeex/ltp_bfin.h +++ b/vendor/libspeex/libspeex/ltp_bfin.h @@ -8,18 +8,18 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + - Neither the name of the Xiph.org Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -118,35 +118,35 @@ static inline spx_word32_t compute_pitch_error(spx_word16_t *C, spx_word16_t *g, __asm__ __volatile__ ( "A0 = 0;\n\t" - + "R0 = W[%1++];\n\t" "R1.L = %2.L*%5.L (IS);\n\t" "A0 += R1.L*R0.L (IS) || R0 = W[%1++];\n\t" - + "R1.L = %3.L*%5.L (IS);\n\t" "A0 += R1.L*R0.L (IS) || R0 = W[%1++];\n\t" - + "R1.L = %4.L*%5.L (IS);\n\t" "A0 += R1.L*R0.L (IS) || R0 = W[%1++];\n\t" - + "R1.L = %2.L*%3.L (IS);\n\t" "A0 -= R1.L*R0.L (IS) || R0 = W[%1++];\n\t" "R1.L = %4.L*%3.L (IS);\n\t" "A0 -= R1.L*R0.L (IS) || R0 = W[%1++];\n\t" - + "R1.L = %4.L*%2.L (IS);\n\t" "A0 -= R1.L*R0.L (IS) || R0 = W[%1++];\n\t" - + "R1.L = %2.L*%2.L (IS);\n\t" "A0 -= R1.L*R0.L (IS) || R0 = W[%1++];\n\t" "R1.L = %3.L*%3.L (IS);\n\t" "A0 -= R1.L*R0.L (IS) || R0 = W[%1++];\n\t" - + "R1.L = %4.L*%4.L (IS);\n\t" "A0 -= R1.L*R0.L (IS);\n\t" - + "%0 = A0;\n\t" : "=&D" (sum), "=a" (C) : "d" (g[0]), "d" (g[1]), "d" (g[2]), "d" (pitch_control), "1" (C) @@ -203,7 +203,7 @@ void open_loop_nbest_pitch(spx_word16_t *sw, int start, int end, int len, int *p " R2 = MAX(R1,R3);\n\t" "eu2: [P0++] = R2;\n\t" : : "d" (energy), "d" (&sw[-start-1]), "d" (&sw[-start+len-1]), - "a" (end-start) + "a" (end-start) : "P0", "I1", "I2", "R0", "R1", "R2", "R3", "ASTAT" BFIN_HWLOOP1_REGS ); @@ -232,7 +232,7 @@ void open_loop_nbest_pitch(spx_word16_t *sw, int start, int end, int len, int *p " P0 = %4;\n\t" /* P0: best pitch */ " P1 = %4;\n\t" /* P1: counter */ " LSETUP (sl1, sl2) LC1 = %3;\n\t" -"sl1: R0.L = W [I0++] || R1.L = W [I1++];\n\t" +"sl1: R0.L = W [I0++] || R1.L = W [I1++];\n\t" " R0 = R0.L * R0.L (IS);\n\t" " R1 += 1;\n\t" " R4 = R0.L * R3.L;\n\t" @@ -244,7 +244,7 @@ void open_loop_nbest_pitch(spx_word16_t *sw, int start, int end, int len, int *p "sl2: P1 += 1;\n\t" " %0 = P0;\n\t" : "=&d" (pitch[0]) - : "a" (corr16), "a" (ener16), "a" (end+1-start), "d" (start) + : "a" (corr16), "a" (ener16), "a" (end+1-start), "d" (start) : "P0", "P1", "I0", "I1", "R0", "R1", "R2", "R3", "R4", "R5", "ASTAT", "CC" BFIN_HWLOOP1_REGS ); @@ -338,39 +338,39 @@ static int pitch_gain_search_3tap_vq( " R4 += 32;\n\t" " R4.H = 64;\n\t" /* R4.H: pitch_control */ -" R0 = B [P0++] (X);\n\t" +" R0 = B [P0++] (X);\n\t" " B0 = R0;\n\t" /* BO: gain_sum */ - + /* compute_pitch_error() -------------------------------*/ " I1 = %3;\n\t" /* I1: ptr to C */ " A0 = 0;\n\t" - + " R0.L = W[I1++];\n\t" " R1.L = R2.L*R4.H (IS);\n\t" " A0 += R1.L*R0.L (IS) || R0.L = W[I1++];\n\t" - + " R1.L = R3.L*R4.H (IS);\n\t" " A0 += R1.L*R0.L (IS) || R0.L = W[I1++];\n\t" - + " R1.L = R4.L*R4.H (IS);\n\t" " A0 += R1.L*R0.L (IS) || R0.L = W[I1++];\n\t" - + " R1.L = R2.L*R3.L (IS);\n\t" " A0 -= R1.L*R0.L (IS) || R0.L = W[I1++];\n\t" " R1.L = R4.L*R3.L (IS);\n\t" " A0 -= R1.L*R0.L (IS) || R0.L = W[I1++];\n\t" - + " R1.L = R4.L*R2.L (IS);\n\t" " A0 -= R1.L*R0.L (IS) || R0.L = W[I1++];\n\t" - + " R1.L = R2.L*R2.L (IS);\n\t" " A0 -= R1.L*R0.L (IS) || R0.L = W[I1++];\n\t" " R1.L = R3.L*R3.L (IS);\n\t" " A0 -= R1.L*R0.L (IS) || R0.L = W[I1++];\n\t" - + " R1.L = R4.L*R4.L (IS);\n\t" " R0 = (A0 -= R1.L*R0.L) (IS);\n\t" @@ -393,18 +393,18 @@ static int pitch_gain_search_3tap_vq( " R1 = B0\n\t" " R2 = %5\n\t" " R3 = %6\n\t" -" cc = R2 <= R1;\n\t" +" cc = R2 <= R1;\n\t" " if cc R0 = R3;\n\t" " cc = %0 <= R0;\n\t" " if cc %0 = R0;\n\t" " if cc %1 = P1;\n\t" "pgs2: P1 += 1;\n\t" - - : "=&d" (best_sum), "=&d" (best_cdbk) + + : "=&d" (best_sum), "=&d" (best_cdbk) : "a" (gain_cdbk), "a" (C16), "a" (gain_cdbk_size), "a" (max_gain), "b" (-VERY_LARGE32) - : "R0", "R1", "R2", "R3", "R4", "P0", + : "R0", "R1", "R2", "R3", "R4", "P0", "P1", "I1", "L1", "A0", "B0", "CC", "ASTAT" BFIN_HWLOOP1_REGS ); diff --git a/vendor/libspeex/libspeex/ltp_sse.h b/vendor/libspeex/libspeex/ltp_sse.h index bed6eaac9a..326000831b 100644 --- a/vendor/libspeex/libspeex/ltp_sse.h +++ b/vendor/libspeex/libspeex/ltp_sse.h @@ -7,18 +7,18 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + - Neither the name of the Xiph.org Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR diff --git a/vendor/libspeex/libspeex/math_approx.h b/vendor/libspeex/libspeex/math_approx.h index 9ca830755d..2c0e115e2e 100644 --- a/vendor/libspeex/libspeex/math_approx.h +++ b/vendor/libspeex/libspeex/math_approx.h @@ -7,18 +7,18 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + - Neither the name of the Xiph.org Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -46,7 +46,7 @@ #define spx_atan atan /** Generate a pseudo-random number */ -static inline spx_word16_t speex_rand(spx_word16_t std, spx_int32_t *seed) +static inline spx_word16_t speex_rand(spx_word16_t std, spx_uint32_t *seed) { const unsigned int jflone = 0x3f800000; const unsigned int jflmsk = 0x007fffff; @@ -119,7 +119,7 @@ static inline spx_int16_t spx_ilog4(spx_uint32_t x) #ifdef FIXED_POINT /** Generate a pseudo-random number */ -static inline spx_word16_t speex_rand(spx_word16_t std, spx_int32_t *seed) +static inline spx_word16_t speex_rand(spx_word16_t std, spx_uint32_t *seed) { spx_word32_t res; *seed = 1664525 * *seed + 1013904223; @@ -168,11 +168,11 @@ static inline spx_word16_t spx_acos(spx_word16_t x) x = NEG16(x); } x = SUB16(16384,x); - + x = x >> 1; sq = MULT16_16_Q13(x, ADD16(A1, MULT16_16_Q13(x, ADD16(A2, MULT16_16_Q13(x, (A3)))))); ret = spx_sqrt(SHL32(EXTEND32(sq),13)); - + /*ret = spx_sqrt(67108864*(-1.6129e-04 + 2.0104e+00*f + 2.7373e-01*f*f + 1.8136e-01*f*f*f));*/ if (s) ret = SUB16(25736,ret); @@ -208,7 +208,7 @@ static inline spx_word16_t spx_cos(spx_word16_t x) static inline spx_word16_t _spx_cos_pi_2(spx_word16_t x) { spx_word16_t x2; - + x2 = MULT16_16_P15(x,x); return ADD16(1,MIN16(32766,ADD32(SUB16(L1,x2), MULT16_16_P15(x2, ADD32(L2, MULT16_16_P15(x2, ADD32(L3, MULT16_16_P15(L4, x2)))))))); } diff --git a/vendor/libspeex/libspeex/misc_bfin.h b/vendor/libspeex/libspeex/misc_bfin.h index 3c8c09d236..4e27681c95 100644 --- a/vendor/libspeex/libspeex/misc_bfin.h +++ b/vendor/libspeex/libspeex/misc_bfin.h @@ -1,25 +1,25 @@ /* Copyright (C) 2005 Analog Devices */ /** @file misc_bfin.h - @author Jean-Marc Valin + @author Jean-Marc Valin @brief Various compatibility routines for Speex (Blackfin version) */ /* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + - Neither the name of the Xiph.org Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR diff --git a/vendor/libspeex/libspeex/modes.h b/vendor/libspeex/libspeex/modes.h index 0977a579b8..2d5adc423f 100644 --- a/vendor/libspeex/libspeex/modes.h +++ b/vendor/libspeex/libspeex/modes.h @@ -7,18 +7,18 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + - Neither the name of the Xiph.org Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -71,8 +71,8 @@ typedef void (*lsp_unquant_func)(spx_lsp_t *, int, SpeexBits *); /** Long-term predictor quantization */ -typedef int (*ltp_quant_func)(spx_word16_t *, spx_word16_t *, spx_coef_t *, spx_coef_t *, - spx_coef_t *, spx_sig_t *, const void *, int, int, spx_word16_t, +typedef int (*ltp_quant_func)(spx_word16_t *, spx_word16_t *, spx_coef_t *, spx_coef_t *, + spx_coef_t *, spx_sig_t *, const void *, int, int, spx_word16_t, int, int, SpeexBits*, char *, spx_word16_t *, spx_word16_t *, int, int, int, spx_word32_t *); /** Long-term un-quantize */ @@ -81,13 +81,13 @@ typedef void (*ltp_unquant_func)(spx_word16_t *, spx_word32_t *, int, int, spx_w /** Innovation quantization function */ -typedef void (*innovation_quant_func)(spx_word16_t *, spx_coef_t *, spx_coef_t *, spx_coef_t *, const void *, int, int, +typedef void (*innovation_quant_func)(spx_word16_t *, spx_coef_t *, spx_coef_t *, spx_coef_t *, const void *, int, int, spx_sig_t *, spx_word16_t *, SpeexBits *, char *, int, int); /** Innovation unquantization function */ -typedef void (*innovation_unquant_func)(spx_sig_t *, const void *, int, SpeexBits*, char *, spx_int32_t *); +typedef void (*innovation_unquant_func)(spx_sig_t *, const void *, int, SpeexBits*, char *, spx_uint32_t *); -/** Description of a Speex sub-mode (wither narrowband or wideband */ +/** Description of a Speex sub-mode (either narrowband or wideband) */ typedef struct SpeexSubmode { int lbr_pitch; /**< Set to -1 for "normal" modes, otherwise encode pitch using a global pitch and allowing a +- lbr_pitch variation (for low not-rates)*/ int forced_pitch_gain; /**< Use the same (forced) pitch gain for all sub-frames */ diff --git a/vendor/libspeex/libspeex/nb_celp.c b/vendor/libspeex/libspeex/nb_celp.c index b68d5070a2..e6d7979723 100644 --- a/vendor/libspeex/libspeex/nb_celp.c +++ b/vendor/libspeex/libspeex/nb_celp.c @@ -93,13 +93,6 @@ static const float exc_gain_quant_scal1[2]={0.70469f, 1.05127f}; #endif -#ifdef VORBIS_PSYCHO -#define EXTRA_BUFFER 100 -#else -#define EXTRA_BUFFER 0 -#endif - - extern const spx_word16_t lag_window[]; extern const spx_word16_t lpc_window[]; @@ -172,7 +165,7 @@ void *nb_encoder_init(const SpeexMode *m) st->highpass_enabled = 1; #ifdef ENABLE_VALGRIND - VALGRIND_MAKE_READABLE(st, NB_ENC_STACK); + VALGRIND_MAKE_MEM_DEFINED(st, NB_ENC_STACK); #endif return st; } @@ -1113,7 +1106,7 @@ void *nb_decoder_init(const SpeexMode *m) st->highpass_enabled = 1; #ifdef ENABLE_VALGRIND - VALGRIND_MAKE_READABLE(st, NB_DEC_STACK); + VALGRIND_MAKE_MEM_DEFINED(st, NB_DEC_STACK); #endif return st; } @@ -1472,6 +1465,11 @@ int nb_decode(void *state, SpeexBits *bits, void *vout) /* Final signal synthesis from excitation */ iir_mem16(st->exc, lpc, out, NB_FRAME_SIZE, NB_ORDER, st->mem_sp, stack); + /* Normally this is written to later but since this is returning early, + avoid reading uninitialized memory in caller */ + if (st->innov_save) + SPEEX_MEMSET(st->innov_save, 0, NB_NB_SUBFRAMES*NB_SUBFRAME_SIZE); + st->count_lost=0; return 0; } diff --git a/vendor/libspeex/libspeex/nb_celp.h b/vendor/libspeex/libspeex/nb_celp.h index a8d3088063..8fe60ce11f 100644 --- a/vendor/libspeex/libspeex/nb_celp.h +++ b/vendor/libspeex/libspeex/nb_celp.h @@ -7,18 +7,18 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + - Neither the name of the Xiph.org Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -109,7 +109,7 @@ typedef struct EncState { float abr_drift2; float abr_count; #endif /* #ifndef DISABLE_VBR */ - + int complexity; /**< Complexity setting (0-10 from least complex to most complex) */ spx_int32_t sampling_rate; int plc_tuning; @@ -139,18 +139,18 @@ typedef struct DecState { spx_mem_t mem_hp[2]; /**< High-pass filter memory */ spx_word32_t pi_gain[NB_NB_SUBFRAMES]; /**< Gain of LPC filter at theta=pi (fe/2) */ spx_word16_t *innov_save; /** If non-NULL, innovation is copied here */ - + spx_word16_t level; spx_word16_t max_level; spx_word16_t min_level; - + /* This is used in packet loss concealment */ int last_pitch; /**< Pitch of last correctly decoded frame */ spx_word16_t last_pitch_gain; /**< Pitch gain of last correctly decoded frame */ spx_word16_t pitch_gain_buf[3]; /**< Pitch gain of last decoded frames */ int pitch_gain_buf_idx; /**< Tail of the buffer */ - spx_int32_t seed; /** Seed used for random number generation */ - + spx_uint32_t seed; /** Seed used for random number generation */ + int encode_submode; const SpeexSubmode * const *submodes; /**< Sub-mode data */ int submodeID; /**< Activated sub-mode */ diff --git a/vendor/libspeex/libspeex/os_support.h b/vendor/libspeex/libspeex/os_support.h index 2e23a5eb41..0db31a61df 100644 --- a/vendor/libspeex/libspeex/os_support.h +++ b/vendor/libspeex/libspeex/os_support.h @@ -1,5 +1,5 @@ /* Copyright (C) 2007 Jean-Marc Valin - + File: os_support.h This is the (tiny) OS abstraction layer. Aside from math.h, this is the only place where system headers are allowed. @@ -45,12 +45,12 @@ #include "os_support_custom.h" #endif -/** Speex wrapper for calloc. To do your own dynamic allocation, all you need to do is replace this function, speex_realloc and speex_free +/** Speex wrapper for calloc. To do your own dynamic allocation, all you need to do is replace this function, speex_realloc and speex_free NOTE: speex_alloc needs to CLEAR THE MEMORY */ #ifndef OVERRIDE_SPEEX_ALLOC static inline void *speex_alloc (int size) { - /* WARNING: this is not equivalent to malloc(). If you want to use malloc() + /* WARNING: this is not equivalent to malloc(). If you want to use malloc() or your own allocator, YOU NEED TO CLEAR THE MEMORY ALLOCATED. Otherwise you will experience strange bugs */ return calloc(size,1); diff --git a/vendor/libspeex/libspeex/quant_lsp.h b/vendor/libspeex/libspeex/quant_lsp.h index 0fc206be6f..aea6eb2b7b 100644 --- a/vendor/libspeex/libspeex/quant_lsp.h +++ b/vendor/libspeex/libspeex/quant_lsp.h @@ -7,18 +7,18 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + - Neither the name of the Xiph.org Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR diff --git a/vendor/libspeex/libspeex/quant_lsp_bfin.h b/vendor/libspeex/libspeex/quant_lsp_bfin.h index efd23f5509..238adb9301 100644 --- a/vendor/libspeex/libspeex/quant_lsp_bfin.h +++ b/vendor/libspeex/libspeex/quant_lsp_bfin.h @@ -8,18 +8,18 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + - Neither the name of the Xiph.org Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -40,14 +40,14 @@ /* Note http://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html - well tell you all the magic resgister constraints used below + well tell you all the magic register constraints used below for gcc in-line asm. */ static int lsp_quant( - spx_word16_t *x, - const signed char *cdbk, - int nbVec, + spx_word16_t *x, + const signed char *cdbk, + int nbVec, int nbDim ) { @@ -57,23 +57,23 @@ static int lsp_quant( __asm__ __volatile__ ( -" %0 = 1 (X);\n\t" /* %0: best_dist */ -" %0 <<= 30;\n\t" +" %0 = 1 (X);\n\t" /* %0: best_dist */ +" %0 <<= 30;\n\t" " %1 = 0 (X);\n\t" /* %1: best_i */ " P2 = %3\n\t" /* P2: ptr to cdbk */ " R5 = 0;\n\t" /* R5: best cb entry */ " R0 = %5;\n\t" /* set up circ addr */ " R0 <<= 1;\n\t" -" L0 = R0;\n\t" +" L0 = R0;\n\t" " I0 = %2;\n\t" /* %2: &x[0] */ -" B0 = %2;\n\t" +" B0 = %2;\n\t" " R2.L = W [I0++];\n\t" " LSETUP (1f, 2f) LC0 = %4;\n\t" "1: R3 = 0;\n\t" /* R3: dist */ " LSETUP (3f, 4f) LC1 = %5;\n\t" -"3: R1 = B [P2++] (X);\n\t" +"3: R1 = B [P2++] (X);\n\t" " R1 <<= 5;\n\t" " R0.L = R2.L - R1.L || R2.L = W [I0++];\n\t" " R0 = R0.L*R0.L;\n\t" @@ -102,15 +102,15 @@ static int lsp_quant( /* Note http://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html - well tell you all the magic resgister constraints used below + well tell you all the magic register constraints used below for gcc in-line asm. */ static int lsp_weight_quant( - spx_word16_t *x, - spx_word16_t *weight, - const signed char *cdbk, - int nbVec, + spx_word16_t *x, + spx_word16_t *weight, + const signed char *cdbk, + int nbVec, int nbDim ) { @@ -120,26 +120,26 @@ static int lsp_weight_quant( __asm__ __volatile__ ( -" %0 = 1 (X);\n\t" /* %0: best_dist */ -" %0 <<= 30;\n\t" +" %0 = 1 (X);\n\t" /* %0: best_dist */ +" %0 <<= 30;\n\t" " %1 = 0 (X);\n\t" /* %1: best_i */ " P2 = %4\n\t" /* P2: ptr to cdbk */ " R5 = 0;\n\t" /* R5: best cb entry */ " R0 = %6;\n\t" /* set up circ addr */ " R0 <<= 1;\n\t" -" L0 = R0;\n\t" +" L0 = R0;\n\t" " L1 = R0;\n\t" " I0 = %2;\n\t" /* %2: &x[0] */ " I1 = %3;\n\t" /* %3: &weight[0] */ -" B0 = %2;\n\t" -" B1 = %3;\n\t" +" B0 = %2;\n\t" +" B1 = %3;\n\t" " LSETUP (1f, 2f) LC0 = %5;\n\t" "1: R3 = 0 (X);\n\t" /* R3: dist */ " LSETUP (3f, 4f) LC1 = %6;\n\t" "3: R0.L = W [I0++] || R2.L = W [I1++];\n\t" -" R1 = B [P2++] (X);\n\t" +" R1 = B [P2++] (X);\n\t" " R1 <<= 5;\n\t" " R0.L = R0.L - R1.L;\n\t" " R0 = R0.L*R0.L;\n\t" diff --git a/vendor/libspeex/libspeex/sb_celp.c b/vendor/libspeex/libspeex/sb_celp.c index 3aab085cc9..61d5c27a6a 100644 --- a/vendor/libspeex/libspeex/sb_celp.c +++ b/vendor/libspeex/libspeex/sb_celp.c @@ -64,9 +64,6 @@ #ifndef DISABLE_WIDEBAND - -#define sqr(x) ((x)*(x)) - #define SUBMODE(x) st->submodes[st->submodeID]->x #ifdef FIXED_POINT @@ -223,7 +220,7 @@ void *sb_encoder_init(const SpeexMode *m) speex_encoder_ctl(st->st_low, SPEEX_GET_SAMPLING_RATE, &st->sampling_rate); st->sampling_rate*=2; #ifdef ENABLE_VALGRIND - VALGRIND_MAKE_READABLE(st, (st->stack-(char*)st)); + VALGRIND_MAKE_MEM_DEFINED(st, (st->stack-(char*)st)); #endif return st; } @@ -1017,7 +1014,7 @@ void *sb_decoder_init(const SpeexMode *m) st->seed = 1000; #ifdef ENABLE_VALGRIND - VALGRIND_MAKE_READABLE(st, (st->stack-(char*)st)); + VALGRIND_MAKE_MEM_DEFINED(st, (st->stack-(char*)st)); #endif return st; } @@ -1280,6 +1277,9 @@ int sb_decode(void *state, SpeexBits *bits, void *vout) /* If null mode (no transmission), just set a couple things to zero*/ if (st->submodes[st->submodeID] == NULL) { + if (st->innov_save) + SPEEX_MEMSET(st->innov_save, 0, st->full_frame_size); + if (dtx) { sb_decode_lost(st, out, 1, stack); @@ -1343,7 +1343,7 @@ int sb_decode(void *state, SpeexBits *bits, void *vout) /* LSP to LPC */ lsp_to_lpc(interp_qlsp, ak, st->lpcSize, stack); - /* Calculate reponse ratio between the low and high filter in the middle + /* Calculate response ratio between the low and high filter in the middle of the band (4000 Hz) */ st->pi_gain[sub]=LPC_SCALING; diff --git a/vendor/libspeex/libspeex/sb_celp.h b/vendor/libspeex/libspeex/sb_celp.h index 141d0c2e1b..c6b92940db 100644 --- a/vendor/libspeex/libspeex/sb_celp.h +++ b/vendor/libspeex/libspeex/sb_celp.h @@ -7,18 +7,18 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + - Neither the name of the Xiph.org Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -83,7 +83,7 @@ typedef struct SBEncState { int vad_enabled; /**< 1 for enabling VAD, 0 otherwise */ float relative_quality; #endif /* #ifndef DISABLE_VBR */ - + int encode_submode; const SpeexSubmode * const *submodes; int submodeID; @@ -118,9 +118,9 @@ typedef struct SBDecState { spx_word32_t *pi_gain; spx_word16_t *exc_rms; spx_word16_t *innov_save; /** If non-NULL, innovation is copied here */ - + spx_word16_t last_ener; - spx_int32_t seed; + spx_uint32_t seed; int encode_submode; const SpeexSubmode * const *submodes; diff --git a/vendor/libspeex/libspeex/stack_alloc.h b/vendor/libspeex/libspeex/stack_alloc.h index 5264e666b0..a446065825 100644 --- a/vendor/libspeex/libspeex/stack_alloc.h +++ b/vendor/libspeex/libspeex/stack_alloc.h @@ -7,18 +7,18 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + - Neither the name of the Xiph.org Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -36,7 +36,7 @@ #define STACK_ALLOC_H #ifdef USE_ALLOCA -# ifdef WIN32 +# ifdef _WIN32 # include # else # ifdef HAVE_ALLOCA_H @@ -101,7 +101,7 @@ #endif #if defined(VAR_ARRAYS) -#define VARDECL(var) +#define VARDECL(var) #define ALLOC(var, size, type) type var[size] #elif defined(USE_ALLOCA) #define VARDECL(var) var diff --git a/vendor/libspeex/libspeex/testenc.c b/vendor/libspeex/libspeex/testenc.c new file mode 100644 index 0000000000..1f634ed745 --- /dev/null +++ b/vendor/libspeex/libspeex/testenc.c @@ -0,0 +1,145 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "speex/speex_callbacks.h" +#include +#include + +#ifdef FIXED_DEBUG +extern long long spx_mips; +#endif + +#define FRAME_SIZE 160 +#include +int main(int argc, char **argv) +{ + char *inFile, *outFile, *bitsFile; + FILE *fin, *fout, *fbits=NULL; + short in_short[FRAME_SIZE]; + short out_short[FRAME_SIZE]; + int snr_frames = 0; + char cbits[200]; + int nbBits; + int i; + void *st; + void *dec; + SpeexBits bits; + spx_int32_t tmp; + int bitCount=0; + spx_int32_t skip_group_delay; + SpeexCallback callback; + + st = speex_encoder_init(speex_lib_get_mode(SPEEX_MODEID_NB)); + dec = speex_decoder_init(speex_lib_get_mode(SPEEX_MODEID_NB)); + + /* BEGIN: You probably don't need the following in a real application */ + callback.callback_id = SPEEX_INBAND_CHAR; + callback.func = speex_std_char_handler; + callback.data = stderr; + speex_decoder_ctl(dec, SPEEX_SET_HANDLER, &callback); + + callback.callback_id = SPEEX_INBAND_MODE_REQUEST; + callback.func = speex_std_mode_request_handler; + callback.data = st; + speex_decoder_ctl(dec, SPEEX_SET_HANDLER, &callback); + /* END of unnecessary stuff */ + + tmp=1; + speex_decoder_ctl(dec, SPEEX_SET_ENH, &tmp); + tmp=0; + speex_encoder_ctl(st, SPEEX_SET_VBR, &tmp); + tmp=8; + speex_encoder_ctl(st, SPEEX_SET_QUALITY, &tmp); + tmp=1; + speex_encoder_ctl(st, SPEEX_SET_COMPLEXITY, &tmp); + + /* Turn this off if you want to measure SNR (on by default) */ + tmp=1; + speex_encoder_ctl(st, SPEEX_SET_HIGHPASS, &tmp); + speex_decoder_ctl(dec, SPEEX_SET_HIGHPASS, &tmp); + + speex_encoder_ctl(st, SPEEX_GET_LOOKAHEAD, &skip_group_delay); + speex_decoder_ctl(dec, SPEEX_GET_LOOKAHEAD, &tmp); + skip_group_delay += tmp; + + if (argc != 4 && argc != 3) + { + fprintf (stderr, "Usage: encode [in file] [out file] [bits file]\nargc = %d", argc); + exit(1); + } + inFile = argv[1]; + fin = fopen(inFile, "rb"); + outFile = argv[2]; + fout = fopen(outFile, "wb+"); + if (argc==4) + { + bitsFile = argv[3]; + fbits = fopen(bitsFile, "wb"); + } + speex_bits_init(&bits); + while (!feof(fin)) + { + fread(in_short, sizeof(short), FRAME_SIZE, fin); + if (feof(fin)) + break; + speex_bits_reset(&bits); + + speex_encode_int(st, in_short, &bits); + nbBits = speex_bits_write(&bits, cbits, 200); + bitCount+=bits.nbBits; + + if (argc==4) + fwrite(cbits, 1, nbBits, fbits); + speex_bits_rewind(&bits); + + speex_decode_int(dec, &bits, out_short); + speex_bits_reset(&bits); + + fwrite(&out_short[skip_group_delay], sizeof(short), FRAME_SIZE-skip_group_delay, fout); + skip_group_delay = 0; + } + fprintf (stderr, "Total encoded size: %d bits\n", bitCount); + speex_encoder_destroy(st); + speex_decoder_destroy(dec); + speex_bits_destroy(&bits); + +#ifndef DISABLE_FLOAT_API + { + float sigpow,errpow,snr, seg_snr=0; + sigpow = 0; + errpow = 0; + + /* This code just computes SNR, so you don't need it either */ + rewind(fin); + rewind(fout); + + while ( FRAME_SIZE == fread(in_short, sizeof(short), FRAME_SIZE, fin) + && + FRAME_SIZE == fread(out_short, sizeof(short), FRAME_SIZE,fout) ) + { + float s=0, e=0; + for (i=0;i +#include + +#ifdef FIXED_DEBUG +extern long long spx_mips; +#endif + +#define FRAME_SIZE 640 +#include +int main(int argc, char **argv) +{ + char *inFile, *outFile, *bitsFile; + FILE *fin, *fout, *fbits=NULL; + short in_short[FRAME_SIZE]; + short out_short[FRAME_SIZE]; + float sigpow,errpow,snr, seg_snr=0; + int snr_frames = 0; + char cbits[200]; + int nbBits; + int i; + void *st; + void *dec; + SpeexBits bits; + spx_int32_t tmp; + int bitCount=0; + spx_int32_t skip_group_delay; + SpeexCallback callback; + + sigpow = 0; + errpow = 0; + + st = speex_encoder_init(speex_lib_get_mode(SPEEX_MODEID_UWB)); + dec = speex_decoder_init(speex_lib_get_mode(SPEEX_MODEID_UWB)); + + callback.callback_id = SPEEX_INBAND_CHAR; + callback.func = speex_std_char_handler; + callback.data = stderr; + speex_decoder_ctl(dec, SPEEX_SET_HANDLER, &callback); + + callback.callback_id = SPEEX_INBAND_MODE_REQUEST; + callback.func = speex_std_mode_request_handler; + callback.data = st; + speex_decoder_ctl(dec, SPEEX_SET_HANDLER, &callback); + + tmp=0; + speex_decoder_ctl(dec, SPEEX_SET_ENH, &tmp); + tmp=0; + speex_encoder_ctl(st, SPEEX_SET_VBR, &tmp); + tmp=7; + speex_encoder_ctl(st, SPEEX_SET_QUALITY, &tmp); + tmp=1; + speex_encoder_ctl(st, SPEEX_SET_COMPLEXITY, &tmp); + + speex_encoder_ctl(st, SPEEX_GET_LOOKAHEAD, &skip_group_delay); + speex_decoder_ctl(dec, SPEEX_GET_LOOKAHEAD, &tmp); + skip_group_delay += tmp; + + + if (argc != 4 && argc != 3) + { + fprintf (stderr, "Usage: encode [in file] [out file] [bits file]\nargc = %d", argc); + exit(1); + } + inFile = argv[1]; + fin = fopen(inFile, "rb"); + outFile = argv[2]; + fout = fopen(outFile, "wb+"); + if (argc==4) + { + bitsFile = argv[3]; + fbits = fopen(bitsFile, "wb"); + } + speex_bits_init(&bits); + while (!feof(fin)) + { + fread(in_short, sizeof(short), FRAME_SIZE, fin); + if (feof(fin)) + break; + speex_bits_reset(&bits); + + speex_encode_int(st, in_short, &bits); + nbBits = speex_bits_write(&bits, cbits, 200); + bitCount+=bits.nbBits; + + if (argc==4) + fwrite(cbits, 1, nbBits, fbits); + speex_bits_rewind(&bits); + + speex_decode_int(dec, &bits, out_short); + speex_bits_reset(&bits); + + fwrite(&out_short[skip_group_delay], sizeof(short), FRAME_SIZE-skip_group_delay, fout); + skip_group_delay = 0; + } + fprintf (stderr, "Total encoded size: %d bits\n", bitCount); + speex_encoder_destroy(st); + speex_decoder_destroy(dec); + + rewind(fin); + rewind(fout); + + while ( FRAME_SIZE == fread(in_short, sizeof(short), FRAME_SIZE, fin) + && + FRAME_SIZE == fread(out_short, sizeof(short), FRAME_SIZE,fout) ) + { + float s=0, e=0; + for (i=0;i +#include + +#ifdef FIXED_DEBUG +extern long long spx_mips; +#endif + +#define FRAME_SIZE 320 +#include +int main(int argc, char **argv) +{ + char *inFile, *outFile, *bitsFile; + FILE *fin, *fout, *fbits=NULL; + short in_short[FRAME_SIZE]; + short out_short[FRAME_SIZE]; + float sigpow,errpow,snr, seg_snr=0; + int snr_frames = 0; + char cbits[200]; + int nbBits; + int i; + void *st; + void *dec; + SpeexBits bits; + spx_int32_t tmp; + int bitCount=0; + spx_int32_t skip_group_delay; + SpeexCallback callback; + + sigpow = 0; + errpow = 0; + + st = speex_encoder_init(speex_lib_get_mode(SPEEX_MODEID_WB)); + dec = speex_decoder_init(speex_lib_get_mode(SPEEX_MODEID_WB)); + + callback.callback_id = SPEEX_INBAND_CHAR; + callback.func = speex_std_char_handler; + callback.data = stderr; + speex_decoder_ctl(dec, SPEEX_SET_HANDLER, &callback); + + callback.callback_id = SPEEX_INBAND_MODE_REQUEST; + callback.func = speex_std_mode_request_handler; + callback.data = st; + speex_decoder_ctl(dec, SPEEX_SET_HANDLER, &callback); + + tmp=1; + speex_decoder_ctl(dec, SPEEX_SET_ENH, &tmp); + tmp=0; + speex_encoder_ctl(st, SPEEX_SET_VBR, &tmp); + tmp=8; + speex_encoder_ctl(st, SPEEX_SET_QUALITY, &tmp); + tmp=3; + speex_encoder_ctl(st, SPEEX_SET_COMPLEXITY, &tmp); + /*tmp=3; + speex_encoder_ctl(st, SPEEX_SET_HIGH_MODE, &tmp); + tmp=6; + speex_encoder_ctl(st, SPEEX_SET_LOW_MODE, &tmp); +*/ + + speex_encoder_ctl(st, SPEEX_GET_LOOKAHEAD, &skip_group_delay); + speex_decoder_ctl(dec, SPEEX_GET_LOOKAHEAD, &tmp); + skip_group_delay += tmp; + + + if (argc != 4 && argc != 3) + { + fprintf (stderr, "Usage: encode [in file] [out file] [bits file]\nargc = %d", argc); + exit(1); + } + inFile = argv[1]; + fin = fopen(inFile, "rb"); + outFile = argv[2]; + fout = fopen(outFile, "wb+"); + if (argc==4) + { + bitsFile = argv[3]; + fbits = fopen(bitsFile, "wb"); + } + speex_bits_init(&bits); + while (!feof(fin)) + { + fread(in_short, sizeof(short), FRAME_SIZE, fin); + if (feof(fin)) + break; + speex_bits_reset(&bits); + + speex_encode_int(st, in_short, &bits); + nbBits = speex_bits_write(&bits, cbits, 200); + bitCount+=bits.nbBits; + + if (argc==4) + fwrite(cbits, 1, nbBits, fbits); + speex_bits_rewind(&bits); + + speex_decode_int(dec, &bits, out_short); + speex_bits_reset(&bits); + + fwrite(&out_short[skip_group_delay], sizeof(short), FRAME_SIZE-skip_group_delay, fout); + skip_group_delay = 0; + } + fprintf (stderr, "Total encoded size: %d bits\n", bitCount); + speex_encoder_destroy(st); + speex_decoder_destroy(dec); + speex_bits_destroy(&bits); + + rewind(fin); + rewind(fout); + + while ( FRAME_SIZE == fread(in_short, sizeof(short), FRAME_SIZE, fin) + && + FRAME_SIZE == fread(out_short, sizeof(short), FRAME_SIZE,fout) ) + { + float s=0, e=0; + for (i=0;i1e-13?log((x)*(x))*4.34294480f:-30) -#define fromdB(x) (exp((x)*.11512925f)) +#define fromdB(x) (exp((x)*.11512925f)) /* The bark scale equations are approximations, since the original table was somewhat hand rolled. The below are chosen to have the diff --git a/vendor/libspeex/libspeex/vq.h b/vendor/libspeex/libspeex/vq.h index 5a4ced249c..5c707f0555 100644 --- a/vendor/libspeex/libspeex/vq.h +++ b/vendor/libspeex/libspeex/vq.h @@ -7,18 +7,18 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + - Neither the name of the Xiph.org Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR diff --git a/vendor/libspeex/libspeex/vq_arm4.h b/vendor/libspeex/libspeex/vq_arm4.h index 585b8613c5..957e195f24 100644 --- a/vendor/libspeex/libspeex/vq_arm4.h +++ b/vendor/libspeex/libspeex/vq_arm4.h @@ -7,18 +7,18 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + - Neither the name of the Xiph.org Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR diff --git a/vendor/libspeex/libspeex/vq_bfin.h b/vendor/libspeex/libspeex/vq_bfin.h index a4d2d2ff3b..82979894eb 100644 --- a/vendor/libspeex/libspeex/vq_bfin.h +++ b/vendor/libspeex/libspeex/vq_bfin.h @@ -1,25 +1,25 @@ /* Copyright (C) 2005 Analog Devices */ /** @file vq_bfin.h - @author Jean-Marc Valin + @author Jean-Marc Valin @brief Blackfin-optimized vq routine */ /* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + - Neither the name of the Xiph.org Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR diff --git a/vendor/libspeex/libspeexdsp/_kiss_fft_guts.h b/vendor/libspeex/libspeexdsp/_kiss_fft_guts.h index 6571e79c0c..f5f2a5fd76 100644 --- a/vendor/libspeex/libspeexdsp/_kiss_fft_guts.h +++ b/vendor/libspeex/libspeexdsp/_kiss_fft_guts.h @@ -23,7 +23,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND #include "math_approx.h" #define MAXFACTORS 32 -/* e.g. an fft of length 128 has 4 factors +/* e.g. an fft of length 128 has 4 factors as far as kissfft is concerned 4*4*4*2 */ @@ -47,7 +47,7 @@ struct kiss_fft_state{ #ifdef FIXED_POINT #include "arch.h" # define FRACBITS 15 -# define SAMPPROD spx_int32_t +# define SAMPPROD spx_int32_t #define SAMP_MAX 32767 #define SAMP_MIN -SAMP_MAX diff --git a/vendor/libspeex/libspeexdsp/arch.h b/vendor/libspeex/libspeexdsp/arch.h index 535d308302..1cac3d9c89 100644 --- a/vendor/libspeex/libspeexdsp/arch.h +++ b/vendor/libspeex/libspeexdsp/arch.h @@ -7,18 +7,18 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + - Neither the name of the Xiph.org Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -41,10 +41,10 @@ #ifdef FLOATING_POINT #error You cannot compile as floating point and fixed point at the same time #endif -#ifdef _USE_SSE +#ifdef USE_SSE #error SSE is only for floating-point #endif -#if ((defined (ARM4_ASM)||defined (ARM4_ASM)) && defined(BFIN_ASM)) || (defined (ARM4_ASM)&&defined(ARM5E_ASM)) +#if defined(ARM4_ASM) + defined(ARM5E_ASM) + defined(BFIN_ASM) > 1 #error Make up your mind. What CPU do you have? #endif #ifdef VORBIS_PSYCHO @@ -56,10 +56,10 @@ #ifndef FLOATING_POINT #error You now need to define either FIXED_POINT or FLOATING_POINT #endif -#if defined (ARM4_ASM) || defined(ARM5E_ASM) || defined(BFIN_ASM) +#if defined(ARM4_ASM) || defined(ARM5E_ASM) || defined(BFIN_ASM) #error I suppose you can have a [ARM4/ARM5E/Blackfin] that has float instructions? #endif -#ifdef FIXED_POINT_DEBUG +#ifdef FIXED_DEBUG #error "Don't you think enabling fixed-point is a good thing to do if you want to debug that?" #endif @@ -101,6 +101,8 @@ typedef spx_word32_t spx_sig_t; #define SIG_SHIFT 14 #define GAIN_SHIFT 6 +#define WORD2INT(x) ((x) < -32767 ? -32768 : ((x) > 32766 ? 32767 : (x))) + #define VERY_SMALL 0 #define VERY_LARGE32 ((spx_word32_t)2147483647) #define VERY_LARGE16 ((spx_word16_t)32767) @@ -115,9 +117,9 @@ typedef spx_word32_t spx_sig_t; #ifdef ARM5E_ASM #include "fixed_arm5e.h" -#elif defined (ARM4_ASM) +#elif defined(ARM4_ASM) #include "fixed_arm4.h" -#elif defined (BFIN_ASM) +#elif defined(BFIN_ASM) #include "fixed_bfin.h" #endif @@ -175,16 +177,13 @@ typedef float spx_word32_t; #define ADD32(a,b) ((a)+(b)) #define SUB32(a,b) ((a)-(b)) #define MULT16_16_16(a,b) ((a)*(b)) +#define MULT16_32_32(a,b) ((a)*(b)) #define MULT16_16(a,b) ((spx_word32_t)(a)*(spx_word32_t)(b)) #define MAC16_16(c,a,b) ((c)+(spx_word32_t)(a)*(spx_word32_t)(b)) -#define MULT16_32_Q11(a,b) ((a)*(b)) -#define MULT16_32_Q13(a,b) ((a)*(b)) -#define MULT16_32_Q14(a,b) ((a)*(b)) #define MULT16_32_Q15(a,b) ((a)*(b)) #define MULT16_32_P15(a,b) ((a)*(b)) -#define MAC16_32_Q11(c,a,b) ((c)+(a)*(b)) #define MAC16_32_Q15(c,a,b) ((c)+(a)*(b)) #define MAC16_16_Q11(c,a,b) ((c)+(a)*(b)) @@ -203,18 +202,19 @@ typedef float spx_word32_t; #define DIV32(a,b) (((spx_word32_t)(a))/(spx_word32_t)(b)) #define PDIV32(a,b) (((spx_word32_t)(a))/(spx_word32_t)(b)) - +#define WORD2INT(x) ((x) < -32767.5f ? -32768 : \ + ((x) > 32766.5f ? 32767 : (spx_int16_t)floor(.5 + (x)))) #endif -#if defined (CONFIG_TI_C54X) || defined (CONFIG_TI_C55X) +#if defined(CONFIG_TI_C54X) || defined(CONFIG_TI_C55X) /* 2 on TI C5x DSP */ -#define BYTES_PER_CHAR 2 +#define BYTES_PER_CHAR 2 #define BITS_PER_CHAR 16 #define LOG2_BITS_PER_CHAR 4 -#else +#else #define BYTES_PER_CHAR 1 #define BITS_PER_CHAR 8 diff --git a/vendor/libspeex/libspeexdsp/buffer.c b/vendor/libspeex/libspeexdsp/buffer.c index c82cab5bc5..b06a155434 100644 --- a/vendor/libspeex/libspeexdsp/buffer.c +++ b/vendor/libspeex/libspeexdsp/buffer.c @@ -1,5 +1,5 @@ /* Copyright (C) 2007 Jean-Marc Valin - + File: buffer.c This is a very simple ring buffer implementation. It is not thread-safe so you need to do your own locking. @@ -99,7 +99,7 @@ EXPORT int speex_buffer_write(SpeexBuffer *st, void *_data, int len) EXPORT int speex_buffer_writezeros(SpeexBuffer *st, int len) { - /* This is almost the same as for speex_buffer_write() but using + /* This is almost the same as for speex_buffer_write() but using SPEEX_MEMSET() instead of SPEEX_COPY(). Update accordingly. */ int end; int end1; @@ -135,7 +135,7 @@ EXPORT int speex_buffer_read(SpeexBuffer *st, void *_data, int len) char *data = _data; if (len > st->available) { - SPEEX_MEMSET(data+st->available, 0, st->size-st->available); + SPEEX_MEMSET(data+st->available, 0, len - st->available); len = st->available; } end = st->read_ptr + len; diff --git a/vendor/libspeex/libspeexdsp/config.h b/vendor/libspeex/libspeexdsp/config.h index d4a0050a30..a7455d8c39 100644 --- a/vendor/libspeex/libspeexdsp/config.h +++ b/vendor/libspeex/libspeexdsp/config.h @@ -3,19 +3,19 @@ // In Visual Studio, _M_IX86_FP=1 means /arch:SSE was used, likewise // _M_IX86_FP=2 means /arch:SSE2 was used. -// Also, enable both _USE_SSE and _USE_SSE2 if we're compiling for x86-64 +// Also, enable both USE_SSE and USE_SSE2 if we're compiling for x86-64 #if _M_IX86_FP >= 1 || defined(_M_X64) -#define _USE_SSE +#define USE_SSE #endif #if _M_IX86_FP >= 2 || defined(_M_X64) -#define _USE_SSE2 +#define USE_SSE2 #endif // Visual Studio support alloca(), but it always align variables to 16-bit // boundary, while SSE need 128-bit alignment. So we disable alloca() when // SSE is enabled. -#ifndef _USE_SSE +#ifndef USE_SSE # define USE_ALLOCA #endif diff --git a/vendor/libspeex/libspeexdsp/fftwrap.c b/vendor/libspeex/libspeexdsp/fftwrap.c index a14b1e4fb0..4573479d00 100644 --- a/vendor/libspeex/libspeexdsp/fftwrap.c +++ b/vendor/libspeex/libspeexdsp/fftwrap.c @@ -1,23 +1,23 @@ -/* Copyright (C) 2005-2006 Jean-Marc Valin +/* Copyright (C) 2005-2006 Jean-Marc Valin File: fftwrap.c - Wrapper for various FFTs + Wrapper for various FFTs Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + - Neither the name of the Xiph.org Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -62,7 +62,7 @@ static int maximize_range(spx_word16_t *in, spx_word16_t *out, spx_word16_t boun for (i=0;iifft); - + for(i=0;i #include "math_approx.h" #include "os_support.h" - + #ifdef FIXED_POINT #define toBARK(n) (MULT16_16(26829,spx_atan(SHR32(MULT16_16(97,n),2))) + MULT16_16(4588,spx_atan(MULT16_32_Q15(20,MULT16_16(n,n)))) + MULT16_16(3355,n)) - + #else #define toBARK(n) (13.1f*atan(.00074f*(n))+2.24f*atan((n)*(n)*1.85e-8f)+1e-4f*(n)) #endif - + #define toMEL(n) (2595.f*log10(1.f+(n)/700.f)) FilterBank *filterbank_new(int banks, spx_word32_t sampling, int len, int type) @@ -62,7 +62,7 @@ FilterBank *filterbank_new(int banks, spx_word32_t sampling, int len, int type) df = DIV32(SHL32(sampling,15),MULT16_16(2,len)); max_mel = toBARK(EXTRACT16(sampling/2)); mel_interval = PDIV32(max_mel,banks-1); - + bank = (FilterBank*)speex_alloc(sizeof(FilterBank)); bank->nb_banks = banks; bank->len = len; @@ -85,7 +85,7 @@ FilterBank *filterbank_new(int banks, spx_word32_t sampling, int len, int type) break; #ifdef FIXED_POINT id1 = DIV32(mel,mel_interval); -#else +#else id1 = (int)(floor(mel/mel_interval)); #endif if (id1>banks-2) @@ -101,7 +101,7 @@ FilterBank *filterbank_new(int banks, spx_word32_t sampling, int len, int type) bank->bank_right[i] = id2; bank->filter_right[i] = val; } - + /* Think I can safely disable normalisation for fixed-point (and probably float as well) */ #ifndef FIXED_POINT for (i=0;inb_banks;i++) diff --git a/vendor/libspeex/libspeexdsp/fixed_arm4.h b/vendor/libspeex/libspeexdsp/fixed_arm4.h index b6981cae72..a7040b8a9d 100644 --- a/vendor/libspeex/libspeexdsp/fixed_arm4.h +++ b/vendor/libspeex/libspeexdsp/fixed_arm4.h @@ -7,18 +7,18 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + - Neither the name of the Xiph.org Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -35,19 +35,6 @@ #ifndef FIXED_ARM4_H #define FIXED_ARM4_H -#undef MULT16_32_Q14 -static inline spx_word32_t MULT16_32_Q14(spx_word16_t x, spx_word32_t y) { - int res; - int dummy; - asm ( - "smull %0,%1,%2,%3 \n\t" - "mov %0, %0, lsr #14 \n\t" - "add %0, %0, %1, lsl #18 \n\t" - : "=&r"(res), "=&r" (dummy) - : "r"(y),"r"((int)x)); - return(res); -} - #undef MULT16_32_Q15 static inline spx_word32_t MULT16_32_Q15(spx_word16_t x, spx_word32_t y) { int res; @@ -109,7 +96,7 @@ static inline short DIV32_16(int a, int b) "\tsubs %3, %0, %1, asl #6 \n" "\tmovpl %0, %3 \n" "\torrpl %2, %2, %4, asl #6 \n" - + "\tsubs %3, %0, %1, asl #5 \n" "\tmovpl %0, %3 \n" "\torrpl %2, %2, %4, asl #5 \n" diff --git a/vendor/libspeex/libspeexdsp/fixed_arm5e.h b/vendor/libspeex/libspeexdsp/fixed_arm5e.h index 9b4861c9a7..15c6d5dee1 100644 --- a/vendor/libspeex/libspeexdsp/fixed_arm5e.h +++ b/vendor/libspeex/libspeexdsp/fixed_arm5e.h @@ -7,18 +7,18 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + - Neither the name of the Xiph.org Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -71,24 +71,6 @@ static inline spx_word32_t MAC16_32_Q15(spx_word32_t a, spx_word16_t x, spx_word return(res); } -#undef MULT16_32_Q11 -static inline spx_word32_t MULT16_32_Q11(spx_word16_t x, spx_word32_t y) { - int res; - asm ("smulwb %0,%1,%2;\n" - : "=&r"(res) - : "%r"(y<<5),"r"(x)); - return(res); -} - -#undef MAC16_32_Q11 -static inline spx_word32_t MAC16_32_Q11(spx_word32_t a, spx_word16_t x, spx_word32_t y) { - int res; - asm ("smlawb %0,%1,%2,%3;\n" - : "=&r"(res) - : "%r"(y<<5),"r"(x),"r"(a)); - return(res); -} - #undef DIV32_16 static inline short DIV32_16(int a, int b) { @@ -161,7 +143,7 @@ static inline short DIV32_16(int a, int b) "\tsubs %3, %0, %1 \n" "\torrpl %2, %2, %4 \n" "\tmovpl %0, %3 \n" - + "\tmovs %5, %5, lsr #31 \n" "\trsbne %2, %2, #0 \n" : "=r" (dead1), "=r" (dead2), "=r" (res), diff --git a/vendor/libspeex/libspeexdsp/fixed_bfin.h b/vendor/libspeex/libspeexdsp/fixed_bfin.h index 9eb21e3396..9a54d64e65 100644 --- a/vendor/libspeex/libspeexdsp/fixed_bfin.h +++ b/vendor/libspeex/libspeexdsp/fixed_bfin.h @@ -8,18 +8,18 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + - Neither the name of the Xiph.org Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -68,9 +68,9 @@ static inline spx_word16_t DIV32_16(spx_word32_t a, spx_word16_t b) { spx_word32_t res, bb; bb = b; - /* Make the roundinf consistent with the C version + /* Make the roundinf consistent with the C version (do we need to do that?)*/ - if (a<0) + if (a<0) a += (b-1); __asm__ ( "P0 = 15;\n\t" @@ -138,39 +138,4 @@ static inline spx_word32_t MAC16_32_Q15(spx_word32_t c, spx_word16_t a, spx_word return res; } -#undef MULT16_32_Q14 -static inline spx_word32_t MULT16_32_Q14(spx_word16_t a, spx_word32_t b) -{ - spx_word32_t res; - __asm__ - ( - "%2 <<= 1;\n\t" - "A1 = %1.L*%2.L (M);\n\t" - "A1 = A1 >>> 15;\n\t" - "%0 = (A1 += %1.L*%2.H);\n\t" - : "=W" (res), "=d" (a), "=d" (b) - : "1" (a), "2" (b) - : "A1", "ASTAT" - ); - return res; -} - -#undef MAC16_32_Q14 -static inline spx_word32_t MAC16_32_Q14(spx_word32_t c, spx_word16_t a, spx_word32_t b) -{ - spx_word32_t res; - __asm__ - ( - "%1 <<= 1;\n\t" - "A1 = %2.L*%1.L (M);\n\t" - "A1 = A1 >>> 15;\n\t" - "%0 = (A1 += %2.L*%1.H);\n\t" - "%0 = %0 + %4;\n\t" - : "=&W" (res), "=&d" (b) - : "d" (a), "1" (b), "d" (c) - : "A1", "ASTAT" - ); - return res; -} - #endif diff --git a/vendor/libspeex/libspeexdsp/fixed_debug.h b/vendor/libspeex/libspeexdsp/fixed_debug.h index 54f3866e8f..dbf02f191b 100644 --- a/vendor/libspeex/libspeexdsp/fixed_debug.h +++ b/vendor/libspeex/libspeexdsp/fixed_debug.h @@ -7,18 +7,18 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + - Neither the name of the Xiph.org Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -101,7 +101,7 @@ static inline int _EXTEND32(int x, char *file, int line) } #define SHR16(a, shift) _SHR16(a, shift, __FILE__, __LINE__) -static inline short _SHR16(int a, int shift, char *file, int line) +static inline short _SHR16(int a, int shift, char *file, int line) { int res; if (!VERIFY_SHORT(a) || !VERIFY_SHORT(shift)) @@ -115,7 +115,7 @@ static inline short _SHR16(int a, int shift, char *file, int line) return res; } #define SHL16(a, shift) _SHL16(a, shift, __FILE__, __LINE__) -static inline short _SHL16(int a, int shift, char *file, int line) +static inline short _SHL16(int a, int shift, char *file, int line) { int res; if (!VERIFY_SHORT(a) || !VERIFY_SHORT(shift)) @@ -129,7 +129,7 @@ static inline short _SHL16(int a, int shift, char *file, int line) return res; } -static inline int SHR32(long long a, int shift) +static inline int SHR32(long long a, int shift) { long long res; if (!VERIFY_INT(a) || !VERIFY_SHORT(shift)) @@ -144,7 +144,7 @@ static inline int SHR32(long long a, int shift) spx_mips++; return res; } -static inline int SHL32(long long a, int shift) +static inline int SHL32(long long a, int shift) { long long res; if (!VERIFY_INT(a) || !VERIFY_SHORT(shift)) @@ -171,7 +171,7 @@ static inline int SHL32(long long a, int shift) //#define SHL(a,shift) ((a) << (shift)) #define ADD16(a, b) _ADD16(a, b, __FILE__, __LINE__) -static inline short _ADD16(int a, int b, char *file, int line) +static inline short _ADD16(int a, int b, char *file, int line) { int res; if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) @@ -188,7 +188,7 @@ static inline short _ADD16(int a, int b, char *file, int line) } #define SUB16(a, b) _SUB16(a, b, __FILE__, __LINE__) -static inline short _SUB16(int a, int b, char *file, int line) +static inline short _SUB16(int a, int b, char *file, int line) { int res; if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) @@ -203,7 +203,7 @@ static inline short _SUB16(int a, int b, char *file, int line) } #define ADD32(a, b) _ADD32(a, b, __FILE__, __LINE__) -static inline int _ADD32(long long a, long long b, char *file, int line) +static inline int _ADD32(long long a, long long b, char *file, int line) { long long res; if (!VERIFY_INT(a) || !VERIFY_INT(b)) @@ -219,7 +219,7 @@ static inline int _ADD32(long long a, long long b, char *file, int line) return res; } -static inline int SUB32(long long a, long long b) +static inline int SUB32(long long a, long long b) { long long res; if (!VERIFY_INT(a) || !VERIFY_INT(b)) @@ -236,7 +236,7 @@ static inline int SUB32(long long a, long long b) #define ADD64(a,b) (MIPS_INC(a)+(b)) /* result fits in 16 bits */ -static inline short MULT16_16_16(int a, int b) +static inline short MULT16_16_16(int a, int b) { int res; if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) @@ -250,8 +250,23 @@ static inline short MULT16_16_16(int a, int b) return res; } +/* result fits in 32 bits */ +static inline int MULT16_32_32(int a, long long b) +{ + long long res; + if (!VERIFY_SHORT(a) || !VERIFY_INT(b)) + { + fprintf (stderr, "MULT16_32_32: inputs are not short+int: %d %d\n", a, (int)b); + } + res = a*b; + if (!VERIFY_INT(res)) + fprintf (stderr, "MULT16_32_32: output is not int: %d\n", (int)res); + spx_mips++; + return res; +} + #define MULT16_16(a, b) _MULT16_16(a, b, __FILE__, __LINE__) -static inline int _MULT16_16(int a, int b, char *file, int line) +static inline int _MULT16_16(int a, int b, char *file, int line) { long long res; if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) @@ -279,8 +294,8 @@ static inline int _MULT16_32_QX(int a, long long b, int Q, char *file, int line) { fprintf (stderr, "MULT16_32_Q%d: inputs are not short+int: %d %d in %s: line %d\n", Q, (int)a, (int)b, file, line); } - if (ABS32(b)>=(EXTEND32(1)<<(15+Q))) - fprintf (stderr, "MULT16_32_Q%d: second operand too large: %d %d in %s: line %d\n", Q, (int)a, (int)b, file, line); + if (ABS(b)>>(16+Q)) + fprintf (stderr, "MULT16_32_Q%d: second operand too large: %d %d in %s: line %d\n", Q, (int)a, (int)b, file, line); res = (((long long)a)*(long long)b) >> Q; if (!VERIFY_INT(res)) fprintf (stderr, "MULT16_32_Q%d: output is not int: %d*%d=%d in %s: line %d\n", Q, (int)a, (int)b,(int)res, file, line); @@ -295,8 +310,8 @@ static inline int MULT16_32_PX(int a, long long b, int Q) { fprintf (stderr, "MULT16_32_P%d: inputs are not short+int: %d %d\n", Q, (int)a, (int)b); } - if (ABS32(b)>=(EXTEND32(1)<<(15+Q))) - fprintf (stderr, "MULT16_32_Q%d: second operand too large: %d %d\n", Q, (int)a, (int)b); + if (ABS(b)>>(16+Q)) + fprintf (stderr, "MULT16_32_Q%d: second operand too large: %d %d\n", Q, (int)a, (int)b); res = ((((long long)a)*(long long)b) + ((EXTEND32(1)<>1))>> Q; if (!VERIFY_INT(res)) fprintf (stderr, "MULT16_32_P%d: output is not int: %d*%d=%d\n", Q, (int)a, (int)b,(int)res); @@ -305,11 +320,6 @@ static inline int MULT16_32_PX(int a, long long b, int Q) } -#define MULT16_32_Q11(a,b) MULT16_32_QX(a,b,11) -#define MAC16_32_Q11(c,a,b) ADD32((c),MULT16_32_Q11((a),(b))) -#define MULT16_32_Q12(a,b) MULT16_32_QX(a,b,12) -#define MULT16_32_Q13(a,b) MULT16_32_QX(a,b,13) -#define MULT16_32_Q14(a,b) MULT16_32_QX(a,b,14) #define MULT16_32_Q15(a,b) MULT16_32_QX(a,b,15) #define MULT16_32_P15(a,b) MULT16_32_PX(a,b,15) #define MAC16_32_Q15(c,a,b) ADD32((c),MULT16_32_Q15((a),(b))) @@ -323,7 +333,7 @@ static inline int SATURATE(int a, int b) return a; } -static inline int MULT16_16_Q11_32(int a, int b) +static inline int MULT16_16_Q11_32(int a, int b) { long long res; if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) @@ -337,7 +347,7 @@ static inline int MULT16_16_Q11_32(int a, int b) spx_mips+=3; return res; } -static inline short MULT16_16_Q13(int a, int b) +static inline short MULT16_16_Q13(int a, int b) { long long res; if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) @@ -351,7 +361,7 @@ static inline short MULT16_16_Q13(int a, int b) spx_mips+=3; return res; } -static inline short MULT16_16_Q14(int a, int b) +static inline short MULT16_16_Q14(int a, int b) { long long res; if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) @@ -365,7 +375,7 @@ static inline short MULT16_16_Q14(int a, int b) spx_mips+=3; return res; } -static inline short MULT16_16_Q15(int a, int b) +static inline short MULT16_16_Q15(int a, int b) { long long res; if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) @@ -382,7 +392,7 @@ static inline short MULT16_16_Q15(int a, int b) return res; } -static inline short MULT16_16_P13(int a, int b) +static inline short MULT16_16_P13(int a, int b) { long long res; if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) @@ -399,7 +409,7 @@ static inline short MULT16_16_P13(int a, int b) spx_mips+=4; return res; } -static inline short MULT16_16_P14(int a, int b) +static inline short MULT16_16_P14(int a, int b) { long long res; if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) @@ -416,7 +426,7 @@ static inline short MULT16_16_P14(int a, int b) spx_mips+=4; return res; } -static inline short MULT16_16_P15(int a, int b) +static inline short MULT16_16_P15(int a, int b) { long long res; if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b)) @@ -436,7 +446,7 @@ static inline short MULT16_16_P15(int a, int b) #define DIV32_16(a, b) _DIV32_16(a, b, __FILE__, __LINE__) -static inline int _DIV32_16(long long a, long long b, char *file, int line) +static inline int _DIV32_16(long long a, long long b, char *file, int line) { long long res; if (b==0) @@ -462,7 +472,7 @@ static inline int _DIV32_16(long long a, long long b, char *file, int line) } #define DIV32(a, b) _DIV32(a, b, __FILE__, __LINE__) -static inline int _DIV32(long long a, long long b, char *file, int line) +static inline int _DIV32(long long a, long long b, char *file, int line) { long long res; if (b==0) diff --git a/vendor/libspeex/libspeexdsp/fixed_generic.h b/vendor/libspeex/libspeexdsp/fixed_generic.h index 0e012e9ab1..09366c36ce 100644 --- a/vendor/libspeex/libspeexdsp/fixed_generic.h +++ b/vendor/libspeex/libspeexdsp/fixed_generic.h @@ -7,18 +7,18 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + - Neither the name of the Xiph.org Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -69,22 +69,18 @@ /* result fits in 16 bits */ -#define MULT16_16_16(a,b) ((((spx_word16_t)(a))*((spx_word16_t)(b)))) +#define MULT16_16_16(a,b) (((spx_word16_t)(a))*((spx_word16_t)(b))) +/* result fits in 32 bits */ +#define MULT16_32_32(a,b) (((spx_word16_t)(a))*((spx_word32_t)(b))) /* (spx_word32_t)(spx_word16_t) gives TI compiler a hint that it's 16x16->32 multiply */ #define MULT16_16(a,b) (((spx_word32_t)(spx_word16_t)(a))*((spx_word32_t)(spx_word16_t)(b))) #define MAC16_16(c,a,b) (ADD32((c),MULT16_16((a),(b)))) -#define MULT16_32_Q12(a,b) ADD32(MULT16_16((a),SHR((b),12)), SHR(MULT16_16((a),((b)&0x00000fff)),12)) -#define MULT16_32_Q13(a,b) ADD32(MULT16_16((a),SHR((b),13)), SHR(MULT16_16((a),((b)&0x00001fff)),13)) -#define MULT16_32_Q14(a,b) ADD32(MULT16_16((a),SHR((b),14)), SHR(MULT16_16((a),((b)&0x00003fff)),14)) - -#define MULT16_32_Q11(a,b) ADD32(MULT16_16((a),SHR((b),11)), SHR(MULT16_16((a),((b)&0x000007ff)),11)) -#define MAC16_32_Q11(c,a,b) ADD32(c,ADD32(MULT16_16((a),SHR((b),11)), SHR(MULT16_16((a),((b)&0x000007ff)),11))) -#define MULT16_32_P15(a,b) ADD32(MULT16_16((a),SHR((b),15)), PSHR(MULT16_16((a),((b)&0x00007fff)),15)) -#define MULT16_32_Q15(a,b) ADD32(MULT16_16((a),SHR((b),15)), SHR(MULT16_16((a),((b)&0x00007fff)),15)) -#define MAC16_32_Q15(c,a,b) ADD32(c,ADD32(MULT16_16((a),SHR((b),15)), SHR(MULT16_16((a),((b)&0x00007fff)),15))) +#define MULT16_32_P15(a,b) ADD32(MULT16_32_32(a,SHR((b),15)), PSHR(MULT16_16((a),((b)&0x00007fff)),15)) +#define MULT16_32_Q15(a,b) ADD32(MULT16_32_32(a,SHR((b),15)), SHR(MULT16_16((a),((b)&0x00007fff)),15)) +#define MAC16_32_Q15(c,a,b) ADD32(c,MULT16_32_Q15(a,b)) #define MAC16_16_Q11(c,a,b) (ADD32((c),SHR(MULT16_16((a),(b)),11))) diff --git a/vendor/libspeex/libspeexdsp/jitter.c b/vendor/libspeex/libspeexdsp/jitter.c index a077d8dd41..4441a821d1 100644 --- a/vendor/libspeex/libspeexdsp/jitter.c +++ b/vendor/libspeex/libspeexdsp/jitter.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002 Jean-Marc Valin +/* Copyright (C) 2002 Jean-Marc Valin File: speex_jitter.h Adaptive jitter buffer for Speex @@ -6,18 +6,18 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + - Neither the name of the Xiph.org Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -71,7 +71,7 @@ #define LT32(a,b) (((spx_int32_t)((a)-(b)))<0) #define LE32(a,b) (((spx_int32_t)((a)-(b)))<=0) -#define ROUND_DOWN(x, step) ((x)<0 ? ((x)-(step)+1)/(step)*(step) : (x)/(step)*(step)) +#define ROUND_DOWN(x, step) ((x)<0 ? ((x)-(step)+1)/(step)*(step) : (x)/(step)*(step)) #define MAX_TIMINGS 40 #define MAX_BUFFERS 3 @@ -101,7 +101,7 @@ static void tb_add(struct TimingBuffer *tb, spx_int16_t timing) tb->curr_count++; return; } - + /* Find where the timing info goes in the sorted list */ pos = 0; /* FIXME: Do bisection instead of linear search */ @@ -109,9 +109,9 @@ static void tb_add(struct TimingBuffer *tb, spx_int16_t timing) { pos++; } - + speex_assert(pos <= tb->filled && pos < MAX_TIMINGS); - + /* Shift everything so we can perform the insertion */ if (pos < tb->filled) { @@ -124,7 +124,7 @@ static void tb_add(struct TimingBuffer *tb, spx_int16_t timing) /* Insert */ tb->timing[pos] = timing; tb->counts[pos] = tb->curr_count; - + tb->curr_count++; if (tb->filledfilled++; @@ -137,12 +137,12 @@ struct JitterBuffer_ { spx_uint32_t pointer_timestamp; /**< Timestamp of what we will *get* next */ spx_uint32_t last_returned_timestamp; /**< Useful for getting the next packet with the same timestamp (for fragmented media) */ spx_uint32_t next_stop; /**< Estimated time the next get() will be called */ - + spx_int32_t buffered; /**< Amount of data we think is still buffered by the application (timestamp units)*/ - + JitterBufferPacket packets[SPEEX_JITTER_MAX_BUFFER_SIZE]; /**< Packets stored in the buffer */ spx_uint32_t arrival[SPEEX_JITTER_MAX_BUFFER_SIZE]; /**< Packet arrival time (0 means it was late, even though it's a valid timestamp) */ - + void (*destroy) (void *); /**< Callback for destroying a packet */ spx_int32_t delay_step; /**< Size of the steps when adjusting buffering (timestamp units) */ @@ -152,7 +152,7 @@ struct JitterBuffer_ { int late_cutoff; /**< How late must a packet be for it not to be considered at all */ int interp_requested; /**< An interpolation is requested by speex_jitter_update_delay() */ int auto_adjust; /**< Whether to automatically adjust the delay at any time */ - + struct TimingBuffer _tb[MAX_BUFFERS]; /**< Don't use those directly */ struct TimingBuffer *timeBuffers[MAX_BUFFERS]; /**< Storing arrival time of latest frames so we can compute some stats */ int window_size; /**< Total window over which the late frames are counted */ @@ -160,15 +160,15 @@ struct JitterBuffer_ { int max_late_rate; /**< Absolute maximum amount of late packets tolerable (in percent) */ int latency_tradeoff; /**< Latency equivalent of losing one percent of packets */ int auto_tradeoff; /**< Latency equivalent of losing one percent of packets (automatic default) */ - + int lost_count; /**< Number of consecutive lost packets */ }; -/** Based on available data, this computes the optimal delay for the jitter buffer. +/** Based on available data, this computes the optimal delay for the jitter buffer. The optimised function is in timestamp units and is: cost = delay + late_factor*[number of frames that would be late if we used that delay] @param tb Array of buffers - @param late_factor Equivalent cost of a late frame (in timestamp units) + @param late_factor Equivalent cost of a late frame (in timestamp units) */ static spx_int16_t compute_opt_delay(JitterBuffer *jitter) { @@ -184,34 +184,34 @@ static spx_int16_t compute_opt_delay(JitterBuffer *jitter) int worst = 0; spx_int32_t deltaT; struct TimingBuffer *tb; - + tb = jitter->_tb; - + /* Number of packet timings we have received (including those we didn't keep) */ tot_count = 0; for (i=0;ilatency_tradeoff != 0) late_factor = jitter->latency_tradeoff * 100.0f / tot_count; else late_factor = jitter->auto_tradeoff * jitter->window_size/tot_count; - + /*fprintf(stderr, "late_factor = %f\n", late_factor);*/ for (i=0;idelay_step); pos[next]++; - + /* Actual cost function that tells us how bad using this delay would be */ cost = -latest + late_factor*late; /*fprintf(stderr, "cost %d = %d + %f * %d\n", cost, -latest, late_factor, late);*/ @@ -241,7 +241,7 @@ static spx_int16_t compute_opt_delay(JitterBuffer *jitter) } else { break; } - + /* For the next timing we will consider, there will be one more late packet to count */ late++; /* Two-frame penalty if we're going to increase the amount of late frames (hysteresis) */ @@ -251,14 +251,14 @@ static spx_int16_t compute_opt_delay(JitterBuffer *jitter) late+=4; } } - + deltaT = best-worst; /* This is a default "automatic latency tradeoff" when none is provided */ jitter->auto_tradeoff = 1 + deltaT/TOP_DELAY; /*fprintf(stderr, "auto_tradeoff = %d (%d %d %d)\n", jitter->auto_tradeoff, best, worst, i);*/ - + /* FIXME: Compute a short-term estimate too and combine with the long-term one */ - + /* Prevents reducing the buffer size when we haven't really had much data */ if (tot_count < TOP_DELAY && opt > 0) return 0; @@ -313,7 +313,7 @@ EXPORT void jitter_buffer_reset(JitterBuffer *jitter) jitter->lost_count = 0; jitter->buffered = 0; jitter->auto_tradeoff = 32000; - + for (i=0;i_tb[i]); @@ -368,7 +368,7 @@ EXPORT void jitter_buffer_put(JitterBuffer *jitter, const JitterBufferPacket *pa int i,j; int late; /*fprintf (stderr, "put packet %d %d\n", timestamp, span);*/ - + /* Cleanup buffer (remove old packets that weren't played) */ if (!jitter->reset_state) { @@ -386,7 +386,7 @@ EXPORT void jitter_buffer_put(JitterBuffer *jitter, const JitterBufferPacket *pa } } } - + /*fprintf(stderr, "arrival: %d %d %d\n", packet->timestamp, jitter->next_stop, jitter->pointer_timestamp);*/ /* Check if packet is late (could still be useful though) */ if (!jitter->reset_state && LT32(packet->timestamp, jitter->next_stop)) @@ -403,7 +403,7 @@ EXPORT void jitter_buffer_put(JitterBuffer *jitter, const JitterBufferPacket *pa { jitter_buffer_reset(jitter); } - + /* Only insert the packet if it's not hopelessly late (i.e. totally useless) */ if (jitter->reset_state || GE32(packet->timestamp+packet->span+jitter->delay_step, jitter->pointer_timestamp)) { @@ -414,7 +414,7 @@ EXPORT void jitter_buffer_put(JitterBuffer *jitter, const JitterBufferPacket *pa if (jitter->packets[i].data==NULL) break; } - + /*No place left in the buffer, need to make room for it by discarding the oldest packet */ if (i==SPEEX_JITTER_MAX_BUFFER_SIZE) { @@ -433,9 +433,9 @@ EXPORT void jitter_buffer_put(JitterBuffer *jitter, const JitterBufferPacket *pa else speex_free(jitter->packets[i].data); jitter->packets[i].data=NULL; - /*fprintf (stderr, "Buffer is full, discarding earliest frame %d (currently at %d)\n", timestamp, jitter->pointer_timestamp);*/ + /*fprintf (stderr, "Buffer is full, discarding earliest frame %d (currently at %d)\n", timestamp, jitter->pointer_timestamp);*/ } - + /* Copy packet in buffer */ if (jitter->destroy) { @@ -455,8 +455,8 @@ EXPORT void jitter_buffer_put(JitterBuffer *jitter, const JitterBufferPacket *pa else jitter->arrival[i] = jitter->next_stop; } - - + + } /** Get one packet from the jitter buffer */ @@ -465,7 +465,7 @@ EXPORT int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, s int i; unsigned int j; spx_int16_t opt; - + if (start_offset != NULL) *start_offset = 0; @@ -485,7 +485,7 @@ EXPORT int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, s } if (found) { - jitter->reset_state=0; + jitter->reset_state=0; jitter->pointer_timestamp = oldest; jitter->next_stop = oldest; } else { @@ -494,36 +494,36 @@ EXPORT int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, s return JITTER_BUFFER_MISSING; } } - + jitter->last_returned_timestamp = jitter->pointer_timestamp; - + if (jitter->interp_requested != 0) { packet->timestamp = jitter->pointer_timestamp; packet->span = jitter->interp_requested; - + /* Increment the pointer because it got decremented in the delay update */ jitter->pointer_timestamp += jitter->interp_requested; packet->len = 0; /*fprintf (stderr, "Deferred interpolate\n");*/ - + jitter->interp_requested = 0; - + jitter->buffered = packet->span - desired_span; return JITTER_BUFFER_INSERTION; } - + /* Searching for the packet that fits best */ - + /* Search the buffer for a packet with the right timestamp and spanning the whole current chunk */ for (i=0;ipackets[i].data && jitter->packets[i].timestamp==jitter->pointer_timestamp && GE32(jitter->packets[i].timestamp+jitter->packets[i].span,jitter->pointer_timestamp+desired_span)) break; } - + /* If no match, try for an "older" packet that still spans (fully) the current chunk */ if (i==SPEEX_JITTER_MAX_BUFFER_SIZE) { @@ -533,7 +533,7 @@ EXPORT int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, s break; } } - + /* If still no match, try for an "older" packet that spans part of the current chunk */ if (i==SPEEX_JITTER_MAX_BUFFER_SIZE) { @@ -543,7 +543,7 @@ EXPORT int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, s break; } } - + /* If still no match, try for earliest packet possible */ if (i==SPEEX_JITTER_MAX_BUFFER_SIZE) { @@ -576,17 +576,17 @@ EXPORT int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, s if (i!=SPEEX_JITTER_MAX_BUFFER_SIZE) { spx_int32_t offset; - + /* We (obviously) haven't lost this packet */ jitter->lost_count = 0; - + /* In this case, 0 isn't as a valid timestamp */ if (jitter->arrival[i] != 0) { update_timings(jitter, ((spx_int32_t)jitter->packets[i].timestamp) - ((spx_int32_t)jitter->arrival[i]) - jitter->buffer_margin); } - - + + /* Copy packet */ if (jitter->destroy) { @@ -611,10 +611,10 @@ EXPORT int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, s *start_offset = offset; else if (offset != 0) speex_warning_int("jitter_buffer_get() discarding non-zero start_offset", offset); - + packet->timestamp = jitter->packets[i].timestamp; jitter->last_returned_timestamp = packet->timestamp; - + packet->span = jitter->packets[i].span; packet->sequence = jitter->packets[i].sequence; packet->user_data = jitter->packets[i].user_data; @@ -622,36 +622,36 @@ EXPORT int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, s jitter->pointer_timestamp = jitter->packets[i].timestamp+jitter->packets[i].span; jitter->buffered = packet->span - desired_span; - + if (start_offset != NULL) jitter->buffered += *start_offset; - + return JITTER_BUFFER_OK; } - - + + /* If we haven't found anything worth returning */ - + /*fprintf (stderr, "not found\n");*/ jitter->lost_count++; /*fprintf (stderr, "m");*/ /*fprintf (stderr, "lost_count = %d\n", jitter->lost_count);*/ - + opt = compute_opt_delay(jitter); - - /* Should we force an increase in the buffer or just do normal interpolation? */ + + /* Should we force an increase in the buffer or just do normal interpolation? */ if (opt < 0) { /* Need to increase buffering */ - + /* Shift histogram to compensate */ shift_timings(jitter, -opt); - + packet->timestamp = jitter->pointer_timestamp; packet->span = -opt; /* Don't move the pointer_timestamp forward */ packet->len = 0; - + jitter->buffered = packet->span - desired_span; return JITTER_BUFFER_INSERTION; /*jitter->pointer_timestamp -= jitter->delay_step;*/ @@ -659,12 +659,12 @@ EXPORT int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, s } else { /* Normal packet loss */ packet->timestamp = jitter->pointer_timestamp; - + desired_span = ROUND_DOWN(desired_span, jitter->concealment_size); packet->span = desired_span; jitter->pointer_timestamp += desired_span; packet->len = 0; - + jitter->buffered = packet->span - desired_span; return JITTER_BUFFER_MISSING; /*fprintf (stderr, "Normal loss\n");*/ @@ -713,11 +713,11 @@ static int _jitter_buffer_update_delay(JitterBuffer *jitter, JitterBufferPacket { spx_int16_t opt = compute_opt_delay(jitter); /*fprintf(stderr, "opt adjustment is %d ", opt);*/ - + if (opt < 0) { shift_timings(jitter, -opt); - + jitter->pointer_timestamp += opt; jitter->interp_requested = -opt; /*fprintf (stderr, "Decision to interpolate %d samples\n", -opt);*/ @@ -727,14 +727,14 @@ static int _jitter_buffer_update_delay(JitterBuffer *jitter, JitterBufferPacket jitter->pointer_timestamp += opt; /*fprintf (stderr, "Decision to drop %d samples\n", opt);*/ } - + return opt; } /* Let the jitter buffer know it's the right time to adjust the buffering delay to the network conditions */ EXPORT int jitter_buffer_update_delay(JitterBuffer *jitter, JitterBufferPacket *packet, spx_int32_t *start_offset) { - /* If the programmer calls jitter_buffer_update_delay() directly, + /* If the programmer calls jitter_buffer_update_delay() directly, automatically disable auto-adjustment */ jitter->auto_adjust = 0; @@ -752,7 +752,7 @@ EXPORT void jitter_buffer_tick(JitterBuffer *jitter) /* Automatically-adjust the buffering delay if requested */ if (jitter->auto_adjust) _jitter_buffer_update_delay(jitter, NULL, NULL); - + if (jitter->buffered >= 0) { jitter->next_stop = jitter->pointer_timestamp - jitter->buffered; @@ -768,7 +768,7 @@ EXPORT void jitter_buffer_remaining_span(JitterBuffer *jitter, spx_uint32_t rem) /* Automatically-adjust the buffering delay if requested */ if (jitter->auto_adjust) _jitter_buffer_update_delay(jitter, NULL, NULL); - + if (jitter->buffered < 0) speex_warning_int("jitter buffer sees negative buffering, your code might be broken. Value is ", jitter->buffered); jitter->next_stop = jitter->pointer_timestamp - rem; diff --git a/vendor/libspeex/libspeexdsp/kiss_fft.c b/vendor/libspeex/libspeexdsp/kiss_fft.c index 67782810fe..8dc9345428 100644 --- a/vendor/libspeex/libspeexdsp/kiss_fft.c +++ b/vendor/libspeex/libspeexdsp/kiss_fft.c @@ -23,7 +23,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND #include "os_support.h" /* The guts header contains all the multiplication and addition macros that are defined for - fixed or floating point complex numbers. It also delares the kf_ internal functions. + fixed or floating point complex numbers. It also declares the kf_ internal functions. */ static void kf_bfly2( @@ -110,7 +110,7 @@ static void kf_bfly4( C_MUL(scratch[0],Fout[m] , *tw1 ); C_MUL(scratch[1],Fout[m2] , *tw2 ); C_MUL(scratch[2],Fout[m3] , *tw3 ); - + C_SUB( scratch[5] , *Fout, scratch[1] ); C_ADDTO(*Fout, scratch[1]); C_ADD( scratch[3] , scratch[0] , scratch[2] ); @@ -120,7 +120,7 @@ static void kf_bfly4( tw2 += fstride*2; tw3 += fstride*3; C_ADDTO( *Fout , scratch[3] ); - + Fout[m].r = scratch[5].r - scratch[4].i; Fout[m].i = scratch[5].i + scratch[4].r; Fout[m3].r = scratch[5].r + scratch[4].i; @@ -140,7 +140,7 @@ static void kf_bfly4( C_MUL4(scratch[0],Fout[m] , *tw1 ); C_MUL4(scratch[1],Fout[m2] , *tw2 ); C_MUL4(scratch[2],Fout[m3] , *tw3 ); - + Fout->r = PSHR16(Fout->r, 2); Fout->i = PSHR16(Fout->i, 2); C_SUB( scratch[5] , *Fout, scratch[1] ); @@ -154,7 +154,7 @@ static void kf_bfly4( tw2 += fstride*2; tw3 += fstride*3; C_ADDTO( *Fout , scratch[3] ); - + Fout[m].r = scratch[5].r + scratch[4].i; Fout[m].i = scratch[5].i - scratch[4].r; Fout[m3].r = scratch[5].r - scratch[4].i; @@ -292,7 +292,7 @@ static void kf_bfly_generic( /*CHECKBUF(scratchbuf,nscratchbuf,p);*/ if (p>17) speex_fatal("KissFFT: max radix supported is 17"); - + for ( u=0; unfft); diff --git a/vendor/libspeex/libspeexdsp/kiss_fft.h b/vendor/libspeex/libspeexdsp/kiss_fft.h index fa3f2c6042..bb19eadbd9 100644 --- a/vendor/libspeex/libspeexdsp/kiss_fft.h +++ b/vendor/libspeex/libspeexdsp/kiss_fft.h @@ -26,13 +26,13 @@ extern "C" { # include # define kiss_fft_scalar __m128 #define KISS_FFT_MALLOC(nbytes) memalign(16,nbytes) -#else +#else #define KISS_FFT_MALLOC speex_alloc -#endif +#endif #ifdef FIXED_POINT -#include "arch.h" +#include "arch.h" # define kiss_fft_scalar spx_int16_t #else # ifndef kiss_fft_scalar @@ -48,9 +48,9 @@ typedef struct { typedef struct kiss_fft_state* kiss_fft_cfg; -/* +/* * kiss_fft_alloc - * + * * Initialize a FFT (or IFFT) algorithm's cfg/state buffer. * * typical usage: kiss_fft_cfg mycfg=kiss_fft_alloc(1024,0,NULL,NULL); @@ -60,18 +60,18 @@ typedef struct kiss_fft_state* kiss_fft_cfg; * * If lenmem is NULL, then kiss_fft_alloc will allocate a cfg buffer using malloc. * The returned value should be free()d when done to avoid memory leaks. - * + * * The state can be placed in a user supplied buffer 'mem': * If lenmem is not NULL and mem is not NULL and *lenmem is large enough, * then the function places the cfg in mem and the size used in *lenmem * and returns mem. - * + * * If lenmem is not NULL and ( mem is NULL or *lenmem is not large enough), - * then the function returns NULL and places the minimum cfg + * then the function returns NULL and places the minimum cfg * buffer size in *lenmem. * */ -kiss_fft_cfg kiss_fft_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem); +kiss_fft_cfg kiss_fft_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem); /* * kiss_fft(cfg,in_out_buf) @@ -90,19 +90,19 @@ void kiss_fft(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout); * */ void kiss_fft_stride(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout,int fin_stride); -/* If kiss_fft_alloc allocated a buffer, it is one contiguous +/* If kiss_fft_alloc allocated a buffer, it is one contiguous buffer and can be simply free()d when no longer needed*/ #define kiss_fft_free speex_free /* - Cleans up some memory that gets managed internally. Not necessary to call, but it might clean up + Cleans up some memory that gets managed internally. Not necessary to call, but it might clean up your compiler output to call this before you exit. */ void kiss_fft_cleanup(void); - + #ifdef __cplusplus -} +} #endif #endif diff --git a/vendor/libspeex/libspeexdsp/kiss_fftr.c b/vendor/libspeex/libspeexdsp/kiss_fftr.c index f6275b8794..827e0b14df 100644 --- a/vendor/libspeex/libspeexdsp/kiss_fftr.c +++ b/vendor/libspeex/libspeexdsp/kiss_fftr.c @@ -24,9 +24,9 @@ struct kiss_fftr_state{ kiss_fft_cfg substate; kiss_fft_cpx * tmpbuf; kiss_fft_cpx * super_twiddles; -#ifdef USE_SIMD +#ifdef USE_SIMD long pad; -#endif +#endif }; kiss_fftr_cfg kiss_fftr_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem) @@ -96,12 +96,12 @@ void kiss_fftr(kiss_fftr_cfg st,const kiss_fft_scalar *timedata,kiss_fft_cpx *fr * contains the sum of the even-numbered elements of the input time sequence * The imag part is the sum of the odd-numbered elements * - * The sum of tdc.r and tdc.i is the sum of the input time sequence. + * The sum of tdc.r and tdc.i is the sum of the input time sequence. * yielding DC of input time sequence - * The difference of tdc.r - tdc.i is the sum of the input (dot product) [1,-1,1,-1... + * The difference of tdc.r - tdc.i is the sum of the input (dot product) [1,-1,1,-1... * yielding Nyquist bin of input time sequence */ - + tdc.r = st->tmpbuf[0].r; tdc.i = st->tmpbuf[0].i; C_FIXDIV(tdc,2); @@ -109,14 +109,14 @@ void kiss_fftr(kiss_fftr_cfg st,const kiss_fft_scalar *timedata,kiss_fft_cpx *fr CHECK_OVERFLOW_OP(tdc.r ,-, tdc.i); freqdata[0].r = tdc.r + tdc.i; freqdata[ncfft].r = tdc.r - tdc.i; -#ifdef USE_SIMD +#ifdef USE_SIMD freqdata[ncfft].i = freqdata[0].i = _mm_set1_ps(0); #else freqdata[ncfft].i = freqdata[0].i = 0; #endif for ( k=1;k <= ncfft/2 ; ++k ) { - fpk = st->tmpbuf[k]; + fpk = st->tmpbuf[k]; fpnk.r = st->tmpbuf[ncfft-k].r; fpnk.i = - st->tmpbuf[ncfft-k].i; C_FIXDIV(fpk,2); @@ -161,7 +161,7 @@ void kiss_fftri(kiss_fftr_cfg st,const kiss_fft_cpx *freqdata, kiss_fft_scalar * C_MUL (fok, tmp, st->super_twiddles[k]); C_ADD (st->tmpbuf[k], fek, fok); C_SUB (st->tmpbuf[ncfft - k], fek, fok); -#ifdef USE_SIMD +#ifdef USE_SIMD st->tmpbuf[ncfft - k].i *= _mm_set1_ps(-1.0); #else st->tmpbuf[ncfft - k].i *= -1; @@ -189,12 +189,12 @@ void kiss_fftr2(kiss_fftr_cfg st,const kiss_fft_scalar *timedata,kiss_fft_scalar * contains the sum of the even-numbered elements of the input time sequence * The imag part is the sum of the odd-numbered elements * - * The sum of tdc.r and tdc.i is the sum of the input time sequence. + * The sum of tdc.r and tdc.i is the sum of the input time sequence. * yielding DC of input time sequence - * The difference of tdc.r - tdc.i is the sum of the input (dot product) [1,-1,1,-1... + * The difference of tdc.r - tdc.i is the sum of the input (dot product) [1,-1,1,-1... * yielding Nyquist bin of input time sequence */ - + tdc.r = st->tmpbuf[0].r; tdc.i = st->tmpbuf[0].i; C_FIXDIV(tdc,2); @@ -205,7 +205,7 @@ void kiss_fftr2(kiss_fftr_cfg st,const kiss_fft_scalar *timedata,kiss_fft_scalar for ( k=1;k <= ncfft/2 ; ++k ) { - /*fpk = st->tmpbuf[k]; + /*fpk = st->tmpbuf[k]; fpnk.r = st->tmpbuf[ncfft-k].r; fpnk.i = - st->tmpbuf[ncfft-k].i; C_FIXDIV(fpk,2); @@ -213,7 +213,7 @@ void kiss_fftr2(kiss_fftr_cfg st,const kiss_fft_scalar *timedata,kiss_fft_scalar C_ADD( f1k, fpk , fpnk ); C_SUB( f2k, fpk , fpnk ); - + C_MUL( tw , f2k , st->super_twiddles[k]); freqdata[2*k-1] = HALF_OF(f1k.r + tw.r); @@ -226,7 +226,7 @@ void kiss_fftr2(kiss_fftr_cfg st,const kiss_fft_scalar *timedata,kiss_fft_scalar f1k.i = PSHR32(SUB32(EXTEND32(st->tmpbuf[k].i), EXTEND32(st->tmpbuf[ncfft-k].i)),1); f2k.r = PSHR32(SUB32(EXTEND32(st->tmpbuf[k].r), EXTEND32(st->tmpbuf[ncfft-k].r)),1); f2k.i = SHR32(ADD32(EXTEND32(st->tmpbuf[k].i), EXTEND32(st->tmpbuf[ncfft-k].i)),1); - + C_MUL( tw , f2k , st->super_twiddles[k]); freqdata[2*k-1] = HALF_OF(f1k.r + tw.r); @@ -236,13 +236,13 @@ void kiss_fftr2(kiss_fftr_cfg st,const kiss_fft_scalar *timedata,kiss_fft_scalar */ f2k.r = SHR32(SUB32(EXTEND32(st->tmpbuf[k].r), EXTEND32(st->tmpbuf[ncfft-k].r)),1); f2k.i = PSHR32(ADD32(EXTEND32(st->tmpbuf[k].i), EXTEND32(st->tmpbuf[ncfft-k].i)),1); - + f1kr = SHL32(ADD32(EXTEND32(st->tmpbuf[k].r), EXTEND32(st->tmpbuf[ncfft-k].r)),13); f1ki = SHL32(SUB32(EXTEND32(st->tmpbuf[k].i), EXTEND32(st->tmpbuf[ncfft-k].i)),13); - + twr = SHR32(SUB32(MULT16_16(f2k.r,st->super_twiddles[k].r),MULT16_16(f2k.i,st->super_twiddles[k].i)), 1); twi = SHR32(ADD32(MULT16_16(f2k.i,st->super_twiddles[k].r),MULT16_16(f2k.r,st->super_twiddles[k].i)), 1); - + #ifdef FIXED_POINT freqdata[2*k-1] = PSHR32(f1kr + twr, 15); freqdata[2*k] = PSHR32(f1ki + twi, 15); @@ -253,7 +253,7 @@ void kiss_fftr2(kiss_fftr_cfg st,const kiss_fft_scalar *timedata,kiss_fft_scalar freqdata[2*k] = .5f*(f1ki + twi); freqdata[2*(ncfft-k)-1] = .5f*(f1kr - twr); freqdata[2*(ncfft-k)] = .5f*(twi - f1ki); - + #endif } } @@ -287,7 +287,7 @@ void kiss_fftri2(kiss_fftr_cfg st,const kiss_fft_scalar *freqdata,kiss_fft_scala C_MUL (fok, tmp, st->super_twiddles[k]); C_ADD (st->tmpbuf[k], fek, fok); C_SUB (st->tmpbuf[ncfft - k], fek, fok); -#ifdef USE_SIMD +#ifdef USE_SIMD st->tmpbuf[ncfft - k].i *= _mm_set1_ps(-1.0); #else st->tmpbuf[ncfft - k].i *= -1; diff --git a/vendor/libspeex/libspeexdsp/kiss_fftr.h b/vendor/libspeex/libspeexdsp/kiss_fftr.h index 7bfb423340..8cfeda138a 100644 --- a/vendor/libspeex/libspeexdsp/kiss_fftr.h +++ b/vendor/libspeex/libspeexdsp/kiss_fftr.h @@ -6,13 +6,13 @@ extern "C" { #endif - -/* - + +/* + Real optimized version can save about 45% cpu time vs. complex fft of a real seq. - - + + */ typedef struct kiss_fftr_state *kiss_fftr_cfg; @@ -22,7 +22,7 @@ kiss_fftr_cfg kiss_fftr_alloc(int nfft,int inverse_fft,void * mem, size_t * lenm /* nfft must be even - If you don't care to allocate space, use mem = lenmem = NULL + If you don't care to allocate space, use mem = lenmem = NULL */ diff --git a/vendor/libspeex/libspeexdsp/math_approx.h b/vendor/libspeex/libspeexdsp/math_approx.h index 9ca830755d..596dfdc1b7 100644 --- a/vendor/libspeex/libspeexdsp/math_approx.h +++ b/vendor/libspeex/libspeexdsp/math_approx.h @@ -7,18 +7,18 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + - Neither the name of the Xiph.org Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -168,11 +168,11 @@ static inline spx_word16_t spx_acos(spx_word16_t x) x = NEG16(x); } x = SUB16(16384,x); - + x = x >> 1; sq = MULT16_16_Q13(x, ADD16(A1, MULT16_16_Q13(x, ADD16(A2, MULT16_16_Q13(x, (A3)))))); ret = spx_sqrt(SHL32(EXTEND32(sq),13)); - + /*ret = spx_sqrt(67108864*(-1.6129e-04 + 2.0104e+00*f + 2.7373e-01*f*f + 1.8136e-01*f*f*f));*/ if (s) ret = SUB16(25736,ret); @@ -208,7 +208,7 @@ static inline spx_word16_t spx_cos(spx_word16_t x) static inline spx_word16_t _spx_cos_pi_2(spx_word16_t x) { spx_word16_t x2; - + x2 = MULT16_16_P15(x,x); return ADD16(1,MIN16(32766,ADD32(SUB16(L1,x2), MULT16_16_P15(x2, ADD32(L2, MULT16_16_P15(x2, ADD32(L3, MULT16_16_P15(L4, x2)))))))); } diff --git a/vendor/libspeex/libspeexdsp/mdf.c b/vendor/libspeex/libspeexdsp/mdf.c index 456ab847e4..7b367f9a88 100644 --- a/vendor/libspeex/libspeexdsp/mdf.c +++ b/vendor/libspeex/libspeexdsp/mdf.c @@ -33,36 +33,36 @@ /* The echo canceller is based on the MDF algorithm described in: - J. S. Soo, K. K. Pang Multidelay block frequency adaptive filter, - IEEE Trans. Acoust. Speech Signal Process., Vol. ASSP-38, No. 2, + J. S. Soo, K. K. Pang Multidelay block frequency adaptive filter, + IEEE Trans. Acoust. Speech Signal Process., Vol. ASSP-38, No. 2, February 1990. - - We use the Alternatively Updated MDF (AUMDF) variant. Robustness to + + We use the Alternatively Updated MDF (AUMDF) variant. Robustness to double-talk is achieved using a variable learning rate as described in: - - Valin, J.-M., On Adjusting the Learning Rate in Frequency Domain Echo + + Valin, J.-M., On Adjusting the Learning Rate in Frequency Domain Echo Cancellation With Double-Talk. IEEE Transactions on Audio, Speech and Language Processing, Vol. 15, No. 3, pp. 1030-1034, 2007. http://people.xiph.org/~jm/papers/valin_taslp2006.pdf - + There is no explicit double-talk detection, but a continuous variation in the learning rate based on residual echo, double-talk and background noise. - + About the fixed-point version: - All the signals are represented with 16-bit words. The filter weights + All the signals are represented with 16-bit words. The filter weights are represented with 32-bit words, but only the top 16 bits are used in most cases. The lower 16 bits are completely unreliable (due to the fact that the update is done only on the top bits), but help in the adaptation -- probably by removing a "threshold effect" due to quantization (rounding going to zero) when the gradient is small. - + Another kludge that seems to work good: when performing the weight update, we only move half the way toward the "goal" this seems to reduce the effect of quantization noise in the update phase. This can be seen as applying a gradient descent on a "soft constraint" instead of having a hard constraint. - + */ #ifdef HAVE_CONFIG_H @@ -88,12 +88,6 @@ #define WEIGHT_SHIFT 0 #endif -#ifdef FIXED_POINT -#define WORD2INT(x) ((x) < -32767 ? -32768 : ((x) > 32766 ? 32767 : (x))) -#else -#define WORD2INT(x) ((x) < -32767.5f ? -32768 : ((x) > 32766.5f ? 32767 : floor(.5+(x)))) -#endif - /* If enabled, the AEC will use a foreground filter and a background filter to be more robust to double-talk and difficult signals in general. The cost is an extra FFT and a matrix-vector multiply */ #define TWO_PATH @@ -145,7 +139,7 @@ struct SpeexEchoState_ { spx_word16_t beta_max; spx_word32_t sum_adapt; spx_word16_t leak_estimate; - + spx_word16_t *e; /* scratch */ spx_word16_t *x; /* Far-end input buffer (2N) */ spx_word16_t *X; /* Far-end buffer (M+1 frames) in frequency domain */ @@ -198,7 +192,7 @@ static inline void filter_dc_notch16(const spx_int16_t *in, spx_word16_t radius, den2 = MULT16_16_Q15(radius,radius) + MULT16_16_Q15(QCONST16(.7,15),MULT16_16_Q15(32767-radius,32767-radius)); #else den2 = radius*radius + .7*(1-radius)*(1-radius); -#endif +#endif /*printf ("%d %d %d %d %d %d\n", num[0], num[1], num[2], den[0], den[1], den[2]);*/ for (i=0;iframe_size = frame_size; st->window_size = 2*frame_size; N = st->window_size; @@ -442,7 +436,7 @@ EXPORT SpeexEchoState *speex_echo_state_init_mc(int frame_size, int filter_lengt st->leak_estimate = 0; st->fft_table = spx_fft_init(N); - + st->e = (spx_word16_t*)speex_alloc(C*N*sizeof(spx_word16_t)); st->x = (spx_word16_t*)speex_alloc(K*N*sizeof(spx_word16_t)); st->input = (spx_word16_t*)speex_alloc(C*st->frame_size*sizeof(spx_word16_t)); @@ -498,7 +492,7 @@ EXPORT SpeexEchoState *speex_echo_state_init_mc(int frame_size, int filter_lengt st->prop[i] = DIV32(MULT16_16(QCONST16(.8f,15), st->prop[i]),sum); } } - + st->memX = (spx_word16_t*)speex_alloc(K*sizeof(spx_word16_t)); st->memD = (spx_word16_t*)speex_alloc(C*sizeof(spx_word16_t)); st->memE = (spx_word16_t*)speex_alloc(C*sizeof(spx_word16_t)); @@ -513,16 +507,16 @@ EXPORT SpeexEchoState *speex_echo_state_init_mc(int frame_size, int filter_lengt st->notch_mem = (spx_mem_t*)speex_alloc(2*C*sizeof(spx_mem_t)); st->adapted = 0; st->Pey = st->Pyy = FLOAT_ONE; - + #ifdef TWO_PATH st->Davg1 = st->Davg2 = 0; st->Dvar1 = st->Dvar2 = FLOAT_ZERO; #endif - + st->play_buf = (spx_int16_t*)speex_alloc(K*(PLAYBACK_DELAY+1)*st->frame_size*sizeof(spx_int16_t)); st->play_buf_pos = PLAYBACK_DELAY*st->frame_size; st->play_buf_started = 0; - + return st; } @@ -624,7 +618,7 @@ EXPORT void speex_echo_state_destroy(SpeexEchoState *st) speex_free(st->play_buf); speex_free(st); - + #ifdef DUMP_ECHO_CANCEL_DATA fclose(rFile); fclose(pFile); @@ -704,7 +698,7 @@ EXPORT void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *in, c spx_float_t alpha, alpha_1; spx_word16_t RER; spx_word32_t tmp32; - + N = st->window_size; M = st->M; C = st->C; @@ -736,7 +730,7 @@ EXPORT void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *in, c tmp32 = 32767; if (st->saturated == 0) st->saturated = 1; - } + } if (tmp32 < -32767) { tmp32 = -32767; @@ -762,18 +756,18 @@ EXPORT void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *in, c { tmp32 = 32767; st->saturated = M+1; - } + } if (tmp32 < -32767) { tmp32 = -32767; st->saturated = M+1; - } + } #endif st->x[speak*N+i+st->frame_size] = EXTRACT16(tmp32); st->memX[speak] = far_end[i*K+speak]; } - } - + } + for (speak = 0; speak < K; speak++) { /* Shift memory: this could be optimized eventually*/ @@ -785,15 +779,15 @@ EXPORT void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *in, c /* Convert x (echo input) to frequency domain */ spx_fft(st->fft_table, st->x+speak*N, &st->X[speak*N]); } - + Sxx = 0; for (speak = 0; speak < K; speak++) { Sxx += mdf_inner_prod(st->x+speak*N+st->frame_size, st->x+speak*N+st->frame_size, st->frame_size); power_spectrum_accum(st->X+speak*N, st->Xf, N); } - - Sff = 0; + + Sff = 0; for (chan = 0; chan < C; chan++) { #ifdef TWO_PATH @@ -805,7 +799,7 @@ EXPORT void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *in, c Sff += mdf_inner_prod(st->e+chan*N, st->e+chan*N, st->frame_size); #endif } - + /* Adjust proportional adaption rate */ /* FIXME: Adjust that for C, K*/ if (st->adapted) @@ -828,8 +822,8 @@ EXPORT void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *in, c } else { st->saturated--; } - - /* FIXME: MC conversion required */ + + /* FIXME: MC conversion required */ /* Update weight to prevent circular convolution (MDF / AUMDF) */ for (chan = 0; chan < C; chan++) { @@ -869,13 +863,13 @@ EXPORT void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *in, c } } } - - /* So we can use power_spectrum_accum */ + + /* So we can use power_spectrum_accum */ for (i=0;i<=st->frame_size;i++) st->Rf[i] = st->Yf[i] = st->Xf[i] = 0; - + Dbf = 0; - See = 0; + See = 0; #ifdef TWO_PATH /* Difference in response, this is used to estimate the variance of our residual power estimate */ for (chan = 0; chan < C; chan++) @@ -897,20 +891,20 @@ EXPORT void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *in, c #ifdef TWO_PATH /* Logic for updating the foreground filter */ - + /* For two time windows, compute the mean of the energy difference, as well as the variance */ st->Davg1 = ADD32(MULT16_32_Q15(QCONST16(.6f,15),st->Davg1), MULT16_32_Q15(QCONST16(.4f,15),SUB32(Sff,See))); st->Davg2 = ADD32(MULT16_32_Q15(QCONST16(.85f,15),st->Davg2), MULT16_32_Q15(QCONST16(.15f,15),SUB32(Sff,See))); st->Dvar1 = FLOAT_ADD(FLOAT_MULT(VAR1_SMOOTH, st->Dvar1), FLOAT_MUL32U(MULT16_32_Q15(QCONST16(.4f,15),Sff), MULT16_32_Q15(QCONST16(.4f,15),Dbf))); st->Dvar2 = FLOAT_ADD(FLOAT_MULT(VAR2_SMOOTH, st->Dvar2), FLOAT_MUL32U(MULT16_32_Q15(QCONST16(.15f,15),Sff), MULT16_32_Q15(QCONST16(.15f,15),Dbf))); - + /* Equivalent float code: st->Davg1 = .6*st->Davg1 + .4*(Sff-See); st->Davg2 = .85*st->Davg2 + .15*(Sff-See); st->Dvar1 = .36*st->Dvar1 + .16*Sff*Dbf; st->Dvar2 = .7225*st->Dvar2 + .0225*Sff*Dbf; */ - + update_foreground = 0; /* Check if we have a statistically significant reduction in the residual echo */ /* Note that this is *not* Gaussian, so we need to be careful about the longer tail */ @@ -920,7 +914,7 @@ EXPORT void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *in, c update_foreground = 1; else if (FLOAT_GT(FLOAT_MUL32U(st->Davg2, ABS32(st->Davg2)), FLOAT_MULT(VAR2_UPDATE,(st->Dvar2)))) update_foreground = 1; - + /* Do we update? */ if (update_foreground) { @@ -949,12 +943,12 @@ EXPORT void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *in, c st->W[i] = SHL32(EXTEND32(st->foreground[i]),16); /* We also need to copy the output so as to get correct adaptation */ for (chan = 0; chan < C; chan++) - { + { for (i=0;iframe_size;i++) st->y[chan*N+i+st->frame_size] = st->e[chan*N+i+st->frame_size]; for (i=0;iframe_size;i++) st->e[chan*N+i] = SUB16(st->input[chan*st->frame_size+i], st->y[chan*N+i+st->frame_size]); - } + } See = Sff; st->Davg1 = st->Davg2 = 0; st->Dvar1 = st->Dvar2 = FLOAT_ZERO; @@ -962,10 +956,10 @@ EXPORT void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *in, c } #endif - Sey = Syy = Sdd = 0; + Sey = Syy = Sdd = 0; for (chan = 0; chan < C; chan++) - { - /* Compute error signal (for the output with de-emphasis) */ + { + /* Compute error signal (for the output with de-emphasis) */ for (i=0;iframe_size;i++) { spx_word32_t tmp_out; @@ -988,34 +982,34 @@ EXPORT void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *in, c #ifdef DUMP_ECHO_CANCEL_DATA dump_audio(in, far_end, out, st->frame_size); #endif - - /* Compute error signal (filter update version) */ + + /* Compute error signal (filter update version) */ for (i=0;iframe_size;i++) { st->e[chan*N+i+st->frame_size] = st->e[chan*N+i]; st->e[chan*N+i] = 0; } - + /* Compute a bunch of correlations */ /* FIXME: bad merge */ Sey += mdf_inner_prod(st->e+chan*N+st->frame_size, st->y+chan*N+st->frame_size, st->frame_size); Syy += mdf_inner_prod(st->y+chan*N+st->frame_size, st->y+chan*N+st->frame_size, st->frame_size); Sdd += mdf_inner_prod(st->input+chan*st->frame_size, st->input+chan*st->frame_size, st->frame_size); - + /* Convert error to frequency domain */ spx_fft(st->fft_table, st->e+chan*N, st->E+chan*N); for (i=0;iframe_size;i++) st->y[i+chan*N] = 0; spx_fft(st->fft_table, st->y+chan*N, st->Y+chan*N); - + /* Compute power spectrum of echo (X), error (E) and filter response (Y) */ power_spectrum_accum(st->E+chan*N, st->Rf, N); power_spectrum_accum(st->Y+chan*N, st->Yf, N); - + } - + /*printf ("%f %f %f %f\n", Sff, See, Syy, Sdd, st->update_cond);*/ - + /* Do some sanity check */ if (!(Syy>=0 && Sxx>=0 && See >= 0) #ifndef FIXED_POINT @@ -1044,14 +1038,14 @@ EXPORT void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *in, c /* Add a small noise floor to make sure not to have problems when dividing */ See = MAX32(See, SHR32(MULT16_16(N, 100),6)); - + for (speak = 0; speak < K; speak++) { Sxx += mdf_inner_prod(st->x+speak*N+st->frame_size, st->x+speak*N+st->frame_size, st->frame_size); power_spectrum_accum(st->X+speak*N, st->Xf, N); } - + /* Smooth far end energy estimate over time */ for (j=0;j<=st->frame_size;j++) st->power[j] = MULT16_32_Q15(ss_1,st->power[j]) + 1 + MULT16_32_Q15(ss,st->Xf[j]); @@ -1072,7 +1066,7 @@ EXPORT void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *in, c st->Yh[j] = (1-st->spec_average)*st->Yh[j] + st->spec_average*st->Yf[j]; #endif } - + Pyy = FLOAT_SQRT(Pyy); Pey = FLOAT_DIVU(Pey,Pyy); @@ -1100,7 +1094,7 @@ EXPORT void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *in, c else st->leak_estimate = SHL16(st->leak_estimate,1); /*printf ("%f\n", st->leak_estimate);*/ - + /* Compute Residual to Error Ratio */ #ifdef FIXED_POINT tmp32 = MULT16_32_Q15(st->leak_estimate,Syy); @@ -1156,7 +1150,7 @@ EXPORT void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *in, c /* Temporary adaption rate if filter is not yet adapted enough */ spx_word16_t adapt_rate=0; - if (Sxx > SHR32(MULT16_16(N, 1000),6)) + if (Sxx > SHR32(MULT16_16(N, 1000),6)) { tmp32 = MULT16_32_Q15(QCONST16(.25f, 15), Sxx); #ifdef FIXED_POINT @@ -1176,7 +1170,7 @@ EXPORT void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *in, c st->sum_adapt = ADD32(st->sum_adapt,adapt_rate); } - /* FIXME: MC conversion required */ + /* FIXME: MC conversion required */ for (i=0;iframe_size;i++) st->last_y[i] = st->last_y[st->frame_size+i]; if (st->adapted) @@ -1198,17 +1192,17 @@ void speex_echo_get_residual(SpeexEchoState *st, spx_word32_t *residual_echo, in int i; spx_word16_t leak2; int N; - + N = st->window_size; /* Apply hanning window (should pre-compute it)*/ for (i=0;iy[i] = MULT16_16_Q15(st->window[i],st->last_y[i]); - + /* Compute power spectrum of the echo */ spx_fft(st->fft_table, st->y, st->Y); power_spectrum(st->Y, residual_echo, N); - + #ifdef FIXED_POINT if (st->leak_estimate > 16383) leak2 = 32767; @@ -1223,14 +1217,14 @@ void speex_echo_get_residual(SpeexEchoState *st, spx_word32_t *residual_echo, in /* Estimate residual echo */ for (i=0;i<=st->frame_size;i++) residual_echo[i] = (spx_int32_t)MULT16_32_Q15(leak2,residual_echo[i]); - + } EXPORT int speex_echo_ctl(SpeexEchoState *st, int request, void *ptr) { switch(request) { - + case SPEEX_ECHO_GET_FRAME_SIZE: (*(int*)ptr) = st->frame_size; break; diff --git a/vendor/libspeex/libspeexdsp/misc_bfin.h b/vendor/libspeex/libspeexdsp/misc_bfin.h index 3c8c09d236..4e27681c95 100644 --- a/vendor/libspeex/libspeexdsp/misc_bfin.h +++ b/vendor/libspeex/libspeexdsp/misc_bfin.h @@ -1,25 +1,25 @@ /* Copyright (C) 2005 Analog Devices */ /** @file misc_bfin.h - @author Jean-Marc Valin + @author Jean-Marc Valin @brief Various compatibility routines for Speex (Blackfin version) */ /* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + - Neither the name of the Xiph.org Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR diff --git a/vendor/libspeex/libspeexdsp/os_support.h b/vendor/libspeex/libspeexdsp/os_support.h index 2e23a5eb41..0db31a61df 100644 --- a/vendor/libspeex/libspeexdsp/os_support.h +++ b/vendor/libspeex/libspeexdsp/os_support.h @@ -1,5 +1,5 @@ /* Copyright (C) 2007 Jean-Marc Valin - + File: os_support.h This is the (tiny) OS abstraction layer. Aside from math.h, this is the only place where system headers are allowed. @@ -45,12 +45,12 @@ #include "os_support_custom.h" #endif -/** Speex wrapper for calloc. To do your own dynamic allocation, all you need to do is replace this function, speex_realloc and speex_free +/** Speex wrapper for calloc. To do your own dynamic allocation, all you need to do is replace this function, speex_realloc and speex_free NOTE: speex_alloc needs to CLEAR THE MEMORY */ #ifndef OVERRIDE_SPEEX_ALLOC static inline void *speex_alloc (int size) { - /* WARNING: this is not equivalent to malloc(). If you want to use malloc() + /* WARNING: this is not equivalent to malloc(). If you want to use malloc() or your own allocator, YOU NEED TO CLEAR THE MEMORY ALLOCATED. Otherwise you will experience strange bugs */ return calloc(size,1); diff --git a/vendor/libspeex/libspeexdsp/preprocess.c b/vendor/libspeex/libspeexdsp/preprocess.c index b8e287a7e7..3053eb5adb 100644 --- a/vendor/libspeex/libspeexdsp/preprocess.c +++ b/vendor/libspeex/libspeexdsp/preprocess.c @@ -1,6 +1,6 @@ /* Copyright (C) 2003 Epic Games (written by Jean-Marc Valin) - Copyright (C) 2004-2006 Epic Games - + Copyright (C) 2004-2006 Epic Games + File: preprocess.c Preprocessor with denoising based on the algorithm by Ephraim and Malah @@ -34,24 +34,24 @@ /* Recommended papers: - + Y. Ephraim and D. Malah, "Speech enhancement using minimum mean-square error - short-time spectral amplitude estimator". IEEE Transactions on Acoustics, + short-time spectral amplitude estimator". IEEE Transactions on Acoustics, Speech and Signal Processing, vol. ASSP-32, no. 6, pp. 1109-1121, 1984. - + Y. Ephraim and D. Malah, "Speech enhancement using minimum mean-square error - log-spectral amplitude estimator". IEEE Transactions on Acoustics, Speech and + log-spectral amplitude estimator". IEEE Transactions on Acoustics, Speech and Signal Processing, vol. ASSP-33, no. 2, pp. 443-445, 1985. - + I. Cohen and B. Berdugo, "Speech enhancement for non-stationary noise environments". Signal Processing, vol. 81, no. 2, pp. 2403-2418, 2001. - Stefan Gustafsson, Rainer Martin, Peter Jax, and Peter Vary. "A psychoacoustic - approach to combined acoustic echo cancellation and noise reduction". IEEE + Stefan Gustafsson, Rainer Martin, Peter Jax, and Peter Vary. "A psychoacoustic + approach to combined acoustic echo cancellation and noise reduction". IEEE Transactions on Speech and Audio Processing, 2002. - + J.-M. Valin, J. Rouat, and F. Michaud, "Microphone array post-filter for separation - of simultaneous non-stationary sources". In Proceedings IEEE International + of simultaneous non-stationary sources". In Proceedings IEEE International Conference on Acoustics, Speech, and Signal Processing, 2004. */ @@ -71,7 +71,7 @@ #define LOUDNESS_EXP 5.f #define AMP_SCALE .001f #define AMP_SCALE_1 1000.f - + #define NB_BANDS 24 #define SPEECH_PROB_START_DEFAULT QCONST16(0.35f,15) @@ -113,7 +113,7 @@ static inline spx_word16_t DIV32_16_Q8(spx_word32_t a, spx_word32_t b) a = SHL32(a,8); return PDIV32_16(a,b); } - + } static inline spx_word16_t DIV32_16_Q15(spx_word32_t a, spx_word32_t b) { @@ -181,7 +181,7 @@ struct SpeexPreprocessState_ { int sampling_rate; /**< Sampling rate of the input/output */ int nbands; FilterBank *bank; - + /* Parameters */ int denoise_enabled; int vad_enabled; @@ -194,7 +194,7 @@ struct SpeexPreprocessState_ { int echo_suppress; int echo_suppress_active; SpeexEchoState *echo_state; - + spx_word16_t speech_prob; /**< Probability last frame was speech */ /* DSP-related arrays */ @@ -256,7 +256,7 @@ static void conj_window(spx_word16_t *w, int len) spx_word16_t tmp; #ifdef FIXED_POINT spx_word16_t x = DIV32_16(MULT16_16(32767,i),len); -#else +#else spx_word16_t x = DIV32_16(MULT16_16(QCONST16(4.f,13),i),len); #endif int inv=0; @@ -281,10 +281,10 @@ static void conj_window(spx_word16_t *w, int len) } } - + #ifdef FIXED_POINT -/* This function approximates the gain function - y = gamma(1.25)^2 * M(-.25;1;-x) / sqrt(x) +/* This function approximates the gain function + y = gamma(1.25)^2 * M(-.25;1;-x) / sqrt(x) which multiplied by xi/(1+xi) is the optimal gain in the loudness domain ( sqrt[amplitude] ) Input in Q11 format, output in Q15 @@ -317,7 +317,7 @@ static inline spx_word16_t qcurve(spx_word16_t x) static void compute_gain_floor(int noise_suppress, int effective_echo_suppress, spx_word32_t *noise, spx_word32_t *echo, spx_word16_t *gain_floor, int len) { int i; - + if (noise_suppress > effective_echo_suppress) { spx_word16_t noise_gain, gain_ratio; @@ -343,8 +343,8 @@ static void compute_gain_floor(int noise_suppress, int effective_echo_suppress, } #else -/* This function approximates the gain function - y = gamma(1.25)^2 * M(-.25;1;-x) / sqrt(x) +/* This function approximates the gain function + y = gamma(1.25)^2 * M(-.25;1;-x) / sqrt(x) which multiplied by xi/(1+xi) is the optimal gain in the loudness domain ( sqrt[amplitude] ) */ @@ -410,8 +410,8 @@ EXPORT SpeexPreprocessState *speex_preprocess_state_init(int frame_size, int sam break; } } - - + + if (st->ps_size < 3*st->frame_size/4) st->ps_size = st->ps_size * 3 / 2; #else @@ -421,7 +421,7 @@ EXPORT SpeexPreprocessState *speex_preprocess_state_init(int frame_size, int sam N = st->ps_size; N3 = 2*N - st->frame_size; N4 = st->frame_size - N3; - + st->sampling_rate = sampling_rate; st->denoise_enabled = 1; st->vad_enabled = 0; @@ -436,15 +436,15 @@ EXPORT SpeexPreprocessState *speex_preprocess_state_init(int frame_size, int sam st->speech_prob_continue = SPEECH_PROB_CONTINUE_DEFAULT; st->echo_state = NULL; - + st->nbands = NB_BANDS; M = st->nbands; st->bank = filterbank_new(M, sampling_rate, N, 1); - + st->frame = (spx_word16_t*)speex_alloc(2*N*sizeof(spx_word16_t)); st->window = (spx_word16_t*)speex_alloc(2*N*sizeof(spx_word16_t)); st->ft = (spx_word16_t*)speex_alloc(2*N*sizeof(spx_word16_t)); - + st->ps = (spx_word32_t*)speex_alloc((N+M)*sizeof(spx_word32_t)); st->noise = (spx_word32_t*)speex_alloc((N+M)*sizeof(spx_word32_t)); st->echo_noise = (spx_word32_t*)speex_alloc((N+M)*sizeof(spx_word32_t)); @@ -457,19 +457,19 @@ EXPORT SpeexPreprocessState *speex_preprocess_state_init(int frame_size, int sam st->gain2 = (spx_word16_t*)speex_alloc((N+M)*sizeof(spx_word16_t)); st->gain_floor = (spx_word16_t*)speex_alloc((N+M)*sizeof(spx_word16_t)); st->zeta = (spx_word16_t*)speex_alloc((N+M)*sizeof(spx_word16_t)); - + st->S = (spx_word32_t*)speex_alloc(N*sizeof(spx_word32_t)); st->Smin = (spx_word32_t*)speex_alloc(N*sizeof(spx_word32_t)); st->Stmp = (spx_word32_t*)speex_alloc(N*sizeof(spx_word32_t)); st->update_prob = (int*)speex_alloc(N*sizeof(int)); - + st->inbuf = (spx_word16_t*)speex_alloc(N3*sizeof(spx_word16_t)); st->outbuf = (spx_word16_t*)speex_alloc(N3*sizeof(spx_word16_t)); conj_window(st->window, 2*N3); for (i=2*N3;i<2*st->ps_size;i++) st->window[i]=Q15_ONE; - + if (N4>0) { for (i=N3-1;i>=0;i--) @@ -569,7 +569,7 @@ static void speex_compute_agc(SpeexPreprocessState *st, spx_word16_t Pframe, spx float target_gain; float loudness=1.f; float rate; - + for (i=2;ips[i]* st->loudness_weight[i]; @@ -587,7 +587,7 @@ static void speex_compute_agc(SpeexPreprocessState *st, spx_word16_t Pframe, spx st->init_max *= 1.f + .1f*Pframe*Pframe; } /*printf ("%f %f %f %f\n", Pframe, loudness, pow(st->loudness, 1.0f/LOUDNESS_EXP), st->loudness2);*/ - + target_gain = AMP_SCALE*st->agc_level*pow(st->loudness/(1e-4+st->loudness_accum), -1.0f/LOUDNESS_EXP); if ((Pframe>.5 && st->nb_adapt > 20) || target_gain < st->agc_gain) @@ -600,11 +600,11 @@ static void speex_compute_agc(SpeexPreprocessState *st, spx_word16_t Pframe, spx target_gain = st->max_gain; if (target_gain > st->init_max) target_gain = st->init_max; - + st->agc_gain = target_gain; } /*fprintf (stderr, "%f %f %f\n", loudness, (float)AMP_SCALE_1*pow(st->loudness, 1.0f/LOUDNESS_EXP), st->agc_gain);*/ - + for (i=0;i<2*N;i++) ft[i] *= st->agc_gain; st->prev_loudness = loudness; @@ -624,7 +624,7 @@ static void preprocess_analysis(SpeexPreprocessState *st, spx_int16_t *x) st->frame[i]=st->inbuf[i]; for (i=0;iframe_size;i++) st->frame[N3+i]=x[i]; - + /* Update inbuf */ for (i=0;iinbuf[i]=x[N4+i]; @@ -643,10 +643,10 @@ static void preprocess_analysis(SpeexPreprocessState *st, spx_int16_t *x) st->frame[i] = SHL16(st->frame[i], st->frame_shift); } #endif - + /* Perform FFT */ spx_fft(st->fft_lookup, st->frame, st->ft); - + /* Power spectrum */ ps[0]=MULT16_16(st->ft[0],st->ft[0]); for (i=1;ips_size; for (i=1;iS[i] = MULT16_32_Q15(QCONST16(.8f,15),st->S[i]) + MULT16_32_Q15(QCONST16(.05f,15),st->ps[i-1]) + st->S[i] = MULT16_32_Q15(QCONST16(.8f,15),st->S[i]) + MULT16_32_Q15(QCONST16(.05f,15),st->ps[i-1]) + MULT16_32_Q15(QCONST16(.1f,15),st->ps[i]) + MULT16_32_Q15(QCONST16(.05f,15),st->ps[i+1]); st->S[0] = MULT16_32_Q15(QCONST16(.8f,15),st->S[0]) + MULT16_32_Q15(QCONST16(.2f,15),st->ps[0]); st->S[N-1] = MULT16_32_Q15(QCONST16(.8f,15),st->S[N-1]) + MULT16_32_Q15(QCONST16(.2f,15),st->ps[N-1]); - + if (st->nb_adapt==1) { for (i=0;iSmin[i] = MIN32(st->Smin[i], st->S[i]); - st->Stmp[i] = MIN32(st->Stmp[i], st->S[i]); + st->Stmp[i] = MIN32(st->Stmp[i], st->S[i]); } } for (i=0;inb_adapt++; if (st->nb_adapt>20000) st->nb_adapt = 20000; st->min_count++; - + beta = MAX16(QCONST16(.03,15),DIV32_16(Q15_ONE,st->nb_adapt)); beta_1 = Q15_ONE-beta; M = st->nbands; @@ -770,7 +770,7 @@ EXPORT int speex_preprocess_run(SpeexPreprocessState *st, spx_int16_t *x) st->update_prob[i] = 0; } */ - + /* Update the noise estimate for the frequencies where it can be */ for (i=0;inoise[i],NOISE_SHIFT)) , st->echo_noise[i]) , st->reverb_estimate[i]); - + /* A posteriori SNR = ps/noise - 1*/ st->post[i] = SUB16(DIV32_16_Q8(ps[i],tot_noise), QCONST16(1.f,SNR_SHIFT)); st->post[i]=MIN16(st->post[i], QCONST16(100.f,SNR_SHIFT)); - + /* Computing update gamma = .1 + .9*(old/(old+noise))^2 */ gamma = QCONST16(.1f,15)+MULT16_16_Q15(QCONST16(.89f,15),SQR16_Q15(DIV32_16_Q15(st->old_ps[i],ADD32(st->old_ps[i],tot_noise)))); - + /* A priori SNR update = gamma*max(0,post) + (1-gamma)*old/noise */ st->prior[i] = EXTRACT16(PSHR32(ADD32(MULT16_16(gamma,MAX16(0,st->post[i])), MULT16_16(Q15_ONE-gamma,DIV32_16_Q8(st->old_ps[i],tot_noise))), 15)); st->prior[i]=MIN16(st->prior[i], QCONST16(100.f,SNR_SHIFT)); @@ -819,13 +819,13 @@ EXPORT int speex_preprocess_run(SpeexPreprocessState *st, spx_int16_t *x) for (i=N;izeta[i])); Pframe = QCONST16(.1f,15)+MULT16_16_Q15(QCONST16(.899f,15),qcurve(DIV32_16(Zframe,st->nbands))); - + effective_echo_suppress = EXTRACT16(PSHR32(ADD32(MULT16_16(SUB16(Q15_ONE,Pframe), st->echo_suppress), MULT16_16(Pframe, st->echo_suppress_active)),15)); - + compute_gain_floor(st->noise_suppress, effective_echo_suppress, st->noise+N, st->echo_noise+N, st->gain_floor+N, M); - - /* Compute Ephraim & Malah gain speech probability of presence for each critical band (Bark scale) - Technically this is actually wrong because the EM gaim assumes a slightly different probability + + /* Compute Ephraim & Malah gain speech probability of presence for each critical band (Bark scale) + Technically this is actually wrong because the EM gaim assumes a slightly different probability distribution */ for (i=N;iprior[i]), 15), ADD16(st->prior[i], SHL32(1,SNR_SHIFT))); theta = MULT16_32_P15(prior_ratio, QCONST32(1.f,EXPIN_SHIFT)+SHL32(EXTEND32(st->post[i]),EXPIN_SHIFT-SNR_SHIFT)); @@ -867,12 +867,12 @@ EXPORT int speex_preprocess_run(SpeexPreprocessState *st, spx_int16_t *x) /* Convert the EM gains and speech prob to linear frequency */ filterbank_compute_psd16(st->bank,st->gain2+N, st->gain2); filterbank_compute_psd16(st->bank,st->gain+N, st->gain); - + /* Use 1 for linear gain resolution (best) or 0 for Bark gain resolution (faster) */ if (1) { filterbank_compute_psd16(st->bank,st->gain_floor+N, st->gain_floor); - + /* Compute gain according to the Ephraim-Malah algorithm -- linear frequency */ for (i=0;iprior[i]), 15), ADD16(st->prior[i], SHL32(1,SNR_SHIFT))); theta = MULT16_32_P15(prior_ratio, QCONST32(1.f,EXPIN_SHIFT)+SHL32(EXTEND32(st->post[i]),EXPIN_SHIFT-SNR_SHIFT)); @@ -893,22 +893,22 @@ EXPORT int speex_preprocess_run(SpeexPreprocessState *st, spx_int16_t *x) g = EXTRACT16(MIN32(Q15_ONE, MULT16_32_Q15(prior_ratio, MM))); /* Interpolated speech probability of presence */ p = st->gain2[i]; - + /* Constrain the gain to be close to the Bark scale gain */ if (MULT16_16_Q15(QCONST16(.333f,15),g) > st->gain[i]) g = MULT16_16(3,st->gain[i]); st->gain[i] = g; - + /* Save old power spectrum */ st->old_ps[i] = MULT16_32_P15(QCONST16(.2f,15),st->old_ps[i]) + MULT16_32_P15(MULT16_16_P15(QCONST16(.8f,15),SQR16_Q15(st->gain[i])),ps[i]); - + /* Apply gain floor */ if (st->gain[i] < st->gain_floor[i]) st->gain[i] = st->gain_floor[i]; /* Exponential decay model for reverberation (unused) */ /*st->reverb_estimate[i] = st->reverb_decay*st->reverb_estimate[i] + st->reverb_decay*st->reverb_level*st->gain[i]*st->gain[i]*st->ps[i];*/ - + /* Take into account speech probability of presence (loudness domain MMSE estimator) */ /* gain2 = [p*sqrt(gain)+(1-p)*sqrt(gain _floor) ]^2 */ tmp = MULT16_16_P15(p,spx_sqrt(SHL32(EXTEND32(st->gain[i]),15))) + MULT16_16_P15(SUB16(Q15_ONE,p),spx_sqrt(SHL32(EXTEND32(st->gain_floor[i]),15))); @@ -922,20 +922,20 @@ EXPORT int speex_preprocess_run(SpeexPreprocessState *st, spx_int16_t *x) { spx_word16_t tmp; spx_word16_t p = st->gain2[i]; - st->gain[i] = MAX16(st->gain[i], st->gain_floor[i]); + st->gain[i] = MAX16(st->gain[i], st->gain_floor[i]); tmp = MULT16_16_P15(p,spx_sqrt(SHL32(EXTEND32(st->gain[i]),15))) + MULT16_16_P15(SUB16(Q15_ONE,p),spx_sqrt(SHL32(EXTEND32(st->gain_floor[i]),15))); st->gain2[i]=SQR16_Q15(tmp); } filterbank_compute_psd16(st->bank,st->gain2+N, st->gain2); } - + /* If noise suppression is off, don't apply the gain (but then why call this in the first place!) */ if (!st->denoise_enabled) { for (i=0;igain2[i]=Q15_ONE; } - + /* Apply computed gain */ for (i=1;ift[0] = MULT16_16_P15(st->gain2[0],st->ft[0]); st->ft[2*N-1] = MULT16_16_P15(st->gain2[N-1],st->ft[2*N-1]); - + /*FIXME: This *will* not work for fixed-point */ #ifndef FIXED_POINT if (st->agc_enabled) @@ -973,17 +973,17 @@ EXPORT int speex_preprocess_run(SpeexPreprocessState *st, spx_int16_t *x) } } #endif - + /* Synthesis window (for WOLA) */ for (i=0;i<2*N;i++) st->frame[i] = MULT16_16_Q15(st->frame[i], st->window[i]); /* Perform overlap and add */ for (i=0;ioutbuf[i] + st->frame[i]; + x[i] = WORD2INT(ADD32(EXTEND32(st->outbuf[i]), EXTEND32(st->frame[i]))); for (i=0;iframe[N3+i]; - + /* Update outbuf */ for (i=0;ioutbuf[i] = st->frame[st->frame_size+i]; @@ -1016,11 +1016,11 @@ EXPORT void speex_preprocess_estimate_update(SpeexPreprocessState *st, spx_int16 M = st->nbands; st->min_count++; - + preprocess_analysis(st, x); update_noise_prob(st); - + for (i=1;iupdate_prob[i] || st->ps[i] < PSHR32(st->noise[i],NOISE_SHIFT)) @@ -1099,7 +1099,7 @@ EXPORT int speex_preprocess_ctl(SpeexPreprocessState *state, int request, void * case SPEEX_PREPROCESS_GET_VAD: (*(spx_int32_t*)ptr) = st->vad_enabled; break; - + case SPEEX_PREPROCESS_SET_DEREVERB: st->dereverb_enabled = (*(spx_int32_t*)ptr); for (i=0;ips_size;i++) @@ -1117,7 +1117,7 @@ EXPORT int speex_preprocess_ctl(SpeexPreprocessState *state, int request, void * /* FIXME: Re-enable when de-reverberation is actually enabled again */ /*(*(float*)ptr) = st->reverb_level;*/ break; - + case SPEEX_PREPROCESS_SET_DEREVERB_DECAY: /* FIXME: Re-enable when de-reverberation is actually enabled again */ /*st->reverb_decay = (*(float*)ptr);*/ diff --git a/vendor/libspeex/libspeexdsp/pseudofloat.h b/vendor/libspeex/libspeexdsp/pseudofloat.h index fa841a0101..ed5ab14b05 100644 --- a/vendor/libspeex/libspeexdsp/pseudofloat.h +++ b/vendor/libspeex/libspeexdsp/pseudofloat.h @@ -3,7 +3,7 @@ @file pseudofloat.h @brief Pseudo-floating point * This header file provides a lightweight floating point type for - * use on fixed-point platforms when a large dynamic range is + * use on fixed-point platforms when a large dynamic range is * required. The new type is not compatible with the 32-bit IEEE format, * it is not even remotely as accurate as 32-bit floats, and is not * even guaranteed to produce even remotely correct results for code @@ -16,18 +16,18 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + - Neither the name of the Xiph.org Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -84,7 +84,7 @@ static inline spx_float_t PSEUDOFLOAT(spx_int32_t x) r.e = e; return r; } - else + else { spx_float_t r; r.m = x; @@ -101,12 +101,12 @@ static inline spx_float_t FLOAT_ADD(spx_float_t a, spx_float_t b) return b; else if (b.m==0) return a; - if ((a).e > (b).e) + if ((a).e > (b).e) { r.m = ((a).m>>1) + ((b).m>>MIN(15,(a).e-(b).e+1)); r.e = (a).e+1; } - else + else { r.m = ((b).m>>1) + ((a).m>>MIN(15,(b).e-(a).e+1)); r.e = (b).e+1; @@ -141,7 +141,7 @@ static inline spx_float_t FLOAT_SUB(spx_float_t a, spx_float_t b) r.m = ((a).m>>1) - ((b).m>>MIN(15,(a).e-(b).e+1)); r.e = (a).e+1; } - else + else { r.m = ((a).m>>MIN(15,(b).e-(a).e+1)) - ((b).m>>1); r.e = (b).e+1; @@ -169,10 +169,10 @@ static inline int FLOAT_LT(spx_float_t a, spx_float_t b) if (a.m==0) return b.m>0; else if (b.m==0) - return a.m<0; + return a.m<0; if ((a).e > (b).e) return ((a).m>>1) < ((b).m>>MIN(15,(a).e-(b).e+1)); - else + else return ((b).m>>1) > ((a).m>>MIN(15,(b).e-(a).e+1)); } @@ -202,7 +202,7 @@ static inline spx_float_t FLOAT_MULT(spx_float_t a, spx_float_t b) } } /*printf ("%f * %f = %f\n", REALFLOAT(a), REALFLOAT(b), REALFLOAT(r));*/ - return r; + return r; } static inline spx_float_t FLOAT_AMULT(spx_float_t a, spx_float_t b) @@ -210,7 +210,7 @@ static inline spx_float_t FLOAT_AMULT(spx_float_t a, spx_float_t b) spx_float_t r; r.m = (spx_int16_t)((spx_int32_t)(a).m*(b).m>>15); r.e = (a).e+(b).e+15; - return r; + return r; } diff --git a/vendor/libspeex/libspeexdsp/resample.c b/vendor/libspeex/libspeexdsp/resample.c index edbd65b5d4..2783f55f0c 100644 --- a/vendor/libspeex/libspeexdsp/resample.c +++ b/vendor/libspeex/libspeexdsp/resample.c @@ -1,6 +1,6 @@ /* Copyright (C) 2007-2008 Jean-Marc Valin Copyright (C) 2008 Thorvald Natvig - + File: resample.c Arbitrary resampling code @@ -38,22 +38,22 @@ - Low memory requirement - Good *perceptual* quality (and not best SNR) - Warning: This resampler is relatively new. Although I think I got rid of + Warning: This resampler is relatively new. Although I think I got rid of all the major bugs and I don't expect the API to change anymore, there may be something I've missed. So use with caution. This algorithm is based on this original resampling algorithm: Smith, Julius O. Digital Audio Resampling Home Page - Center for Computer Research in Music and Acoustics (CCRMA), + Center for Computer Research in Music and Acoustics (CCRMA), Stanford University, 2007. - Web published at http://www-ccrma.stanford.edu/~jos/resample/. + Web published at https://ccrma.stanford.edu/~jos/resample/. - There is one main difference, though. This resampler uses cubic + There is one main difference, though. This resampler uses cubic interpolation instead of linear interpolation in the above paper. This makes the table much smaller and makes it possible to compute that table - on a per-stream basis. In turn, being able to tweak the table for each - stream makes it possible to both reduce complexity on simple ratios - (e.g. 2/3), and get rid of the rounding operations in the inner loop. + on a per-stream basis. In turn, being able to tweak the table for each + stream makes it possible to both reduce complexity on simple ratios + (e.g. 2/3), and get rid of the rounding operations in the inner loop. The latter both reduces CPU time and makes the algorithm more SIMD-friendly. */ @@ -63,9 +63,12 @@ #ifdef OUTSIDE_SPEEX #include -static void *speex_alloc (int size) {return calloc(size,1);} -static void *speex_realloc (void *ptr, int size) {return realloc(ptr, size);} -static void speex_free (void *ptr) {free(ptr);} +static void *speex_alloc(int size) {return calloc(size,1);} +static void *speex_realloc(void *ptr, int size) {return realloc(ptr, size);} +static void speex_free(void *ptr) {free(ptr);} +#ifndef EXPORT +#define EXPORT +#endif #include "speex_resampler.h" #include "arch.h" #else /* OUTSIDE_SPEEX */ @@ -75,7 +78,6 @@ static void speex_free (void *ptr) {free(ptr);} #include "os_support.h" #endif /* OUTSIDE_SPEEX */ -#include "stack_alloc.h" #include #include @@ -83,12 +85,6 @@ static void speex_free (void *ptr) {free(ptr);} #define M_PI 3.14159265358979323846 #endif -#ifdef FIXED_POINT -#define WORD2INT(x) ((x) < -32767 ? -32768 : ((x) > 32766 ? 32767 : (x))) -#else -#define WORD2INT(x) ((x) < -32767.5f ? -32768 : ((x) > 32766.5f ? 32767 : floor(.5+(x)))) -#endif - #define IMAX(a,b) ((a) > (b) ? (a) : (b)) #define IMIN(a,b) ((a) < (b) ? (a) : (b)) @@ -96,15 +92,19 @@ static void speex_free (void *ptr) {free(ptr);} #define NULL 0 #endif -#ifdef _USE_SSE +#ifndef UINT32_MAX +#define UINT32_MAX 4294967295U +#endif + +#ifdef USE_SSE #include "resample_sse.h" #endif -#ifdef _USE_NEON +#ifdef USE_NEON #include "resample_neon.h" #endif -/* Numer of elements to allocate on the stack */ +/* Number of elements to allocate on the stack */ #ifdef VAR_ARRAYS #define FIXED_STACK_ALLOC 8192 #else @@ -118,7 +118,7 @@ struct SpeexResamplerState_ { spx_uint32_t out_rate; spx_uint32_t num_rate; spx_uint32_t den_rate; - + int quality; spx_uint32_t nb_channels; spx_uint32_t filt_len; @@ -130,17 +130,17 @@ struct SpeexResamplerState_ { spx_uint32_t oversample; int initialised; int started; - + /* These are per-channel */ spx_int32_t *last_sample; spx_uint32_t *samp_frac_num; spx_uint32_t *magic_samples; - + spx_word16_t *mem; spx_word16_t *sinc_table; spx_uint32_t sinc_table_length; resampler_basic_func resampler_ptr; - + int in_stride; int out_stride; } ; @@ -182,7 +182,7 @@ static const double kaiser8_table[36] = { 0.32108304, 0.27619388, 0.23465776, 0.19672670, 0.16255380, 0.13219758, 0.10562887, 0.08273982, 0.06335451, 0.04724088, 0.03412321, 0.02369490, 0.01563093, 0.00959968, 0.00527363, 0.00233883, 0.00050000, 0.00000000}; - + static const double kaiser6_table[36] = { 0.99733006, 1.00000000, 0.99733006, 0.98935595, 0.97618418, 0.95799003, 0.93501423, 0.90755855, 0.87598009, 0.84068475, 0.80211977, 0.76076565, @@ -195,17 +195,15 @@ struct FuncDef { const double *table; int oversample; }; - -static const struct FuncDef _KAISER12 = {kaiser12_table, 64}; -#define KAISER12 (&_KAISER12) -/*static struct FuncDef _KAISER12 = {kaiser12_table, 32}; -#define KAISER12 (&_KAISER12)*/ -static const struct FuncDef _KAISER10 = {kaiser10_table, 32}; -#define KAISER10 (&_KAISER10) -static const struct FuncDef _KAISER8 = {kaiser8_table, 32}; -#define KAISER8 (&_KAISER8) -static const struct FuncDef _KAISER6 = {kaiser6_table, 32}; -#define KAISER6 (&_KAISER6) + +static const struct FuncDef kaiser12_funcdef = {kaiser12_table, 64}; +#define KAISER12 (&kaiser12_funcdef) +static const struct FuncDef kaiser10_funcdef = {kaiser10_table, 32}; +#define KAISER10 (&kaiser10_funcdef) +static const struct FuncDef kaiser8_funcdef = {kaiser8_table, 32}; +#define KAISER8 (&kaiser8_funcdef) +static const struct FuncDef kaiser6_funcdef = {kaiser6_table, 32}; +#define KAISER6 (&kaiser6_funcdef) struct QualityMapping { int base_length; @@ -217,7 +215,7 @@ struct QualityMapping { /* This table maps conversion quality to internal parameters. There are two - reasons that explain why the up-sampling bandwidth is larger than the + reasons that explain why the up-sampling bandwidth is larger than the down-sampling bandwidth: 1) When up-sampling, we can assume that the spectrum is already attenuated close to the Nyquist rate (from an A/D or a previous resampling filter) @@ -243,7 +241,7 @@ static double compute_func(float x, const struct FuncDef *func) { float y, frac; double interp[4]; - int ind; + int ind; y = x*func->oversample; ind = (int)floor(y); frac = (y-ind); @@ -254,7 +252,7 @@ static double compute_func(float x, const struct FuncDef *func) interp[0] = -0.3333333333*frac + 0.5*(frac*frac) - 0.1666666667*(frac*frac*frac); /* Just to make sure we don't have rounding problems */ interp[1] = 1.f-interp[3]-interp[2]-interp[0]; - + /*sum = frac*accum[1] + (1-frac)*accum[2];*/ return interp[0]*func->table[ind] + interp[1]*func->table[ind+1] + interp[2]*func->table[ind+2] + interp[3]*func->table[ind+3]; } @@ -475,13 +473,13 @@ static int resampler_basic_interpolate_single(SpeexResamplerState *st, spx_uint3 } cubic_coef(frac, interp); - sum = MULT16_32_Q15(interp[0],SHR32(accum[0], 1)) + MULT16_32_Q15(interp[1],SHR32(accum[1], 1)) + MULT16_32_Q15(interp[2],SHR32(accum[2], 1)) + MULT16_32_Q15(interp[3],SHR32(accum[3], 1)); + sum = MULT16_32_Q15(interp[0],accum[0]) + MULT16_32_Q15(interp[1],accum[1]) + MULT16_32_Q15(interp[2],accum[2]) + MULT16_32_Q15(interp[3],accum[3]); sum = SATURATE32PSHR(sum, 15, 32767); #else cubic_coef(frac, interp); sum = interpolate_product_single(iptr, st->sinc_table + st->oversample + 4 - offset - 2, N, st->oversample, interp); #endif - + out[out_stride * out_sample++] = sum; last_sample += int_advance; samp_frac_num += frac_advance; @@ -543,7 +541,7 @@ static int resampler_basic_interpolate_double(SpeexResamplerState *st, spx_uint3 cubic_coef(frac, interp); sum = interpolate_product_double(iptr, st->sinc_table + st->oversample + 4 - offset - 2, N, st->oversample, interp); #endif - + out[out_stride * out_sample++] = PSHR32(sum,15); last_sample += int_advance; samp_frac_num += frac_advance; @@ -574,6 +572,7 @@ static int resampler_basic_zero(SpeexResamplerState *st, spx_uint32_t channel_in const int frac_advance = st->frac_advance; const spx_uint32_t den_rate = st->den_rate; + (void)in; while (!(last_sample >= (spx_int32_t)*in_len || out_sample >= (spx_int32_t)*out_len)) { out[out_stride * out_sample++] = 0; @@ -591,6 +590,18 @@ static int resampler_basic_zero(SpeexResamplerState *st, spx_uint32_t channel_in return out_sample; } +static int multiply_frac(spx_uint32_t *result, spx_uint32_t value, spx_uint32_t num, spx_uint32_t den) +{ + spx_uint32_t major = value / den; + spx_uint32_t remain = value % den; + /* TODO: Could use 64 bits operation to check for overflow. But only guaranteed in C99+ */ + if (remain > UINT32_MAX / num || major > UINT32_MAX / num + || major * num > UINT32_MAX - remain * num / den) + return RESAMPLER_ERR_OVERFLOW; + *result = remain * num / den + major * num; + return RESAMPLER_ERR_SUCCESS; +} + static int update_filter(SpeexResamplerState *st) { spx_uint32_t old_length = st->filt_len; @@ -603,13 +614,13 @@ static int update_filter(SpeexResamplerState *st) st->frac_advance = st->num_rate%st->den_rate; st->oversample = quality_map[st->quality].oversample; st->filt_len = quality_map[st->quality].base_length; - + if (st->num_rate > st->den_rate) { /* down-sampling */ st->cutoff = quality_map[st->quality].downsample_bandwidth * st->den_rate / st->num_rate; - /* FIXME: divide the numerator and denominator by a certain amount if they're too large */ - st->filt_len = st->filt_len*st->num_rate / st->den_rate; + if (multiply_frac(&st->filt_len,st->filt_len,st->num_rate,st->den_rate) != RESAMPLER_ERR_SUCCESS) + goto fail; /* Round up to make sure we have a multiple of 8 for SSE */ st->filt_len = ((st->filt_len-1)&(~0x7))+8; if (2*st->den_rate < st->num_rate) @@ -626,13 +637,13 @@ static int update_filter(SpeexResamplerState *st) /* up-sampling */ st->cutoff = quality_map[st->quality].upsample_bandwidth; } - - /* Choose the resampling type that requires the least amount of memory */ + #ifdef RESAMPLE_FULL_SINC_TABLE use_direct = 1; if (INT_MAX/sizeof(spx_word16_t)/st->den_rate < st->filt_len) goto fail; #else + /* Choose the resampling type that requires the least amount of memory */ use_direct = st->filt_len*st->den_rate <= st->filt_len*st->oversample+8 && INT_MAX/sizeof(spx_word16_t)/st->den_rate >= st->filt_len; #endif @@ -722,16 +733,18 @@ static int update_filter(SpeexResamplerState *st) { spx_uint32_t j; spx_uint32_t olen = old_length; + spx_uint32_t start = i*st->mem_alloc_size; + spx_uint32_t magic_samples = st->magic_samples[i]; /*if (st->magic_samples[i])*/ { /* Try and remove the magic samples as if nothing had happened */ - + /* FIXME: This is wrong but for now we need it to avoid going over the array bounds */ - olen = old_length + 2*st->magic_samples[i]; - for (j=old_length-1+st->magic_samples[i];j--;) - st->mem[i*st->mem_alloc_size+j+st->magic_samples[i]] = st->mem[i*old_alloc_size+j]; - for (j=0;jmagic_samples[i];j++) - st->mem[i*st->mem_alloc_size+j] = 0; + olen = old_length + 2*magic_samples; + for (j=old_length-1+magic_samples;j--;) + st->mem[start+j+magic_samples] = st->mem[i*old_alloc_size+j]; + for (j=0;jmem[start+j] = 0; st->magic_samples[i] = 0; } if (st->filt_len > olen) @@ -739,17 +752,18 @@ static int update_filter(SpeexResamplerState *st) /* If the new filter length is still bigger than the "augmented" length */ /* Copy data going backward */ for (j=0;jmem[i*st->mem_alloc_size+(st->filt_len-2-j)] = st->mem[i*st->mem_alloc_size+(olen-2-j)]; + st->mem[start+(st->filt_len-2-j)] = st->mem[start+(olen-2-j)]; /* Then put zeros for lack of anything better */ for (;jfilt_len-1;j++) - st->mem[i*st->mem_alloc_size+(st->filt_len-2-j)] = 0; + st->mem[start+(st->filt_len-2-j)] = 0; /* Adjust last_sample */ st->last_sample[i] += (st->filt_len - olen)/2; } else { /* Put back some of the magic! */ - st->magic_samples[i] = (olen - st->filt_len)/2; - for (j=0;jfilt_len-1+st->magic_samples[i];j++) - st->mem[i*st->mem_alloc_size+j] = st->mem[i*st->mem_alloc_size+j+st->magic_samples[i]]; + magic_samples = (olen - st->filt_len)/2; + for (j=0;jfilt_len-1+magic_samples;j++) + st->mem[start+j] = st->mem[start+j+magic_samples]; + st->magic_samples[i] = magic_samples; } } } else if (st->filt_len < old_length) @@ -787,17 +801,22 @@ EXPORT SpeexResamplerState *speex_resampler_init(spx_uint32_t nb_channels, spx_u EXPORT SpeexResamplerState *speex_resampler_init_frac(spx_uint32_t nb_channels, spx_uint32_t ratio_num, spx_uint32_t ratio_den, spx_uint32_t in_rate, spx_uint32_t out_rate, int quality, int *err) { - spx_uint32_t i; SpeexResamplerState *st; int filter_err; - if (quality > 10 || quality < 0) + if (nb_channels == 0 || ratio_num == 0 || ratio_den == 0 || quality > 10 || quality < 0) { if (err) *err = RESAMPLER_ERR_INVALID_ARG; return NULL; } st = (SpeexResamplerState *)speex_alloc(sizeof(SpeexResamplerState)); + if (!st) + { + if (err) + *err = RESAMPLER_ERR_ALLOC_FAILED; + return NULL; + } st->initialised = 0; st->started = 0; st->in_rate = 0; @@ -810,24 +829,21 @@ EXPORT SpeexResamplerState *speex_resampler_init_frac(spx_uint32_t nb_channels, st->filt_len = 0; st->mem = 0; st->resampler_ptr = 0; - + st->cutoff = 1.f; st->nb_channels = nb_channels; st->in_stride = 1; st->out_stride = 1; - + st->buffer_size = 160; - + /* Per channel data */ - st->last_sample = (spx_int32_t*)speex_alloc(nb_channels*sizeof(spx_int32_t)); - st->magic_samples = (spx_uint32_t*)speex_alloc(nb_channels*sizeof(spx_uint32_t)); - st->samp_frac_num = (spx_uint32_t*)speex_alloc(nb_channels*sizeof(spx_uint32_t)); - for (i=0;ilast_sample[i] = 0; - st->magic_samples[i] = 0; - st->samp_frac_num[i] = 0; - } + if (!(st->last_sample = (spx_int32_t*)speex_alloc(nb_channels*sizeof(spx_int32_t)))) + goto fail; + if (!(st->magic_samples = (spx_uint32_t*)speex_alloc(nb_channels*sizeof(spx_uint32_t)))) + goto fail; + if (!(st->samp_frac_num = (spx_uint32_t*)speex_alloc(nb_channels*sizeof(spx_uint32_t)))) + goto fail; speex_resampler_set_quality(st, quality); speex_resampler_set_rate_frac(st, ratio_num, ratio_den, in_rate, out_rate); @@ -844,6 +860,12 @@ EXPORT SpeexResamplerState *speex_resampler_init_frac(spx_uint32_t nb_channels, *err = filter_err; return st; + +fail: + if (err) + *err = RESAMPLER_ERR_ALLOC_FAILED; + speex_resampler_destroy(st); + return NULL; } EXPORT void speex_resampler_destroy(SpeexResamplerState *st) @@ -863,17 +885,17 @@ static int speex_resampler_process_native(SpeexResamplerState *st, spx_uint32_t int out_sample = 0; spx_word16_t *mem = st->mem + channel_index * st->mem_alloc_size; spx_uint32_t ilen; - + st->started = 1; - + /* Call the right resampler through the function ptr */ out_sample = st->resampler_ptr(st, channel_index, mem, in_len, out, out_len); - + if (st->last_sample[channel_index] < (spx_int32_t)*in_len) *in_len = st->last_sample[channel_index]; *out_len = out_sample; st->last_sample[channel_index] -= *in_len; - + ilen = *in_len; for(j=0;jmagic_samples[channel_index]; spx_word16_t *mem = st->mem + channel_index * st->mem_alloc_size; const int N = st->filt_len; - + speex_resampler_process_native(st, channel_index, &tmp_in_len, *out, &out_len); st->magic_samples[channel_index] -= tmp_in_len; - + /* If we couldn't process all "magic" input samples, save the rest for next time */ if (st->magic_samples[channel_index]) { @@ -916,13 +938,13 @@ EXPORT int speex_resampler_process_float(SpeexResamplerState *st, spx_uint32_t c const spx_uint32_t xlen = st->mem_alloc_size - filt_offs; const int istride = st->in_stride; - if (st->magic_samples[channel_index]) + if (st->magic_samples[channel_index]) olen -= speex_resampler_magic(st, channel_index, &out, olen); if (! st->magic_samples[channel_index]) { while (ilen && olen) { spx_uint32_t ichunk = (ilen > xlen) ? xlen : ilen; spx_uint32_t ochunk = olen; - + if (in) { for(j=0;jmem_alloc_size - (st->filt_len - 1); #ifdef VAR_ARRAYS const unsigned int ylen = (olen < FIXED_STACK_ALLOC) ? olen : FIXED_STACK_ALLOC; - VARDECL(spx_word16_t *ystack); - ALLOC(ystack, ylen, spx_word16_t); + spx_word16_t ystack[ylen]; #else const unsigned int ylen = FIXED_STACK_ALLOC; spx_word16_t ystack[FIXED_STACK_ALLOC]; #endif st->out_stride = 1; - + while (ilen && olen) { spx_word16_t *y = ystack; spx_uint32_t ichunk = (ilen > xlen) ? xlen : ilen; @@ -1003,7 +1024,7 @@ EXPORT int speex_resampler_process_int(SpeexResamplerState *st, spx_uint32_t cha #else out[j*ostride_save] = WORD2INT(ystack[j]); #endif - + ilen -= ichunk; olen -= ochunk; out += (ochunk+omagic) * ostride_save; @@ -1039,7 +1060,7 @@ EXPORT int speex_resampler_process_interleaved_float(SpeexResamplerState *st, co st->out_stride = ostride_save; return st->resampler_ptr == resampler_basic_zero ? RESAMPLER_ERR_ALLOC_FAILED : RESAMPLER_ERR_SUCCESS; } - + EXPORT int speex_resampler_process_interleaved_int(SpeexResamplerState *st, const spx_int16_t *in, spx_uint32_t *in_len, spx_int16_t *out, spx_uint32_t *out_len) { spx_uint32_t i; @@ -1074,40 +1095,53 @@ EXPORT void speex_resampler_get_rate(SpeexResamplerState *st, spx_uint32_t *in_r *out_rate = st->out_rate; } +static inline spx_uint32_t compute_gcd(spx_uint32_t a, spx_uint32_t b) +{ + while (b != 0) + { + spx_uint32_t temp = a; + + a = b; + b = temp % b; + } + return a; +} + EXPORT int speex_resampler_set_rate_frac(SpeexResamplerState *st, spx_uint32_t ratio_num, spx_uint32_t ratio_den, spx_uint32_t in_rate, spx_uint32_t out_rate) { spx_uint32_t fact; spx_uint32_t old_den; spx_uint32_t i; + + if (ratio_num == 0 || ratio_den == 0) + return RESAMPLER_ERR_INVALID_ARG; + if (st->in_rate == in_rate && st->out_rate == out_rate && st->num_rate == ratio_num && st->den_rate == ratio_den) return RESAMPLER_ERR_SUCCESS; - + old_den = st->den_rate; st->in_rate = in_rate; st->out_rate = out_rate; st->num_rate = ratio_num; st->den_rate = ratio_den; - /* FIXME: This is terribly inefficient, but who cares (at least for now)? */ - for (fact=2;fact<=IMIN(st->num_rate, st->den_rate);fact++) - { - while ((st->num_rate % fact == 0) && (st->den_rate % fact == 0)) - { - st->num_rate /= fact; - st->den_rate /= fact; - } - } - + + fact = compute_gcd(st->num_rate, st->den_rate); + + st->num_rate /= fact; + st->den_rate /= fact; + if (old_den > 0) { for (i=0;inb_channels;i++) { - st->samp_frac_num[i]=st->samp_frac_num[i]*st->den_rate/old_den; + if (multiply_frac(&st->samp_frac_num[i],st->samp_frac_num[i],st->den_rate,old_den) != RESAMPLER_ERR_SUCCESS) + return RESAMPLER_ERR_OVERFLOW; /* Safety net */ if (st->samp_frac_num[i] >= st->den_rate) st->samp_frac_num[i] = st->den_rate-1; } } - + if (st->initialised) return update_filter(st); return RESAMPLER_ERR_SUCCESS; diff --git a/vendor/libspeex/libspeexdsp/resample_neon.h b/vendor/libspeex/libspeexdsp/resample_neon.h index 0acbd27b9a..85a51fe1c3 100644 --- a/vendor/libspeex/libspeexdsp/resample_neon.h +++ b/vendor/libspeex/libspeexdsp/resample_neon.h @@ -36,14 +36,26 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include #ifdef FIXED_POINT -#ifdef __thumb2__ +#if defined(__aarch64__) +static inline int32_t saturate_32bit_to_16bit(int32_t a) { + int32_t ret; + asm ("fmov s0, %w[a]\n" + "sqxtn h0, s0\n" + "sxtl v0.4s, v0.4h\n" + "fmov %w[ret], s0\n" + : [ret] "=r" (ret) + : [a] "r" (a) + : "v0" ); + return ret; +} +#elif defined(__thumb2__) static inline int32_t saturate_32bit_to_16bit(int32_t a) { int32_t ret; asm ("ssat %[ret], #16, %[a]" - : [ret] "=&r" (ret) + : [ret] "=r" (ret) : [a] "r" (a) : ); return ret; @@ -54,7 +66,7 @@ static inline int32_t saturate_32bit_to_16bit(int32_t a) { asm ("vmov.s32 d0[0], %[a]\n" "vqmovn.s32 d0, q0\n" "vmov.s16 %[ret], d0[0]\n" - : [ret] "=&r" (ret) + : [ret] "=r" (ret) : [a] "r" (a) : "q0"); return ret; @@ -64,7 +76,63 @@ static inline int32_t saturate_32bit_to_16bit(int32_t a) { #define WORD2INT(x) (saturate_32bit_to_16bit(x)) #define OVERRIDE_INNER_PRODUCT_SINGLE -/* Only works when len % 4 == 0 */ +/* Only works when len % 4 == 0 and len >= 4 */ +#if defined(__aarch64__) +static inline int32_t inner_product_single(const int16_t *a, const int16_t *b, unsigned int len) +{ + int32_t ret; + uint32_t remainder = len % 16; + len = len - remainder; + + asm volatile (" cmp %w[len], #0\n" + " b.ne 1f\n" + " ld1 {v16.4h}, [%[b]], #8\n" + " ld1 {v20.4h}, [%[a]], #8\n" + " subs %w[remainder], %w[remainder], #4\n" + " smull v0.4s, v16.4h, v20.4h\n" + " b.ne 4f\n" + " b 5f\n" + "1:" + " ld1 {v16.4h, v17.4h, v18.4h, v19.4h}, [%[b]], #32\n" + " ld1 {v20.4h, v21.4h, v22.4h, v23.4h}, [%[a]], #32\n" + " subs %w[len], %w[len], #16\n" + " smull v0.4s, v16.4h, v20.4h\n" + " smlal v0.4s, v17.4h, v21.4h\n" + " smlal v0.4s, v18.4h, v22.4h\n" + " smlal v0.4s, v19.4h, v23.4h\n" + " b.eq 3f\n" + "2:" + " ld1 {v16.4h, v17.4h, v18.4h, v19.4h}, [%[b]], #32\n" + " ld1 {v20.4h, v21.4h, v22.4h, v23.4h}, [%[a]], #32\n" + " subs %w[len], %w[len], #16\n" + " smlal v0.4s, v16.4h, v20.4h\n" + " smlal v0.4s, v17.4h, v21.4h\n" + " smlal v0.4s, v18.4h, v22.4h\n" + " smlal v0.4s, v19.4h, v23.4h\n" + " b.ne 2b\n" + "3:" + " cmp %w[remainder], #0\n" + " b.eq 5f\n" + "4:" + " ld1 {v18.4h}, [%[b]], #8\n" + " ld1 {v22.4h}, [%[a]], #8\n" + " subs %w[remainder], %w[remainder], #4\n" + " smlal v0.4s, v18.4h, v22.4h\n" + " b.ne 4b\n" + "5:" + " saddlv d0, v0.4s\n" + " sqxtn s0, d0\n" + " sqrshrn h0, s0, #15\n" + " sxtl v0.4s, v0.4h\n" + " fmov %w[ret], s0\n" + : [ret] "=r" (ret), [a] "+r" (a), [b] "+r" (b), + [len] "+r" (len), [remainder] "+r" (remainder) + : + : "cc", "v0", + "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23"); + return ret; +} +#else static inline int32_t inner_product_single(const int16_t *a, const int16_t *b, unsigned int len) { int32_t ret; @@ -112,33 +180,104 @@ static inline int32_t inner_product_single(const int16_t *a, const int16_t *b, u " vqmovn.s64 d0, q0\n" " vqrshrn.s32 d0, q0, #15\n" " vmov.s16 %[ret], d0[0]\n" - : [ret] "=&r" (ret), [a] "+r" (a), [b] "+r" (b), + : [ret] "=r" (ret), [a] "+r" (a), [b] "+r" (b), [len] "+r" (len), [remainder] "+r" (remainder) : : "cc", "q0", - "d16", "d17", "d18", "d19", - "d20", "d21", "d22", "d23"); + "d16", "d17", "d18", "d19", "d20", "d21", "d22", "d23"); return ret; } -#elif defined(FLOATING_POINT) +#endif // !defined(__aarch64__) +#elif defined(FLOATING_POINT) +#if defined(__aarch64__) +static inline int32_t saturate_float_to_16bit(float a) { + int32_t ret; + asm ("fcvtas s1, %s[a]\n" + "sqxtn h1, s1\n" + "sxtl v1.4s, v1.4h\n" + "fmov %w[ret], s1\n" + : [ret] "=r" (ret) + : [a] "w" (a) + : "v1"); + return ret; +} +#else static inline int32_t saturate_float_to_16bit(float a) { int32_t ret; asm ("vmov.f32 d0[0], %[a]\n" "vcvt.s32.f32 d0, d0, #15\n" "vqrshrn.s32 d0, q0, #15\n" "vmov.s16 %[ret], d0[0]\n" - : [ret] "=&r" (ret) + : [ret] "=r" (ret) : [a] "r" (a) : "q0"); return ret; } +#endif + #undef WORD2INT #define WORD2INT(x) (saturate_float_to_16bit(x)) #define OVERRIDE_INNER_PRODUCT_SINGLE -/* Only works when len % 4 == 0 */ +/* Only works when len % 4 == 0 and len >= 4 */ +#if defined(__aarch64__) +static inline float inner_product_single(const float *a, const float *b, unsigned int len) +{ + float ret; + uint32_t remainder = len % 16; + len = len - remainder; + + asm volatile (" cmp %w[len], #0\n" + " b.ne 1f\n" + " ld1 {v16.4s}, [%[b]], #16\n" + " ld1 {v20.4s}, [%[a]], #16\n" + " subs %w[remainder], %w[remainder], #4\n" + " fmul v1.4s, v16.4s, v20.4s\n" + " b.ne 4f\n" + " b 5f\n" + "1:" + " ld1 {v16.4s, v17.4s, v18.4s, v19.4s}, [%[b]], #64\n" + " ld1 {v20.4s, v21.4s, v22.4s, v23.4s}, [%[a]], #64\n" + " subs %w[len], %w[len], #16\n" + " fmul v1.4s, v16.4s, v20.4s\n" + " fmul v2.4s, v17.4s, v21.4s\n" + " fmul v3.4s, v18.4s, v22.4s\n" + " fmul v4.4s, v19.4s, v23.4s\n" + " b.eq 3f\n" + "2:" + " ld1 {v16.4s, v17.4s, v18.4s, v19.4s}, [%[b]], #64\n" + " ld1 {v20.4s, v21.4s, v22.4s, v23.4s}, [%[a]], #64\n" + " subs %w[len], %w[len], #16\n" + " fmla v1.4s, v16.4s, v20.4s\n" + " fmla v2.4s, v17.4s, v21.4s\n" + " fmla v3.4s, v18.4s, v22.4s\n" + " fmla v4.4s, v19.4s, v23.4s\n" + " b.ne 2b\n" + "3:" + " fadd v16.4s, v1.4s, v2.4s\n" + " fadd v17.4s, v3.4s, v4.4s\n" + " cmp %w[remainder], #0\n" + " fadd v1.4s, v16.4s, v17.4s\n" + " b.eq 5f\n" + "4:" + " ld1 {v18.4s}, [%[b]], #16\n" + " ld1 {v22.4s}, [%[a]], #16\n" + " subs %w[remainder], %w[remainder], #4\n" + " fmla v1.4s, v18.4s, v22.4s\n" + " b.ne 4b\n" + "5:" + " faddp v1.4s, v1.4s, v1.4s\n" + " faddp %[ret].4s, v1.4s, v1.4s\n" + : [ret] "=w" (ret), [a] "+r" (a), [b] "+r" (b), + [len] "+r" (len), [remainder] "+r" (remainder) + : + : "cc", "v1", "v2", "v3", "v4", + "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23"); + return ret; +} +#else static inline float inner_product_single(const float *a, const float *b, unsigned int len) { float ret; @@ -191,11 +330,12 @@ static inline float inner_product_single(const float *a, const float *b, unsigne " vadd.f32 d0, d0, d1\n" " vpadd.f32 d0, d0, d0\n" " vmov.f32 %[ret], d0[0]\n" - : [ret] "=&r" (ret), [a] "+r" (a), [b] "+r" (b), + : [ret] "=r" (ret), [a] "+r" (a), [b] "+r" (b), [len] "+l" (len), [remainder] "+l" (remainder) : - : "cc", "q0", "q1", "q2", "q3", "q4", "q5", "q6", "q7", "q8", - "q9", "q10", "q11"); + : "cc", "q0", "q1", "q2", "q3", + "q4", "q5", "q6", "q7", "q8", "q9", "q10", "q11"); return ret; } +#endif // defined(__aarch64__) #endif diff --git a/vendor/libspeex/libspeexdsp/resample_sse.h b/vendor/libspeex/libspeexdsp/resample_sse.h index 64be8a1616..00dc29465b 100644 --- a/vendor/libspeex/libspeexdsp/resample_sse.h +++ b/vendor/libspeex/libspeexdsp/resample_sse.h @@ -9,18 +9,18 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + - Neither the name of the Xiph.org Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -71,7 +71,7 @@ static inline float interpolate_product_single(const float *a, const float *b, u return ret; } -#ifdef _USE_SSE2 +#ifdef USE_SSE2 #include #define OVERRIDE_INNER_PRODUCT_DOUBLE diff --git a/vendor/libspeex/libspeexdsp/scal.c b/vendor/libspeex/libspeexdsp/scal.c index d2ea59c758..807cb51238 100644 --- a/vendor/libspeex/libspeexdsp/scal.c +++ b/vendor/libspeex/libspeexdsp/scal.c @@ -33,8 +33,8 @@ /* The algorithm implemented here is described in: -* J.-M. Valin, Perceptually-Motivated Nonlinear Channel Decorrelation For - Stereo Acoustic Echo Cancellation, Accepted for Joint Workshop on +* J.-M. Valin, Perceptually-Motivated Nonlinear Channel Decorrelation For + Stereo Acoustic Echo Cancellation, Accepted for Joint Workshop on Hands­free Speech Communication and Microphone Arrays (HSCMA), 2008. http://people.xiph.org/~jm/papers/valin_hscma2008.pdf @@ -71,7 +71,7 @@ struct SpeexDecorrState_ { float *vorbis_win; int seed; float *y; - + /* Per-channel stuff */ float *buff; float (*ring)[ALLPASS_ORDER]; @@ -102,13 +102,13 @@ EXPORT SpeexDecorrState *speex_decorrelate_new(int rate, int channels, int frame st->order = speex_alloc(channels*sizeof(int)); st->alpha = speex_alloc(channels*sizeof(float)); st->ring = speex_alloc(channels*ALLPASS_ORDER*sizeof(float)); - + /*FIXME: The +20 is there only as a kludge for ALL_PASS_OLA*/ st->vorbis_win = speex_alloc((2*frame_size+20)*sizeof(float)); for (i=0;i<2*frame_size;i++) st->vorbis_win[i] = sin(.5*M_PI* sin(M_PI*i/(2*frame_size))*sin(M_PI*i/(2*frame_size)) ); st->seed = rand(); - + for (ch=0;ch100) strength = 100; - + amount = .01*strength; for (ch=0;chchannels;ch++) { @@ -156,7 +156,7 @@ EXPORT void speex_decorrelate(SpeexDecorrState *st, const spx_int16_t *in, spx_i float beta, beta2; float *x; float max_alpha = 0; - + float *buff; float *ring; int ringID; @@ -168,7 +168,7 @@ EXPORT void speex_decorrelate(SpeexDecorrState *st, const spx_int16_t *in, spx_i ringID = st->ringID[ch]; order = st->order[ch]; alpha = st->alpha[ch]; - + for (i=0;iframe_size;i++) buff[i] = buff[i+st->frame_size]; for (i=0;iframe_size;i++) @@ -182,12 +182,12 @@ EXPORT void speex_decorrelate(SpeexDecorrState *st, const spx_int16_t *in, spx_i beta = 1-0.63246*amount; if (beta<0) beta = 0; - + beta2 = beta; for (i=0;iframe_size;i++) { - st->y[i] = alpha*(x[i-ALLPASS_ORDER+order]-beta*x[i-ALLPASS_ORDER+order-1])*st->vorbis_win[st->frame_size+i+order] - + x[i-ALLPASS_ORDER]*st->vorbis_win[st->frame_size+i] + st->y[i] = alpha*(x[i-ALLPASS_ORDER+order]-beta*x[i-ALLPASS_ORDER+order-1])*st->vorbis_win[st->frame_size+i+order] + + x[i-ALLPASS_ORDER]*st->vorbis_win[st->frame_size+i] - alpha*(ring[ringID] - beta*ring[ringID+1>=order?0:ringID+1]); ring[ringID++]=st->y[i]; @@ -204,7 +204,7 @@ EXPORT void speex_decorrelate(SpeexDecorrState *st, const spx_int16_t *in, spx_i max_alpha = pow(.96+.04*(amount-1),order); if (max_alpha > .98/(1.+beta2)) max_alpha = .98/(1.+beta2); - + alpha = alpha + .4*uni_rand(&st->seed); if (alpha > max_alpha) alpha = max_alpha; @@ -215,8 +215,8 @@ EXPORT void speex_decorrelate(SpeexDecorrState *st, const spx_int16_t *in, spx_i ringID = 0; for (i=0;iframe_size;i++) { - float tmp = alpha*(x[i-ALLPASS_ORDER+order]-beta*x[i-ALLPASS_ORDER+order-1])*st->vorbis_win[i+order] - + x[i-ALLPASS_ORDER]*st->vorbis_win[i] + float tmp = alpha*(x[i-ALLPASS_ORDER+order]-beta*x[i-ALLPASS_ORDER+order-1])*st->vorbis_win[i+order] + + x[i-ALLPASS_ORDER]*st->vorbis_win[i] - alpha*(ring[ringID] - beta*ring[ringID+1>=order?0:ringID+1]); ring[ringID++]=tmp; @@ -225,7 +225,7 @@ EXPORT void speex_decorrelate(SpeexDecorrState *st, const spx_int16_t *in, spx_i ringID=0; st->y[i] += tmp; } - + #ifdef VORBIS_PSYCHO float frame[N]; float scale = 1./N; @@ -252,7 +252,7 @@ EXPORT void speex_decorrelate(SpeexDecorrState *st, const spx_int16_t *in, spx_i for (i=0;i<2*st->frame_size;i++) frame[i] *= st->vorbis_win[i]; #endif - + for (i=0;iframe_size;i++) { #ifdef VORBIS_PSYCHO @@ -267,7 +267,7 @@ EXPORT void speex_decorrelate(SpeexDecorrState *st, const spx_int16_t *in, spx_i tmp = -32767; out[i*st->channels+ch] = tmp; } - + st->ringID[ch] = ringID; st->order[ch] = order; st->alpha[ch] = alpha; diff --git a/vendor/libspeex/libspeexdsp/smallft.c b/vendor/libspeex/libspeexdsp/smallft.c index 5c26d016fe..82c3b0a4a1 100644 --- a/vendor/libspeex/libspeexdsp/smallft.c +++ b/vendor/libspeex/libspeexdsp/smallft.c @@ -127,7 +127,7 @@ static void dradf2(int ido,int l1,float *cc,float *ch,float *wa1){ t1+=ido; t2+=ido; } - + if(ido<2)return; if(ido==2)goto L105; @@ -174,7 +174,7 @@ static void dradf4(int ido,int l1,float *cc,float *ch,float *wa1, int i,k,t0,t1,t2,t3,t4,t5,t6; float ci2,ci3,ci4,cr2,cr3,cr4,ti1,ti2,ti3,ti4,tr1,tr2,tr3,tr4; t0=l1*ido; - + t1=t0; t4=t1<<1; t2=t1+(t1<<1); @@ -246,7 +246,7 @@ static void dradf4(int ido,int l1,float *cc,float *ch,float *wa1, if(ido&1)return; L105: - + t2=(t1=t0+ido-1)+(t0<<1); t3=ido<<2; t4=ido; @@ -280,7 +280,7 @@ static void dradfg(int ido,int ip,int l1,int idl1,float *cc,float *c1, int nbd; float dcp,arg,dsp,ar1h,ar2h; int idp2,ipp2; - + arg=tpi/(float)ip; dcp=cos(arg); dsp=sin(arg); @@ -638,7 +638,7 @@ static void dradb2(int ido,int l1,float *cc,float *ch,float *wa1){ float ti2,tr2; t0=l1*ido; - + t1=0; t2=0; t3=(ido<<1)-1; @@ -754,7 +754,7 @@ static void dradb4(int ido,int l1,float *cc,float *ch,float *wa1, int i,k,t0,t1,t2,t3,t4,t5,t6,t7,t8; float ci2,ci3,ci4,cr2,cr3,cr4,ti1,ti2,ti3,ti4,tr1,tr2,tr3,tr4; t0=l1*ido; - + t1=0; t2=ido<<2; t3=0; @@ -763,7 +763,7 @@ static void dradb4(int ido,int l1,float *cc,float *ch,float *wa1, t4=t3+t6; t5=t1; tr3=cc[t4-1]+cc[t4-1]; - tr4=cc[t4]+cc[t4]; + tr4=cc[t4]+cc[t4]; tr1=cc[t3]-cc[(t4+=t6)-1]; tr2=cc[t3]+cc[t4-1]; ch[t5]=tr2+tr3; @@ -858,7 +858,7 @@ static void dradbg(int ido,int ip,int l1,int idl1,float *cc,float *c1, ipp2=ip; ipph=(ip+1)>>1; if(ido # else # ifdef HAVE_ALLOCA_H @@ -101,7 +101,7 @@ #endif #if defined(VAR_ARRAYS) -#define VARDECL(var) +#define VARDECL(var) #define ALLOC(var, size, type) type var[size] #elif defined(USE_ALLOCA) #define VARDECL(var) var diff --git a/vendor/libspeex/libspeexdsp/testdenoise.c b/vendor/libspeex/libspeexdsp/testdenoise.c new file mode 100644 index 0000000000..adebe941e4 --- /dev/null +++ b/vendor/libspeex/libspeexdsp/testdenoise.c @@ -0,0 +1,44 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "speex/speex_preprocess.h" +#include + +#define NN 160 + +int main() +{ + short in[NN]; + int i; + SpeexPreprocessState *st; + int count=0; + float f; + + st = speex_preprocess_state_init(NN, 8000); + i=1; + speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_DENOISE, &i); + i=0; + speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_AGC, &i); + i=8000; + speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_AGC_LEVEL, &i); + i=0; + speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_DEREVERB, &i); + f=.0; + speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_DEREVERB_DECAY, &f); + f=.0; + speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_DEREVERB_LEVEL, &f); + while (1) + { + int vad; + fread(in, sizeof(short), NN, stdin); + if (feof(stdin)) + break; + vad = speex_preprocess_run(st, in); + /*fprintf (stderr, "%d\n", vad);*/ + fwrite(in, sizeof(short), NN, stdout); + count++; + } + speex_preprocess_state_destroy(st); + return 0; +} diff --git a/vendor/libspeex/libspeexdsp/testecho.c b/vendor/libspeex/libspeexdsp/testecho.c new file mode 100644 index 0000000000..1624dc2a31 --- /dev/null +++ b/vendor/libspeex/libspeexdsp/testecho.c @@ -0,0 +1,53 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "speex/speex_echo.h" +#include "speex/speex_preprocess.h" +#include +#include +#include +#include +#include + + +#define NN 128 +#define TAIL 1024 + +int main(int argc, char **argv) +{ + FILE *echo_fd, *ref_fd, *e_fd; + short echo_buf[NN], ref_buf[NN], e_buf[NN]; + SpeexEchoState *st; + SpeexPreprocessState *den; + int sampleRate = 8000; + + if (argc != 4) + { + fprintf(stderr, "testecho mic_signal.sw speaker_signal.sw output.sw\n"); + exit(1); + } + echo_fd = fopen(argv[2], "rb"); + ref_fd = fopen(argv[1], "rb"); + e_fd = fopen(argv[3], "wb"); + + st = speex_echo_state_init(NN, TAIL); + den = speex_preprocess_state_init(NN, sampleRate); + speex_echo_ctl(st, SPEEX_ECHO_SET_SAMPLING_RATE, &sampleRate); + speex_preprocess_ctl(den, SPEEX_PREPROCESS_SET_ECHO_STATE, st); + + while (!feof(ref_fd) && !feof(echo_fd)) + { + fread(ref_buf, sizeof(short), NN, ref_fd); + fread(echo_buf, sizeof(short), NN, echo_fd); + speex_echo_cancellation(st, ref_buf, echo_buf, e_buf); + speex_preprocess_run(den, e_buf); + fwrite(e_buf, sizeof(short), NN, e_fd); + } + speex_echo_state_destroy(st); + speex_preprocess_state_destroy(den); + fclose(e_fd); + fclose(echo_fd); + fclose(ref_fd); + return 0; +} diff --git a/vendor/libspeex/libspeexdsp/testjitter.c b/vendor/libspeex/libspeexdsp/testjitter.c new file mode 100644 index 0000000000..399dfe956c --- /dev/null +++ b/vendor/libspeex/libspeexdsp/testjitter.c @@ -0,0 +1,75 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "speex/speex_jitter.h" +#include + +union jbpdata { + unsigned int idx; + unsigned char data[4]; +}; + +void synthIn(JitterBufferPacket *in, int idx, int span) { + union jbpdata d; + d.idx = idx; + + in->data = d.data; + in->len = sizeof(d); + in->timestamp = idx * 10; + in->span = span * 10; + in->sequence = idx; + in->user_data = 0; +} + +void jitterFill(JitterBuffer *jb) { + char buffer[65536]; + JitterBufferPacket in, out; + int i; + + out.data = buffer; + + jitter_buffer_reset(jb); + + for(i=0;i<100;++i) { + synthIn(&in, i, 1); + jitter_buffer_put(jb, &in); + + out.len = 65536; + if (jitter_buffer_get(jb, &out, 10, NULL) != JITTER_BUFFER_OK) { + printf("Fill test failed iteration %d\n", i); + } + if (out.timestamp != i * 10) { + printf("Fill test expected %d got %d\n", i*10, out.timestamp); + } + jitter_buffer_tick(jb); + } +} + +int main() +{ + char buffer[65536]; + JitterBufferPacket in, out; + int i; + + JitterBuffer *jb = jitter_buffer_init(10); + + out.data = buffer; + + /* Frozen sender case */ + jitterFill(jb); + for(i=0;i<100;++i) { + out.len = 65536; + jitter_buffer_get(jb, &out, 10, NULL); + jitter_buffer_tick(jb); + } + synthIn(&in, 100, 1); + jitter_buffer_put(jb, &in); + out.len = 65536; + if (jitter_buffer_get(jb, &out, 10, NULL) != JITTER_BUFFER_OK) { + printf("Failed frozen sender resynchronize\n"); + } else { + printf("Frozen sender: Jitter %d\n", out.timestamp - 100*10); + } + return 0; +} diff --git a/vendor/libspeex/libspeexdsp/testresample.c b/vendor/libspeex/libspeexdsp/testresample.c new file mode 100644 index 0000000000..7ed866756f --- /dev/null +++ b/vendor/libspeex/libspeexdsp/testresample.c @@ -0,0 +1,86 @@ +/* Copyright (C) 2007 Jean-Marc Valin + + File: testresample.c + Testing the resampling code + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + 3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "speex/speex_resampler.h" +#include +#include +#include + +#define NN 256 + +int main() +{ + spx_uint32_t i; + short *in; + short *out; + float *fin, *fout; + int count = 0; + SpeexResamplerState *st = speex_resampler_init(1, 8000, 12000, 10, NULL); + speex_resampler_set_rate(st, 96000, 44100); + speex_resampler_skip_zeros(st); + + in = malloc(NN*sizeof(short)); + out = malloc(2*NN*sizeof(short)); + fin = malloc(NN*sizeof(float)); + fout = malloc(2*NN*sizeof(float)); + while (1) + { + spx_uint32_t in_len; + spx_uint32_t out_len; + fread(in, sizeof(short), NN, stdin); + if (feof(stdin)) + break; + for (i=0;i + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "speex/speex_resampler.h" +#include +#include + +#define PERIOD 32 +#define INBLOCK 1024 +#define RATE 48000 + +int main() +{ + spx_uint32_t i; + float *fin, *fout; + int rate = 1000, off = 0, avail = INBLOCK; + SpeexResamplerState *st = speex_resampler_init(1, RATE, RATE, 4, NULL); + speex_resampler_set_rate(st, RATE, rate); + speex_resampler_skip_zeros(st); + + fin = malloc(INBLOCK*2*sizeof(float)); + for (i=0; i ", rate, off, in_len, out_len); + + speex_resampler_process_float(st, 0, fin + off, &in_len, fout, &out_len); + + fprintf (stderr, "%d %d\n", in_len, out_len); + off += in_len; + avail = avail - in_len + INBLOCK; + + if (off >= INBLOCK) + off -= INBLOCK; + + fwrite(fout, sizeof(float), out_len, stdout); + + rate += 100; + if (rate > 128000) + break; + + speex_resampler_set_rate(st, RATE, rate); + } + speex_resampler_destroy(st); + free(fin); + free(fout); + return 0; +} + diff --git a/vendor/libspeex/libspeexdsp/vorbis_psy.h b/vendor/libspeex/libspeexdsp/vorbis_psy.h index 6871057753..19ea9c3cf2 100644 --- a/vendor/libspeex/libspeexdsp/vorbis_psy.h +++ b/vendor/libspeex/libspeexdsp/vorbis_psy.h @@ -4,18 +4,18 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + - Neither the name of the Xiph.org Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -40,7 +40,7 @@ #define todB(x) ((x)>1e-13?log((x)*(x))*4.34294480f:-30) -#define fromdB(x) (exp((x)*.11512925f)) +#define fromdB(x) (exp((x)*.11512925f)) /* The bark scale equations are approximations, since the original table was somewhat hand rolled. The below are chosen to have the diff --git a/vendor/libspeex/speex/speex.h b/vendor/libspeex/speex/speex.h index 28c4b44df8..34919e2f00 100644 --- a/vendor/libspeex/speex/speex.h +++ b/vendor/libspeex/speex/speex.h @@ -412,7 +412,7 @@ extern const SpeexMode * const speex_mode_list[SPEEX_NB_MODES]; /** Obtain one of the modes available */ const SpeexMode * speex_lib_get_mode (int mode); -#ifndef WIN32 +#ifndef _WIN32 /* We actually override the function in the narrowband case so that we can avoid linking in the wideband stuff */ #define speex_lib_get_mode(mode) ((mode)==SPEEX_MODEID_NB ? &speex_nb_mode : speex_lib_get_mode (mode)) #endif diff --git a/vendor/libspeex/speex/speex_buffer.h b/vendor/libspeex/speex/speex_buffer.h index 5bd128ae7d..9e85cfcf0e 100644 --- a/vendor/libspeex/speex/speex_buffer.h +++ b/vendor/libspeex/speex/speex_buffer.h @@ -1,5 +1,5 @@ /* Copyright (C) 2007 Jean-Marc Valin - + File: speex_buffer.h This is a very simple ring buffer implementation. It is not thread-safe so you need to do your own locking. diff --git a/vendor/libspeex/speex/speex_config_types.h b/vendor/libspeex/speex/speex_config_types.h index f864522910..ca1f5a3c20 100644 --- a/vendor/libspeex/speex/speex_config_types.h +++ b/vendor/libspeex/speex/speex_config_types.h @@ -1,7 +1,7 @@ #ifndef __SPEEX_TYPES_H__ #define __SPEEX_TYPES_H__ -#include +#include typedef int16_t spx_int16_t; typedef uint16_t spx_uint16_t; diff --git a/vendor/libspeex/speex/speex_echo.h b/vendor/libspeex/speex/speex_echo.h index 6f14d0913f..4c1aa5a5f2 100644 --- a/vendor/libspeex/speex/speex_echo.h +++ b/vendor/libspeex/speex/speex_echo.h @@ -63,7 +63,7 @@ extern "C" { struct SpeexEchoState_; /** @class SpeexEchoState - * This holds the state of the echo canceller. You need one per channel. + * This holds the state of the echo canceller. You need one per channel. */ /** Internal echo canceller state. Should never be accessed directly. */ @@ -85,7 +85,7 @@ SpeexEchoState *speex_echo_state_init(int frame_size, int filter_length); */ SpeexEchoState *speex_echo_state_init_mc(int frame_size, int filter_length, int nb_mic, int nb_speakers); -/** Destroys an echo canceller state +/** Destroys an echo canceller state * @param st Echo canceller state */ void speex_echo_state_destroy(SpeexEchoState *st); @@ -117,7 +117,7 @@ void speex_echo_capture(SpeexEchoState *st, const spx_int16_t *rec, spx_int16_t */ void speex_echo_playback(SpeexEchoState *st, const spx_int16_t *play); -/** Reset the echo canceller to its original state +/** Reset the echo canceller to its original state * @param st Echo canceller state */ void speex_echo_state_reset(SpeexEchoState *st); @@ -139,7 +139,7 @@ typedef struct SpeexDecorrState_ SpeexDecorrState; /** Create a state for the channel decorrelation algorithm - This is useful for multi-channel echo cancellation only + This is useful for multi-channel echo cancellation only * @param rate Sampling rate * @param channels Number of channels (it's a bit pointless if you don't have at least 2) * @param frame_size Size of the frame to process at ones (counting samples *per* channel) @@ -155,7 +155,7 @@ SpeexDecorrState *speex_decorrelate_new(int rate, int channels, int frame_size); */ void speex_decorrelate(SpeexDecorrState *st, const spx_int16_t *in, spx_int16_t *out, int strength); -/** Destroy a Decorrelation state +/** Destroy a Decorrelation state * @param st State to destroy */ void speex_decorrelate_destroy(SpeexDecorrState *st); diff --git a/vendor/libspeex/speex/speex_jitter.h b/vendor/libspeex/speex/speex_jitter.h index 66708da5c9..8fc8d7ec66 100644 --- a/vendor/libspeex/speex/speex_jitter.h +++ b/vendor/libspeex/speex/speex_jitter.h @@ -7,18 +7,18 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + - Neither the name of the Xiph.org Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -89,7 +89,7 @@ struct _JitterBufferPacket { /** Included because of an early misspelling (will remove in next release) */ #define JITTER_BUFFER_GET_AVALIABLE_COUNT 3 -/** Assign a function to destroy unused packet. When setting that, the jitter +/** Assign a function to destroy unused packet. When setting that, the jitter buffer no longer copies packet data. */ #define JITTER_BUFFER_SET_DESTROY_CALLBACK 4 /** */ @@ -104,7 +104,7 @@ struct _JitterBufferPacket { #define JITTER_BUFFER_SET_CONCEALMENT_SIZE 8 #define JITTER_BUFFER_GET_CONCEALMENT_SIZE 9 -/** Absolute max amount of loss that can be tolerated regardless of the delay. Typical loss +/** Absolute max amount of loss that can be tolerated regardless of the delay. Typical loss should be half of that or less. */ #define JITTER_BUFFER_SET_MAX_LATE_RATE 10 #define JITTER_BUFFER_GET_MAX_LATE_RATE 11 @@ -114,59 +114,59 @@ struct _JitterBufferPacket { #define JITTER_BUFFER_GET_LATE_COST 13 -/** Initialises jitter buffer - * - * @param step_size Starting value for the size of concleanment packets and delay +/** Initialises jitter buffer + * + * @param step_size Starting value for the size of concleanment packets and delay adjustment steps. Can be changed at any time using JITTER_BUFFER_SET_DELAY_STEP and JITTER_BUFFER_GET_CONCEALMENT_SIZE. * @return Newly created jitter buffer state */ JitterBuffer *jitter_buffer_init(int step_size); -/** Restores jitter buffer to its original state - * +/** Restores jitter buffer to its original state + * * @param jitter Jitter buffer state */ void jitter_buffer_reset(JitterBuffer *jitter); -/** Destroys jitter buffer - * +/** Destroys jitter buffer + * * @param jitter Jitter buffer state */ void jitter_buffer_destroy(JitterBuffer *jitter); /** Put one packet into the jitter buffer - * + * * @param jitter Jitter buffer state * @param packet Incoming packet */ void jitter_buffer_put(JitterBuffer *jitter, const JitterBufferPacket *packet); /** Get one packet from the jitter buffer - * + * * @param jitter Jitter buffer state * @param packet Returned packet * @param desired_span Number of samples (or units) we wish to get from the buffer (no guarantee) - * @param current_timestamp Timestamp for the returned packet + * @param current_timestamp Timestamp for the returned packet */ int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, spx_int32_t desired_span, spx_int32_t *start_offset); /** Used right after jitter_buffer_get() to obtain another packet that would have the same timestamp. * This is mainly useful for media where a single "frame" can be split into several packets. - * + * * @param jitter Jitter buffer state * @param packet Returned packet */ int jitter_buffer_get_another(JitterBuffer *jitter, JitterBufferPacket *packet); /** Get pointer timestamp of jitter buffer - * + * * @param jitter Jitter buffer state */ int jitter_buffer_get_pointer_timestamp(JitterBuffer *jitter); /** Advance by one tick - * + * * @param jitter Jitter buffer state */ void jitter_buffer_tick(JitterBuffer *jitter); @@ -178,7 +178,7 @@ void jitter_buffer_tick(JitterBuffer *jitter); void jitter_buffer_remaining_span(JitterBuffer *jitter, spx_uint32_t rem); /** Used like the ioctl function to control the jitter buffer parameters - * + * * @param jitter Jitter buffer state * @param request ioctl-type request (one of the JITTER_BUFFER_* macros) * @param ptr Data exchanged to-from function diff --git a/vendor/libspeex/speex/speex_preprocess.h b/vendor/libspeex/speex/speex_preprocess.h index b9555eb551..a2e1210d41 100644 --- a/vendor/libspeex/speex/speex_preprocess.h +++ b/vendor/libspeex/speex/speex_preprocess.h @@ -2,7 +2,7 @@ Written by Jean-Marc Valin */ /** * @file speex_preprocess.h - * @brief Speex preprocessor. The preprocess can do noise suppression, + * @brief Speex preprocessor. The preprocess can do noise suppression, * residual echo suppression (after using the echo canceller), automatic * gain control (AGC) and voice activity detection (VAD). */ @@ -37,7 +37,7 @@ #ifndef SPEEX_PREPROCESS_H #define SPEEX_PREPROCESS_H /** @defgroup SpeexPreprocessState SpeexPreprocessState: The Speex preprocessor - * This is the Speex preprocessor. The preprocess can do noise suppression, + * This is the Speex preprocessor. The preprocess can do noise suppression, * residual echo suppression (after using the echo canceller), automatic * gain control (AGC) and voice activity detection (VAD). * @{ @@ -48,7 +48,7 @@ #ifdef __cplusplus extern "C" { #endif - + /** State of the preprocessor (one per channel). Should never be accessed directly. */ struct SpeexPreprocessState_; @@ -64,12 +64,12 @@ typedef struct SpeexPreprocessState_ SpeexPreprocessState; */ SpeexPreprocessState *speex_preprocess_state_init(int frame_size, int sampling_rate); -/** Destroys a preprocessor state +/** Destroys a preprocessor state * @param st Preprocessor state to destroy */ void speex_preprocess_state_destroy(SpeexPreprocessState *st); -/** Preprocess a frame +/** Preprocess a frame * @param st Preprocessor state * @param x Audio sample vector (in and out). Must be same size as specified in speex_preprocess_state_init(). * @return Bool value for voice activity (1 for speech, 0 for noise/silence), ONLY if VAD turned on. @@ -85,7 +85,7 @@ int speex_preprocess(SpeexPreprocessState *st, spx_int16_t *x, spx_int32_t *echo */ void speex_preprocess_estimate_update(SpeexPreprocessState *st, spx_int16_t *x); -/** Used like the ioctl function to control the preprocessor parameters +/** Used like the ioctl function to control the preprocessor parameters * @param st Preprocessor state * @param request ioctl-type request (one of the SPEEX_PREPROCESS_* macros) * @param ptr Data exchanged to-from function diff --git a/vendor/libspeex/speex/speex_resampler.h b/vendor/libspeex/speex/speex_resampler.h index 50d777f5b4..901de37b3d 100644 --- a/vendor/libspeex/speex/speex_resampler.h +++ b/vendor/libspeex/speex/speex_resampler.h @@ -1,8 +1,8 @@ /* Copyright (C) 2007 Jean-Marc Valin - + File: speex_resampler.h Resampling code - + The design goals of this code are: - Very fast algorithm - Low memory requirement @@ -43,7 +43,7 @@ /********* WARNING: MENTAL SANITY ENDS HERE *************/ -/* If the resampler is defined outside of Speex, we change the symbol names so that +/* If the resampler is defined outside of Speex, we change the symbol names so that there won't be any clash if linking with Speex later on. */ /* #define RANDOM_PREFIX your software name here */ @@ -53,7 +53,7 @@ #define CAT_PREFIX2(a,b) a ## b #define CAT_PREFIX(a,b) CAT_PREFIX2(a, b) - + #define speex_resampler_init CAT_PREFIX(RANDOM_PREFIX,_resampler_init) #define speex_resampler_init_frac CAT_PREFIX(RANDOM_PREFIX,_resampler_init_frac) #define speex_resampler_destroy CAT_PREFIX(RANDOM_PREFIX,_resampler_destroy) @@ -81,7 +81,9 @@ #define spx_int32_t int #define spx_uint16_t unsigned short #define spx_uint32_t unsigned int - + +#define speex_assert(cond) + #else /* OUTSIDE_SPEEX */ #include "speexdsp_types.h" @@ -104,7 +106,8 @@ enum { RESAMPLER_ERR_BAD_STATE = 2, RESAMPLER_ERR_INVALID_ARG = 3, RESAMPLER_ERR_PTR_OVERLAP = 4, - + RESAMPLER_ERR_OVERFLOW = 5, + RESAMPLER_ERR_MAX_ERROR }; @@ -120,14 +123,14 @@ typedef struct SpeexResamplerState_ SpeexResamplerState; * @return Newly created resampler state * @retval NULL Error: not enough memory */ -SpeexResamplerState *speex_resampler_init(spx_uint32_t nb_channels, - spx_uint32_t in_rate, - spx_uint32_t out_rate, +SpeexResamplerState *speex_resampler_init(spx_uint32_t nb_channels, + spx_uint32_t in_rate, + spx_uint32_t out_rate, int quality, int *err); -/** Create a new resampler with fractional input/output rates. The sampling - * rate ratio is an arbitrary rational number with both the numerator and +/** Create a new resampler with fractional input/output rates. The sampling + * rate ratio is an arbitrary rational number with both the numerator and * denominator being 32-bit integers. * @param nb_channels Number of channels to be processed * @param ratio_num Numerator of the sampling rate ratio @@ -139,11 +142,11 @@ SpeexResamplerState *speex_resampler_init(spx_uint32_t nb_channels, * @return Newly created resampler state * @retval NULL Error: not enough memory */ -SpeexResamplerState *speex_resampler_init_frac(spx_uint32_t nb_channels, - spx_uint32_t ratio_num, - spx_uint32_t ratio_den, - spx_uint32_t in_rate, - spx_uint32_t out_rate, +SpeexResamplerState *speex_resampler_init_frac(spx_uint32_t nb_channels, + spx_uint32_t ratio_num, + spx_uint32_t ratio_den, + spx_uint32_t in_rate, + spx_uint32_t out_rate, int quality, int *err); @@ -154,24 +157,24 @@ void speex_resampler_destroy(SpeexResamplerState *st); /** Resample a float array. The input and output buffers must *not* overlap. * @param st Resampler state - * @param channel_index Index of the channel to process for the multi-channel + * @param channel_index Index of the channel to process for the multi-channel * base (0 otherwise) * @param in Input buffer - * @param in_len Number of input samples in the input buffer. Returns the + * @param in_len Number of input samples in the input buffer. Returns the * number of samples processed * @param out Output buffer * @param out_len Size of the output buffer. Returns the number of samples written */ -int speex_resampler_process_float(SpeexResamplerState *st, - spx_uint32_t channel_index, - const float *in, - spx_uint32_t *in_len, - float *out, +int speex_resampler_process_float(SpeexResamplerState *st, + spx_uint32_t channel_index, + const float *in, + spx_uint32_t *in_len, + float *out, spx_uint32_t *out_len); /** Resample an int array. The input and output buffers must *not* overlap. * @param st Resampler state - * @param channel_index Index of the channel to process for the multi-channel + * @param channel_index Index of the channel to process for the multi-channel * base (0 otherwise) * @param in Input buffer * @param in_len Number of input samples in the input buffer. Returns the number @@ -179,11 +182,11 @@ int speex_resampler_process_float(SpeexResamplerState *st, * @param out Output buffer * @param out_len Size of the output buffer. Returns the number of samples written */ -int speex_resampler_process_int(SpeexResamplerState *st, - spx_uint32_t channel_index, - const spx_int16_t *in, - spx_uint32_t *in_len, - spx_int16_t *out, +int speex_resampler_process_int(SpeexResamplerState *st, + spx_uint32_t channel_index, + const spx_int16_t *in, + spx_uint32_t *in_len, + spx_int16_t *out, spx_uint32_t *out_len); /** Resample an interleaved float array. The input and output buffers must *not* overlap. @@ -195,10 +198,10 @@ int speex_resampler_process_int(SpeexResamplerState *st, * @param out_len Size of the output buffer. Returns the number of samples written. * This is all per-channel. */ -int speex_resampler_process_interleaved_float(SpeexResamplerState *st, - const float *in, - spx_uint32_t *in_len, - float *out, +int speex_resampler_process_interleaved_float(SpeexResamplerState *st, + const float *in, + spx_uint32_t *in_len, + float *out, spx_uint32_t *out_len); /** Resample an interleaved int array. The input and output buffers must *not* overlap. @@ -210,10 +213,10 @@ int speex_resampler_process_interleaved_float(SpeexResamplerState *st, * @param out_len Size of the output buffer. Returns the number of samples written. * This is all per-channel. */ -int speex_resampler_process_interleaved_int(SpeexResamplerState *st, - const spx_int16_t *in, - spx_uint32_t *in_len, - spx_int16_t *out, +int speex_resampler_process_interleaved_int(SpeexResamplerState *st, + const spx_int16_t *in, + spx_uint32_t *in_len, + spx_int16_t *out, spx_uint32_t *out_len); /** Set (change) the input/output sampling rates (integer value). @@ -221,8 +224,8 @@ int speex_resampler_process_interleaved_int(SpeexResamplerState *st, * @param in_rate Input sampling rate (integer number of Hz). * @param out_rate Output sampling rate (integer number of Hz). */ -int speex_resampler_set_rate(SpeexResamplerState *st, - spx_uint32_t in_rate, +int speex_resampler_set_rate(SpeexResamplerState *st, + spx_uint32_t in_rate, spx_uint32_t out_rate); /** Get the current input/output sampling rates (integer value). @@ -230,11 +233,11 @@ int speex_resampler_set_rate(SpeexResamplerState *st, * @param in_rate Input sampling rate (integer number of Hz) copied. * @param out_rate Output sampling rate (integer number of Hz) copied. */ -void speex_resampler_get_rate(SpeexResamplerState *st, - spx_uint32_t *in_rate, +void speex_resampler_get_rate(SpeexResamplerState *st, + spx_uint32_t *in_rate, spx_uint32_t *out_rate); -/** Set (change) the input/output sampling rates and resampling ratio +/** Set (change) the input/output sampling rates and resampling ratio * (fractional values in Hz supported). * @param st Resampler state * @param ratio_num Numerator of the sampling rate ratio @@ -242,10 +245,10 @@ void speex_resampler_get_rate(SpeexResamplerState *st, * @param in_rate Input sampling rate rounded to the nearest integer (in Hz). * @param out_rate Output sampling rate rounded to the nearest integer (in Hz). */ -int speex_resampler_set_rate_frac(SpeexResamplerState *st, - spx_uint32_t ratio_num, - spx_uint32_t ratio_den, - spx_uint32_t in_rate, +int speex_resampler_set_rate_frac(SpeexResamplerState *st, + spx_uint32_t ratio_num, + spx_uint32_t ratio_den, + spx_uint32_t in_rate, spx_uint32_t out_rate); /** Get the current resampling ratio. This will be reduced to the least @@ -254,52 +257,52 @@ int speex_resampler_set_rate_frac(SpeexResamplerState *st, * @param ratio_num Numerator of the sampling rate ratio copied * @param ratio_den Denominator of the sampling rate ratio copied */ -void speex_resampler_get_ratio(SpeexResamplerState *st, - spx_uint32_t *ratio_num, +void speex_resampler_get_ratio(SpeexResamplerState *st, + spx_uint32_t *ratio_num, spx_uint32_t *ratio_den); /** Set (change) the conversion quality. * @param st Resampler state - * @param quality Resampling quality between 0 and 10, where 0 has poor + * @param quality Resampling quality between 0 and 10, where 0 has poor * quality and 10 has very high quality. */ -int speex_resampler_set_quality(SpeexResamplerState *st, +int speex_resampler_set_quality(SpeexResamplerState *st, int quality); /** Get the conversion quality. * @param st Resampler state - * @param quality Resampling quality between 0 and 10, where 0 has poor + * @param quality Resampling quality between 0 and 10, where 0 has poor * quality and 10 has very high quality. */ -void speex_resampler_get_quality(SpeexResamplerState *st, +void speex_resampler_get_quality(SpeexResamplerState *st, int *quality); /** Set (change) the input stride. * @param st Resampler state * @param stride Input stride */ -void speex_resampler_set_input_stride(SpeexResamplerState *st, +void speex_resampler_set_input_stride(SpeexResamplerState *st, spx_uint32_t stride); /** Get the input stride. * @param st Resampler state * @param stride Input stride copied */ -void speex_resampler_get_input_stride(SpeexResamplerState *st, +void speex_resampler_get_input_stride(SpeexResamplerState *st, spx_uint32_t *stride); /** Set (change) the output stride. * @param st Resampler state * @param stride Output stride */ -void speex_resampler_set_output_stride(SpeexResamplerState *st, +void speex_resampler_set_output_stride(SpeexResamplerState *st, spx_uint32_t stride); /** Get the output stride. * @param st Resampler state copied * @param stride Output stride */ -void speex_resampler_get_output_stride(SpeexResamplerState *st, +void speex_resampler_get_output_stride(SpeexResamplerState *st, spx_uint32_t *stride); /** Get the latency introduced by the resampler measured in input samples. @@ -312,8 +315,8 @@ int speex_resampler_get_input_latency(SpeexResamplerState *st); */ int speex_resampler_get_output_latency(SpeexResamplerState *st); -/** Make sure that the first samples to go out of the resamplers don't have - * leading zeros. This is only useful before starting to use a newly created +/** Make sure that the first samples to go out of the resamplers don't have + * leading zeros. This is only useful before starting to use a newly created * resampler. It is recommended to use that when resampling an audio file, as * it will generate a file with the same length. For real-time processing, * it is probably easier not to use this call (so that the output duration diff --git a/vendor/libspeex/speex/speex_stereo.h b/vendor/libspeex/speex/speex_stereo.h index 5844f5a102..12af2bbf6e 100644 --- a/vendor/libspeex/speex/speex_stereo.h +++ b/vendor/libspeex/speex/speex_stereo.h @@ -61,7 +61,7 @@ typedef struct SpeexStereoState { #define SPEEX_STEREO_STATE_INIT {1,.5,1,1,0,0} /** Initialise/create a stereo stereo state */ -SpeexStereoState *speex_stereo_state_init(); +SpeexStereoState *speex_stereo_state_init(void); /** Reset/re-initialise an already allocated stereo state */ void speex_stereo_state_reset(SpeexStereoState *stereo); diff --git a/vendor/libspeex/speex/speexdsp_config_types.h b/vendor/libspeex/speex/speexdsp_config_types.h index f864522910..d77d0ca8f9 100644 --- a/vendor/libspeex/speex/speexdsp_config_types.h +++ b/vendor/libspeex/speex/speexdsp_config_types.h @@ -9,4 +9,3 @@ typedef int32_t spx_int32_t; typedef uint32_t spx_uint32_t; #endif - diff --git a/vendor/libspeex/speex/speexdsp_types.h b/vendor/libspeex/speex/speexdsp_types.h index 334d6745ac..4b4a76a474 100644 --- a/vendor/libspeex/speex/speexdsp_types.h +++ b/vendor/libspeex/speex/speexdsp_types.h @@ -22,7 +22,7 @@ #ifndef _SPEEX_TYPES_H #define _SPEEX_TYPES_H -#if defined(_WIN32) +#if defined(_WIN32) # if defined(__CYGWIN__) # include <_G_config.h> diff --git a/vendor/nvapi/NvApiDriverSettings.c b/vendor/nvapi/NvApiDriverSettings.c index 2fb52dd755..ea117a30cc 100644 --- a/vendor/nvapi/NvApiDriverSettings.c +++ b/vendor/nvapi/NvApiDriverSettings.c @@ -148,13 +148,6 @@ EValues_OGL_SINGLE_BACKDEPTH_BUFFER g_valuesOGL_SINGLE_BACKDEPTH_BUFFER[OGL_SING OGL_SINGLE_BACKDEPTH_BUFFER_USE_HW_DEFAULT, }; -EValues_OGL_SLI_CFR_MODE g_valuesOGL_SLI_CFR_MODE[OGL_SLI_CFR_MODE_NUM_VALUES] = -{ - OGL_SLI_CFR_MODE_DISABLE, - OGL_SLI_CFR_MODE_ENABLE, - OGL_SLI_CFR_MODE_CLASSIC_SFR, -}; - EValues_OGL_SLI_MULTICAST g_valuesOGL_SLI_MULTICAST[OGL_SLI_MULTICAST_NUM_VALUES] = { OGL_SLI_MULTICAST_DISABLE, @@ -775,6 +768,30 @@ EValues_PS_SHADERDISKCACHE g_valuesPS_SHADERDISKCACHE[PS_SHADERDISKCACHE_NUM_VAL PS_SHADERDISKCACHE_ON, }; +EValues_PS_SHADERDISKCACHE_FLAGS g_valuesPS_SHADERDISKCACHE_FLAGS[PS_SHADERDISKCACHE_FLAGS_NUM_VALUES] = +{ + PS_SHADERDISKCACHE_FLAGS_DISABLE_DEFAULT_COMPILES, + PS_SHADERDISKCACHE_FLAGS_DISABLE_OPTIONAL_COMPILES, + PS_SHADERDISKCACHE_FLAGS_DISABLE_DRIVER_VERSIONING, + PS_SHADERDISKCACHE_FLAGS_DUMP_HISTOGRAM, + PS_SHADERDISKCACHE_FLAGS_DUMP_TIMELINE, + PS_SHADERDISKCACHE_FLAGS_DISABLE_GARBAGE_COLLECTION, + PS_SHADERDISKCACHE_FLAGS_ENABLE_ENCRYPTION, + PS_SHADERDISKCACHE_FLAGS_DISABLE_CRC, + PS_SHADERDISKCACHE_FLAGS_ENABLE_STATS_FILES, + PS_SHADERDISKCACHE_FLAGS_DISABLE_STATS_RESET, + PS_SHADERDISKCACHE_FLAGS_DISABLE_DEBUG_FORCED_COMPILE, + PS_SHADERDISKCACHE_FLAGS_NO_COMPRESSION, + PS_SHADERDISKCACHE_FLAGS_RLE_COMPRESSION, + PS_SHADERDISKCACHE_FLAGS_LZMA_COMPRESSION, + PS_SHADERDISKCACHE_FLAGS_BACKEND_MEM_MAP_FILES, + PS_SHADERDISKCACHE_FLAGS_BACKEND_DLL, + PS_SHADERDISKCACHE_FLAGS_FLOOD_CACHE_DIRECTORY, + PS_SHADERDISKCACHE_FLAGS_DISABLE_DEDUPLICATION, + PS_SHADERDISKCACHE_FLAGS_DELETE_PERFECT_CACHES, + PS_SHADERDISKCACHE_FLAGS_ALL_BUILDS_MISMATCH_TEST, +}; + EValues_PS_SHADERDISKCACHE_MAX_SIZE g_valuesPS_SHADERDISKCACHE_MAX_SIZE[PS_SHADERDISKCACHE_MAX_SIZE_NUM_VALUES] = { PS_SHADERDISKCACHE_MAX_SIZE_MIN, @@ -878,7 +895,6 @@ SettingDWORDNameString mapSettingDWORD[TOTAL_DWORD_SETTING_NUM] = {OGL_OVERLAY_SUPPORT_ID, OGL_OVERLAY_SUPPORT_STRING, 3, (NvU32 *)g_valuesOGL_OVERLAY_SUPPORT, OGL_OVERLAY_SUPPORT_OFF}, {OGL_QUALITY_ENHANCEMENTS_ID, OGL_QUALITY_ENHANCEMENTS_STRING, 4, (NvU32 *)g_valuesOGL_QUALITY_ENHANCEMENTS, OGL_QUALITY_ENHANCEMENTS_QUAL}, {OGL_SINGLE_BACKDEPTH_BUFFER_ID, OGL_SINGLE_BACKDEPTH_BUFFER_STRING, 3, (NvU32 *)g_valuesOGL_SINGLE_BACKDEPTH_BUFFER, OGL_SINGLE_BACKDEPTH_BUFFER_DISABLE}, - {OGL_SLI_CFR_MODE_ID, OGL_SLI_CFR_MODE_STRING, 3, (NvU32 *)g_valuesOGL_SLI_CFR_MODE, OGL_SLI_CFR_MODE_DISABLE}, {OGL_SLI_MULTICAST_ID, OGL_SLI_MULTICAST_STRING, 4, (NvU32 *)g_valuesOGL_SLI_MULTICAST, OGL_SLI_MULTICAST_DISABLE}, {OGL_THREAD_CONTROL_ID, OGL_THREAD_CONTROL_STRING, 2, (NvU32 *)g_valuesOGL_THREAD_CONTROL, 0x00000000}, {OGL_TMON_LEVEL_ID, OGL_TMON_LEVEL_STRING, 6, (NvU32 *)g_valuesOGL_TMON_LEVEL, OGL_TMON_LEVEL_MOST}, @@ -895,6 +911,8 @@ SettingDWORDNameString mapSettingDWORD[TOTAL_DWORD_SETTING_NUM] = {ANSEL_ALLOW_ID, ANSEL_ALLOW_STRING, 2, (NvU32 *)g_valuesANSEL_ALLOW, ANSEL_ALLOW_ALLOWED}, {ANSEL_ALLOWLISTED_ID, ANSEL_ALLOWLISTED_STRING, 2, (NvU32 *)g_valuesANSEL_ALLOWLISTED, ANSEL_ALLOWLISTED_DISALLOWED}, {ANSEL_ENABLE_ID, ANSEL_ENABLE_STRING, 2, (NvU32 *)g_valuesANSEL_ENABLE, ANSEL_ENABLE_ON}, + {APPIDLE_DYNAMIC_FRL_FPS_ID, APPIDLE_DYNAMIC_FRL_FPS_STRING, 0, NULL, 0x00000000}, + {APPIDLE_DYNAMIC_FRL_THRESHOLD_TIME_ID, APPIDLE_DYNAMIC_FRL_THRESHOLD_TIME_STRING, 0, NULL, 0x00000000}, {APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_ID, APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_STRING, 6, (NvU32 *)g_valuesAPPLICATION_PROFILE_NOTIFICATION_TIMEOUT, APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_DISABLED}, {APPLICATION_STEAM_ID_ID, APPLICATION_STEAM_ID_STRING, 0, NULL, 0x00000000}, {BATTERY_BOOST_APP_FPS_ID, BATTERY_BOOST_APP_FPS_STRING, 3, (NvU32 *)g_valuesBATTERY_BOOST_APP_FPS, BATTERY_BOOST_APP_FPS_NO_OVERRIDE}, @@ -946,6 +964,7 @@ SettingDWORDNameString mapSettingDWORD[TOTAL_DWORD_SETTING_NUM] = {MAXWELL_B_SAMPLE_INTERLEAVE_ID, MAXWELL_B_SAMPLE_INTERLEAVE_STRING, 2, (NvU32 *)g_valuesMAXWELL_B_SAMPLE_INTERLEAVE, MAXWELL_B_SAMPLE_INTERLEAVE_OFF}, {PRERENDERLIMIT_ID, PRERENDERLIMIT_STRING, 3, (NvU32 *)g_valuesPRERENDERLIMIT, PRERENDERLIMIT_APP_CONTROLLED}, {PS_SHADERDISKCACHE_ID, PS_SHADERDISKCACHE_STRING, 2, (NvU32 *)g_valuesPS_SHADERDISKCACHE, PS_SHADERDISKCACHE_ON}, + {PS_SHADERDISKCACHE_FLAGS_ID, PS_SHADERDISKCACHE_FLAGS_STRING, 20, (NvU32 *)g_valuesPS_SHADERDISKCACHE_FLAGS, 0x00000000}, {PS_SHADERDISKCACHE_MAX_SIZE_ID, PS_SHADERDISKCACHE_MAX_SIZE_STRING, 2, (NvU32 *)g_valuesPS_SHADERDISKCACHE_MAX_SIZE, 0x00000000}, {PS_TEXFILTER_ANISO_OPTS2_ID, PS_TEXFILTER_ANISO_OPTS2_STRING, 2, (NvU32 *)g_valuesPS_TEXFILTER_ANISO_OPTS2, PS_TEXFILTER_ANISO_OPTS2_OFF}, {PS_TEXFILTER_BILINEAR_IN_ANISO_ID, PS_TEXFILTER_BILINEAR_IN_ANISO_STRING, 2, (NvU32 *)g_valuesPS_TEXFILTER_BILINEAR_IN_ANISO, PS_TEXFILTER_BILINEAR_IN_ANISO_OFF}, @@ -966,5 +985,6 @@ SettingWSTRINGNameString mapSettingWSTRING[TOTAL_WSTRING_SETTING_NUM] = {CUDA_EXCLUDED_GPUS_ID, CUDA_EXCLUDED_GPUS_STRING, 1, (const wchar_t **)g_valuesCUDA_EXCLUDED_GPUS, L"none"}, {D3DOGL_GPU_MAX_POWER_ID, D3DOGL_GPU_MAX_POWER_STRING, 1, (const wchar_t **)g_valuesD3DOGL_GPU_MAX_POWER, L"0"}, {ICAFE_LOGO_CONFIG_ID, ICAFE_LOGO_CONFIG_STRING, 0, NULL, L""}, + {PS_SHADERDISKCACHE_DLL_PATH_WCHAR_ID, PS_SHADERDISKCACHE_DLL_PATH_WCHAR_STRING, 0, NULL, L""}, }; diff --git a/vendor/nvapi/NvApiDriverSettings.h b/vendor/nvapi/NvApiDriverSettings.h index 100f9c8faa..08e8ddc331 100644 --- a/vendor/nvapi/NvApiDriverSettings.h +++ b/vendor/nvapi/NvApiDriverSettings.h @@ -57,7 +57,6 @@ #define OGL_OVERLAY_SUPPORT_STRING L"Enable overlay" #define OGL_QUALITY_ENHANCEMENTS_STRING L"High level control of the rendering quality on OpenGL" #define OGL_SINGLE_BACKDEPTH_BUFFER_STRING L"Unified back/depth buffer" -#define OGL_SLI_CFR_MODE_STRING L"Set CFR mode" #define OGL_SLI_MULTICAST_STRING L"Enable NV_gpu_multicast extension" #define OGL_THREAD_CONTROL_STRING L"Threaded optimization" #define OGL_TMON_LEVEL_STRING L"Event Log Tmon Severity Threshold" @@ -74,6 +73,8 @@ #define ANSEL_ALLOW_STRING L"NVIDIA Predefined Ansel Usage" #define ANSEL_ALLOWLISTED_STRING L"Ansel flags for enabled applications" #define ANSEL_ENABLE_STRING L"Enable Ansel" +#define APPIDLE_DYNAMIC_FRL_FPS_STRING L"Idle Application Max FPS Limit" +#define APPIDLE_DYNAMIC_FRL_THRESHOLD_TIME_STRING L"Idle Application Threshold Time out in seconds" #define APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_STRING L"Application Profile Notification Popup Timeout" #define APPLICATION_STEAM_ID_STRING L"Steam Application ID" #define BATTERY_BOOST_APP_FPS_STRING L"Battery Boost Application FPS" @@ -128,6 +129,8 @@ #define MAXWELL_B_SAMPLE_INTERLEAVE_STRING L"Enable sample interleaving (MFAA)" #define PRERENDERLIMIT_STRING L"Maximum pre-rendered frames" #define PS_SHADERDISKCACHE_STRING L"Shader Cache" +#define PS_SHADERDISKCACHE_DLL_PATH_WCHAR_STRING L"shader cache path to dll" +#define PS_SHADERDISKCACHE_FLAGS_STRING L"shader cache control flags" #define PS_SHADERDISKCACHE_MAX_SIZE_STRING L"Shader disk cache maximum size" #define PS_TEXFILTER_ANISO_OPTS2_STRING L"Texture filtering - Anisotropic sample optimization" #define PS_TEXFILTER_BILINEAR_IN_ANISO_STRING L"Texture filtering - Anisotropic filter optimization" @@ -159,7 +162,6 @@ enum ESetting { OGL_OVERLAY_SUPPORT_ID = 0x206C28C4, OGL_QUALITY_ENHANCEMENTS_ID = 0x20797D6C, OGL_SINGLE_BACKDEPTH_BUFFER_ID = 0x20A29055, - OGL_SLI_CFR_MODE_ID = 0x20343843, OGL_SLI_MULTICAST_ID = 0x2092D3BE, OGL_THREAD_CONTROL_ID = 0x20C1221E, OGL_TMON_LEVEL_ID = 0x202888C1, @@ -176,6 +178,8 @@ enum ESetting { ANSEL_ALLOW_ID = 0x1035DB89, ANSEL_ALLOWLISTED_ID = 0x1085DA8A, ANSEL_ENABLE_ID = 0x1075D972, + APPIDLE_DYNAMIC_FRL_FPS_ID = 0x10835016, + APPIDLE_DYNAMIC_FRL_THRESHOLD_TIME_ID = 0x10835017, APPLICATION_PROFILE_NOTIFICATION_TIMEOUT_ID = 0x104554B6, APPLICATION_STEAM_ID_ID = 0x107CDDBC, BATTERY_BOOST_APP_FPS_ID = 0x10115C8C, @@ -230,6 +234,8 @@ enum ESetting { MAXWELL_B_SAMPLE_INTERLEAVE_ID = 0x0098C1AC, PRERENDERLIMIT_ID = 0x007BA09E, PS_SHADERDISKCACHE_ID = 0x00198FFF, + PS_SHADERDISKCACHE_DLL_PATH_WCHAR_ID = 0x0019A002, + PS_SHADERDISKCACHE_FLAGS_ID = 0x00F4889B, PS_SHADERDISKCACHE_MAX_SIZE_ID = 0x00AC8497, PS_TEXFILTER_ANISO_OPTS2_ID = 0x00E73211, PS_TEXFILTER_BILINEAR_IN_ANISO_ID = 0x0084CD70, @@ -242,9 +248,9 @@ enum ESetting { SET_VAB_DATA_ID = 0x00AB8687, VSYNCMODE_ID = 0x00A879CF, VSYNCTEARCONTROL_ID = 0x005A375C, - TOTAL_DWORD_SETTING_NUM = 96, - TOTAL_WSTRING_SETTING_NUM = 4, - TOTAL_SETTING_NUM = 100, + TOTAL_DWORD_SETTING_NUM = 98, + TOTAL_WSTRING_SETTING_NUM = 5, + TOTAL_SETTING_NUM = 103, INVALID_SETTING_ID = 0xFFFFFFFF }; @@ -371,14 +377,6 @@ enum EValues_OGL_SINGLE_BACKDEPTH_BUFFER { OGL_SINGLE_BACKDEPTH_BUFFER_DEFAULT = OGL_SINGLE_BACKDEPTH_BUFFER_DISABLE }; -enum EValues_OGL_SLI_CFR_MODE { - OGL_SLI_CFR_MODE_DISABLE = 0x00, - OGL_SLI_CFR_MODE_ENABLE = 0x01, - OGL_SLI_CFR_MODE_CLASSIC_SFR = 0x02, - OGL_SLI_CFR_MODE_NUM_VALUES = 3, - OGL_SLI_CFR_MODE_DEFAULT = OGL_SLI_CFR_MODE_DISABLE -}; - enum EValues_OGL_SLI_MULTICAST { OGL_SLI_MULTICAST_DISABLE = 0x00, OGL_SLI_MULTICAST_ENABLE = 0x01, @@ -1056,6 +1054,31 @@ enum EValues_PS_SHADERDISKCACHE { PS_SHADERDISKCACHE_DEFAULT = PS_SHADERDISKCACHE_ON }; +enum EValues_PS_SHADERDISKCACHE_FLAGS { + PS_SHADERDISKCACHE_FLAGS_DISABLE_DEFAULT_COMPILES = 0x00000001, + PS_SHADERDISKCACHE_FLAGS_DISABLE_OPTIONAL_COMPILES = 0x00000002, + PS_SHADERDISKCACHE_FLAGS_DISABLE_DRIVER_VERSIONING = 0x00000008, + PS_SHADERDISKCACHE_FLAGS_DUMP_HISTOGRAM = 0x00000010, + PS_SHADERDISKCACHE_FLAGS_DUMP_TIMELINE = 0x00000020, + PS_SHADERDISKCACHE_FLAGS_DISABLE_GARBAGE_COLLECTION = 0x00000040, + PS_SHADERDISKCACHE_FLAGS_ENABLE_ENCRYPTION = 0x00000080, + PS_SHADERDISKCACHE_FLAGS_DISABLE_CRC = 0x00000100, + PS_SHADERDISKCACHE_FLAGS_ENABLE_STATS_FILES = 0x00000200, + PS_SHADERDISKCACHE_FLAGS_DISABLE_STATS_RESET = 0x00000400, + PS_SHADERDISKCACHE_FLAGS_DISABLE_DEBUG_FORCED_COMPILE = 0x00000800, + PS_SHADERDISKCACHE_FLAGS_NO_COMPRESSION = 0x00001000, + PS_SHADERDISKCACHE_FLAGS_RLE_COMPRESSION = 0x00002000, + PS_SHADERDISKCACHE_FLAGS_LZMA_COMPRESSION = 0x00004000, + PS_SHADERDISKCACHE_FLAGS_BACKEND_MEM_MAP_FILES = 0x00010000, + PS_SHADERDISKCACHE_FLAGS_BACKEND_DLL = 0x00020000, + PS_SHADERDISKCACHE_FLAGS_FLOOD_CACHE_DIRECTORY = 0x00100000, + PS_SHADERDISKCACHE_FLAGS_DISABLE_DEDUPLICATION = 0x00200000, + PS_SHADERDISKCACHE_FLAGS_DELETE_PERFECT_CACHES = 0x00400000, + PS_SHADERDISKCACHE_FLAGS_ALL_BUILDS_MISMATCH_TEST = 0x00800000, + PS_SHADERDISKCACHE_FLAGS_NUM_VALUES = 20, + PS_SHADERDISKCACHE_FLAGS_DEFAULT = 0x0 +}; + enum EValues_PS_SHADERDISKCACHE_MAX_SIZE { PS_SHADERDISKCACHE_MAX_SIZE_MIN = 0x0, PS_SHADERDISKCACHE_MAX_SIZE_MAX = 0xffffffff, diff --git a/vendor/nvapi/amd64/nvapi64.lib b/vendor/nvapi/amd64/nvapi64.lib index 9f3729abad..1483b30007 100644 Binary files a/vendor/nvapi/amd64/nvapi64.lib and b/vendor/nvapi/amd64/nvapi64.lib differ diff --git a/vendor/nvapi/nvHLSLExtns.h b/vendor/nvapi/nvHLSLExtns.h index 9394036dad..3b5d3a0a0c 100644 --- a/vendor/nvapi/nvHLSLExtns.h +++ b/vendor/nvapi/nvHLSLExtns.h @@ -1625,6 +1625,123 @@ uint4 NvWaveMultiPrefixExclusiveXOr(uint4 val, uint mask) return NvWaveMultiPrefixInclusiveXOr(val, mask); } + +//----------------------------------------------------------------------------// +//------------------------- DXR Micro-map Extension --------------------------// +//----------------------------------------------------------------------------// + +float3x3 NvRtTriangleObjectPositions() +{ + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].opcode = NV_EXTN_OP_RT_TRIANGLE_OBJECT_POSITIONS; + + float3x3 ret; + ret[0][0] = asfloat(g_NvidiaExt.IncrementCounter()); + ret[0][1] = asfloat(g_NvidiaExt.IncrementCounter()); + ret[0][2] = asfloat(g_NvidiaExt.IncrementCounter()); + ret[1][0] = asfloat(g_NvidiaExt.IncrementCounter()); + ret[1][1] = asfloat(g_NvidiaExt.IncrementCounter()); + ret[1][2] = asfloat(g_NvidiaExt.IncrementCounter()); + ret[2][0] = asfloat(g_NvidiaExt.IncrementCounter()); + ret[2][1] = asfloat(g_NvidiaExt.IncrementCounter()); + ret[2][2] = asfloat(g_NvidiaExt.IncrementCounter()); + return ret; +} + +float3x3 NvRtMicroTriangleObjectPositions() +{ + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].opcode = NV_EXTN_OP_RT_MICRO_TRIANGLE_OBJECT_POSITIONS; + + float3x3 ret; + ret[0][0] = asfloat(g_NvidiaExt.IncrementCounter()); + ret[0][1] = asfloat(g_NvidiaExt.IncrementCounter()); + ret[0][2] = asfloat(g_NvidiaExt.IncrementCounter()); + ret[1][0] = asfloat(g_NvidiaExt.IncrementCounter()); + ret[1][1] = asfloat(g_NvidiaExt.IncrementCounter()); + ret[1][2] = asfloat(g_NvidiaExt.IncrementCounter()); + ret[2][0] = asfloat(g_NvidiaExt.IncrementCounter()); + ret[2][1] = asfloat(g_NvidiaExt.IncrementCounter()); + ret[2][2] = asfloat(g_NvidiaExt.IncrementCounter()); + return ret; +} + +float3x2 NvRtMicroTriangleBarycentrics() +{ + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].opcode = NV_EXTN_OP_RT_MICRO_TRIANGLE_BARYCENTRICS; + + float3x2 ret; + ret[0][0] = asfloat(g_NvidiaExt.IncrementCounter()); + ret[0][1] = asfloat(g_NvidiaExt.IncrementCounter()); + ret[1][0] = asfloat(g_NvidiaExt.IncrementCounter()); + ret[1][1] = asfloat(g_NvidiaExt.IncrementCounter()); + ret[2][0] = asfloat(g_NvidiaExt.IncrementCounter()); + ret[2][1] = asfloat(g_NvidiaExt.IncrementCounter()); + return ret; +} + +bool NvRtIsMicroTriangleHit() +{ + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].opcode = NV_EXTN_OP_RT_IS_MICRO_TRIANGLE_HIT; + uint ret = g_NvidiaExt.IncrementCounter(); + return ret != 0; +} + +bool NvRtIsBackFacing() +{ + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].opcode = NV_EXTN_OP_RT_IS_BACK_FACING; + uint ret = g_NvidiaExt.IncrementCounter(); + return ret != 0; +} + +#if __SHADER_TARGET_MAJOR > 6 || (__SHADER_TARGET_MAJOR == 6 && __SHADER_TARGET_MINOR >= 5) + +float3 NvRtMicroVertexObjectPosition(RaytracingAccelerationStructure AccelerationStructure, uint InstanceIndex, uint GeometryIndex, uint PrimitiveIndex, uint2 UV) +{ + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].opcode = NV_EXTN_OP_RT_MICRO_VERTEX_OBJECT_POSITION; + g_NvidiaExt[index].src0u.x = InstanceIndex; + g_NvidiaExt[index].src0u.y = GeometryIndex; + g_NvidiaExt[index].src0u.z = PrimitiveIndex; + g_NvidiaExt[index].src0u.w = UV.x; + g_NvidiaExt[index].src1u.x = UV.y; + uint handle = g_NvidiaExt.IncrementCounter(); + float3 ret; + ret.x = asfloat(g_NvidiaExt.IncrementCounter()); + ret.y = asfloat(g_NvidiaExt.IncrementCounter()); + ret.z = asfloat(g_NvidiaExt.IncrementCounter()); + + RayQuery<0> rq; + rq.TraceRayInline(AccelerationStructure, 0, handle, (RayDesc)0); + + return ret; +} + +float2 NvRtMicroVertexBarycentrics(RaytracingAccelerationStructure AccelerationStructure, uint InstanceIndex, uint GeometryIndex, uint PrimitiveIndex, uint2 UV) +{ + uint index = g_NvidiaExt.IncrementCounter(); + g_NvidiaExt[index].opcode = NV_EXTN_OP_RT_MICRO_VERTEX_BARYCENTRICS; + g_NvidiaExt[index].src0u.x = InstanceIndex; + g_NvidiaExt[index].src0u.y = GeometryIndex; + g_NvidiaExt[index].src0u.z = PrimitiveIndex; + g_NvidiaExt[index].src0u.w = UV.x; + g_NvidiaExt[index].src1u.x = UV.y; + uint handle = g_NvidiaExt.IncrementCounter(); + float2 ret; + ret.x = asfloat(g_NvidiaExt.IncrementCounter()); + ret.y = asfloat(g_NvidiaExt.IncrementCounter()); + + RayQuery<0> rq; + rq.TraceRayInline(AccelerationStructure, 0, handle, (RayDesc)0); + + return ret; +} + +#endif + //----------------------------------------------------------------------------// //------------------------- DXR HitObject Extension --------------------------// //----------------------------------------------------------------------------// diff --git a/vendor/nvapi/nvShaderExtnEnums.h b/vendor/nvapi/nvShaderExtnEnums.h index cfa918b3e7..0913884176 100644 --- a/vendor/nvapi/nvShaderExtnEnums.h +++ b/vendor/nvapi/nvShaderExtnEnums.h @@ -114,6 +114,15 @@ #define NV_EXTN_OP_HIT_OBJECT_IS_NOP 84 #define NV_EXTN_OP_HIT_OBJECT_MAKE_NOP 85 +// Micro-map API +#define NV_EXTN_OP_RT_TRIANGLE_OBJECT_POSITIONS 86 +#define NV_EXTN_OP_RT_MICRO_TRIANGLE_OBJECT_POSITIONS 87 +#define NV_EXTN_OP_RT_MICRO_TRIANGLE_BARYCENTRICS 88 +#define NV_EXTN_OP_RT_IS_MICRO_TRIANGLE_HIT 89 +#define NV_EXTN_OP_RT_IS_BACK_FACING 90 +#define NV_EXTN_OP_RT_MICRO_VERTEX_OBJECT_POSITION 91 +#define NV_EXTN_OP_RT_MICRO_VERTEX_BARYCENTRICS 92 + //----------------------------------------------------------------------------// //-------------------- GET_SPECIAL subOpCode constants -----------------------// //----------------------------------------------------------------------------// diff --git a/vendor/nvapi/nvapi.h b/vendor/nvapi/nvapi.h index 9b4733b1b7..846ca2f636 100644 --- a/vendor/nvapi/nvapi.h +++ b/vendor/nvapi/nvapi.h @@ -41,7 +41,7 @@ /////////////////////////////////////////////////////////////////////////////// // -// Date: Apr 4, 2023 +// Date: Feb 1, 2024 // File: nvapi.h // // NvAPI provides an interface to NVIDIA devices. This file contains the @@ -338,6 +338,23 @@ typedef NV_EDID_V3 NV_EDID; //! \ingroup gpu NVAPI_INTERFACE NvAPI_GPU_GetEDID(NvPhysicalGpuHandle hPhysicalGpu, NvU32 displayOutputId, NV_EDID *pEDID); +//! \ingroup gpu + +//! Used in NvAPI_DISP_GetEdidData + +#define NV_EDID_DATA_SIZE_MAX 1024 //!< This is the current size supported by Nvidia Display Driver and may change in future. + +typedef enum +{ + NV_EDID_FLAG_DEFAULT = 0, //!< the EDID which is actively used by the driver, it could be _RAW/_COOKED/_FORCED/_INF. + NV_EDID_FLAG_RAW = 1, //!< the EDID which is not modified by the driver. If there's no _FORCED edid engaged, it + //!< will be the unmodified monitor EDID from the I2C bus. Otherwise it is original _FORCED edid. + NV_EDID_FLAG_COOKED = 2, //!< the EDID has been modified by the driver for compatibility + NV_EDID_FLAG_FORCED = 3, //!< the EDID is forced by the end-user over s/w interface, + NV_EDID_FLAG_INF = 4, //!< the EDID is from monitor INF + NV_EDID_FLAG_HW = 5, //!< the EDID is from the monitor over I2C bus without any modification. +} NV_EDID_FLAG; + //! \ingroup gpu //! Used in NV_GPU_CONNECTOR_DATA typedef enum _NV_GPU_CONNECTOR_TYPE @@ -4218,6 +4235,329 @@ typedef NV_LICENSABLE_FEATURES_V4 NV_LICENSABLE_FEATURES; NVAPI_INTERFACE NvAPI_GPU_GetLicensableFeatures(__in NvPhysicalGpuHandle hPhysicalGpu, __inout NV_LICENSABLE_FEATURES *pLicensableFeatures); +#define NVAPI_NVLINK_COUNTER_MAX_TYPES 32 +#define NVAPI_NVLINK_MAX_LINKS 32 + +//! \ingroup nvlink +//! @{ +//! Used in NvAPI_GPU_NVLINK_GetCaps() + +/* caps format is byte_index:bit_mask */ +#define NVAPI_NVLINK_CAPS_SUPPORTED 0x00000001 //!< Set if NVLink is present and supported on this GPU.This field is used for *global* caps only and NOT for per-link caps +#define NVAPI_NVLINK_CAPS_P2P_SUPPORTED 0x00000002 //!< Set if P2P over NVLink is supported on this GPU. +#define NVAPI_NVLINK_CAPS_SYSMEM_ACCESS 0x00000004 //!< Set if sysmem can be accessed over NVLink on this GPU. +#define NVAPI_NVLINK_CAPS_P2P_ATOMICS 0x00000008 //!< Set if P2P atomics are supported over NVLink on this GPU. +#define NVAPI_NVLINK_CAPS_SYSMEM_ATOMICS 0x00000010 //!< Set if sysmem atomic transcations are supported over NVLink on this GPU. +#define NVAPI_NVLINK_CAPS_PEX_TUNNELING 0x00000020 //!< Set if PEX tunneling over NVLink is supported on this GPU. +#define NVAPI_NVLINK_CAPS_SLI_BRIDGE 0x00000040 //!< Set if SLI over NVLink is supported on this GPU. +#define NVAPI_NVLINK_CAPS_SLI_BRIDGE_SENSABLE 0x00000080 //!< This bit is set if capable of sensing SLI bridges. +#define NVAPI_NVLINK_CAPS_POWER_STATE_L0 0x00000100 //!< This bit is set if L0 is a supported power state on this GPU. +#define NVAPI_NVLINK_CAPS_POWER_STATE_L1 0x00000200 //!< This bit is set if L1 is a supported power state on this GPU. +#define NVAPI_NVLINK_CAPS_POWER_STATE_L2 0x00000400 //!< This bit is set if L2 is a supported power state on this GPU. +#define NVAPI_NVLINK_CAPS_POWER_STATE_L3 0x00000800 //!< This bit is set if L3 is a supported power state on this GPU. + +#define NVAPI_NVLINK_CAPS_VALID 0x00001000 //!< Set if this link is supported on this GPU.This field is used for *per-link* caps only and NOT for global caps. + +#define NVAPI_NVLINK_CAPS_NVLINK_VERSION_INVALID (0x00000000) +#define NVAPI_NVLINK_CAPS_NVLINK_VERSION_1_0 (0x00000001) +#define NVAPI_NVLINK_CAPS_NVLINK_VERSION_2_0 (0x00000002) + +#define NVAPI_NVLINK_CAPS_NCI_VERSION_INVALID (0x00000000) +#define NVAPI_NVLINK_CAPS_NCI_VERSION_1_0 (0x00000001) +#define NVAPI_NVLINK_CAPS_NCI_VERSION_2_0 (0x00000002) + +typedef struct +{ + NvU32 version; //!< Version of this structure. Must always be first element in this structure. + NvU32 capsTbl; //!< This is bit field for getting different global caps.The individual bitfields are specified by NVAPI_NVLINK_CAPS_* + NvU8 lowestNvlinkVersion; //!< This field specifies the lowest supported NVLink version for this GPU. + NvU8 highestNvlinkVersion; //!< This field specifies the highest supported NVLink version for this GPU. + NvU8 lowestNciVersion; //!< This field specifies the lowest supported NCI version for this GPU. + NvU8 highestNciVersion; //!< This field specifies the highest supported NCI version for this GPU. + NvU32 linkMask; //!< This field provides a bitfield mask of NVLink links enabled on this GPU. +}NVLINK_GET_CAPS_V1; + +typedef NVLINK_GET_CAPS_V1 NVLINK_GET_CAPS; +#define NVLINK_GET_CAPS_VER1 MAKE_NVAPI_VERSION(NVLINK_GET_CAPS_V1, 1) + +#define NVLINK_GET_CAPS_VER NVLINK_GET_CAPS_VER1 +//! @} +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_NVLINK_GetCaps +// +//! DESCRIPTION: This function returns the NVLink capabilities supported by the GPU. +//! SUPPORTED OS: Windows 7 and higher +//! +//! +//! \since Release: 361 +//! +//! \param [in] hPhysicalGpu GPU selection +//! +//! \param [in,out] NVLINK_GET_CAPS This structure contains the output parameters. +//! Also need to specify the version. +//! +//! \retval ::NVAPI_INVALID_USER_PRIVILEGE - The caller does not have administrative privileges +//! +//! \return This API can return any of the error codes enumerated in +//! #NvAPI_Status. If there are return error codes with specific +//! meaning for this API, they are listed below. +//! +//! \ingroup nvlink +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_NVLINK_GetCaps(__in NvPhysicalGpuHandle hPhysicalGpu, __inout NVLINK_GET_CAPS *capsParams); + + +//! \ingroup nvlink +//! @{ +//! Used in NvAPI_GPU_NVLINK_GetStatus() + +#define NVAPI_NVLINK_DEVICE_INFO_DEVICE_ID_FLAGS_NONE (0x00000000) +#define NVAPI_NVLINK_DEVICE_INFO_DEVICE_ID_FLAGS_PCI (0x00000001) +#define NVAPI_NVLINK_DEVICE_INFO_DEVICE_ID_FLAGS_UUID (0x00000002) + +typedef enum _NVAPI_NVLINK_DEVICE_INFO_DEVICE_TYPE +{ + NVAPI_NVLINK_DEVICE_INFO_DEVICE_TYPE_EBRIDGE, + NVAPI_NVLINK_DEVICE_INFO_DEVICE_TYPE_NPU, + NVAPI_NVLINK_DEVICE_INFO_DEVICE_TYPE_GPU, + NVAPI_NVLINK_DEVICE_INFO_DEVICE_TYPE_SWITCH, + NVAPI_NVLINK_DEVICE_INFO_DEVICE_TYPE_TEGRA, + NVAPI_NVLINK_DEVICE_INFO_DEVICE_TYPE_NONE, + NVAPI_NVLINK_DEVICE_INFO_DEVICE_UUID_INVALID, +} NVAPI_NVLINK_DEVICE_INFO_DEVICE_TYPE; + +typedef struct +{ + NvU32 deviceIdFlags; //!< ID Flags, Bitmask that specifies which IDs are valid for the GPU. Refer NVAPI_NVLINK_DEVICE_INFO_DEVICE_ID_FLAGS_* for possible values. + //!< If NVAPI_NVLINK_DEVICE_INFO_DEVICE_ID_FLAGS_PCI is set, PCI information is valid. + //!< If NVAPI_NVLINK_DEVICE_INFO_DEVICE_ID_FLAGS_UUID is set, UUID is valid. + NvU16 domain; //!< domain, bus, device, function, pciDeviceId : PCI information for the GPU. + NvU16 bus; + NvU16 device; + NvU16 function; + NvU32 pciDeviceId; + NvU64 deviceType; //!< GPU Type. See NVAPI_NVLINK_DEVICE_INFO_DEVICE_TYPE_* for possible values. + NvU8 deviceUUID[16]; //!< GPU UUID +}NVLINK_DEVICE_INFO_V1; + +typedef enum _NVAPI_NVLINK_STATUS_LINK_STATE +{ + NVAPI_NVLINK_STATUS_LINK_STATE_UNKNOWN, + NVAPI_NVLINK_STATUS_LINK_STATE_INIT, + NVAPI_NVLINK_STATUS_LINK_STATE_HWCFG, + NVAPI_NVLINK_STATUS_LINK_STATE_SWCFG, + NVAPI_NVLINK_STATUS_LINK_STATE_ACTIVE, + NVAPI_NVLINK_STATUS_LINK_STATE_FAULT, + NVAPI_NVLINK_STATUS_LINK_STATE_RECOVERY, + NVAPI_NVLINK_STATUS_LINK_STATE_RECOVERY_AC, + NVAPI_NVLINK_STATUS_LINK_STATE_RECOVERY_AX, + NVAPI_NVLINK_STATUS_LINK_STATE_INVALID = 0xFFFFFFFF, +}NVAPI_NVLINK_STATUS_LINK_STATE; + +typedef enum _NVAPI_NVLINK_STATUS_SUBLINK_RX_STATE +{ + NVAPI_NVLINK_STATUS_SUBLINK_RX_STATE_UNKNOWN, + NVAPI_NVLINK_STATUS_SUBLINK_RX_STATE_HIGH_SPEED_1, + NVAPI_NVLINK_STATUS_SUBLINK_RX_STATE_LOW_POWER, + NVAPI_NVLINK_STATUS_SUBLINK_RX_STATE_TRAINING, + NVAPI_NVLINK_STATUS_SUBLINK_RX_STATE_SAFE_MODE, + NVAPI_NVLINK_STATUS_SUBLINK_RX_STATE_OFF, + NVAPI_NVLINK_STATUS_SUBLINK_RX_STATE_TEST, + NVAPI_NVLINK_STATUS_SUBLINK_RX_STATE_FAULT, + NVAPI_NVLINK_STATUS_SUBLINK_RX_STATE_INVALID = 0xFF, +}NVAPI_NVLINK_STATUS_SUBLINK_RX_STATE; + +typedef enum _NVAPI_NVLINK_STATUS_SUBLINK_TX_STATE +{ + NVAPI_NVLINK_STATUS_SUBLINK_TX_STATE_UNKNOWN, + NVAPI_NVLINK_STATUS_SUBLINK_TX_STATE_HIGH_SPEED_1, + NVAPI_NVLINK_STATUS_SUBLINK_TX_STATE_LOW_POWER, + NVAPI_NVLINK_STATUS_SUBLINK_TX_STATE_TRAINING, + NVAPI_NVLINK_STATUS_SUBLINK_TX_STATE_SAFE_MODE, + NVAPI_NVLINK_STATUS_SUBLINK_TX_STATE_OFF, + NVAPI_NVLINK_STATUS_SUBLINK_TX_STATE_TEST, + NVAPI_NVLINK_STATUS_SUBLINK_TX_STATE_FAULT, + + NVAPI_NVLINK_STATUS_SUBLINK_TX_STATE_INVALID= 0xFF, +} NVAPI_NVLINK_STATUS_SUBLINK_TX_STATE; + + +#define NVAPI_NVLINK_STATUS_PHY_NVHS (0x00000001) +#define NVAPI_NVLINK_STATUS_PHY_GRS (0x00000002) +#define NVAPI_NVLINK_STATUS_PHY_INVALID (0x000000FF) + +#define NVAPI_NVLINK_STATUS_NVLINK_VERSION_1_0 (0x00000001) +#define NVAPI_NVLINK_STATUS_NVLINK_VERSION_2_0 (0x00000002) +#define NVAPI_NVLINK_STATUS_NVLINK_VERSION_INVALID (0x000000FF) + +#define NVAPI_NVLINK_STATUS_NCI_VERSION_1_0 (0x00000001) +#define NVAPI_NVLINK_STATUS_NCI_VERSION_2_0 (0x00000002) +#define NVAPI_NVLINK_STATUS_NCI_VERSION_INVALID (0x000000FF) + +#define NVAPI_NVLINK_STATUS_NVHS_VERSION_1_0 (0x00000001) +#define NVAPI_NVLINK_STATUS_NVHS_VERSION_INVALID (0x000000FF) + +#define NVAPI_NVLINK_STATUS_GRS_VERSION_1_0 (0x00000001) +#define NVAPI_NVLINK_STATUS_GRS_VERSION_INVALID (0x000000FF) + +#define NVAPI_NVLINK_STATUS_CONNECTED_TRUE (0x00000001) +#define NVAPI_NVLINK_STATUS_CONNECTED_FALSE (0x00000000) + +#define NVAPI_NVLINK_STATUS_LOOP_PROPERTY_LOOPBACK (0x00000001) +#define NVAPI_NVLINK_STATUS_LOOP_PROPERTY_LOOPOUT (0x00000002) +#define NVAPI_NVLINK_STATUS_LOOP_PROPERTY_NONE (0x00000000) + +#define NVAPI_NVLINK_STATUS_REMOTE_LINK_NUMBER_INVALID (0x000000FF) + +#define NVAPI_NVLINK_REFCLK_TYPE_INVALID (0x00) +#define NVAPI_NVLINK_REFCLK_TYPE_NVHS (0x01) +#define NVAPI_NVLINK_REFCLK_TYPE_PEX (0x02) + + +typedef struct +{ + NvU32 capsTbl; //!< This is bit field for getting different global caps.The individual bitfields are specified by NVAPI_NVLINK_CAPS_*. + NvU8 phyType; //!< This field specifies the type of PHY (NVHS or GRS) being used for this link. + NvU8 subLinkWidth; //!< This field specifies the no. of lanes per sublink. + NvU32 linkState; //!< This field specifies the current state of the link.See NVAPI_NVLINK_GET_NVLINK_STATUS_LINK_STATE_* for possible values. + NvU8 rxSublinkStatus; //!< This field specifies the current state of RX sublink.See NVAPI_NVLINK_GET_NVLINK_STATUS_SUBLINK_RX_STATE_* for possible values. + NvU8 txSublinkStatus; //!< This field specifies the current state of TX sublink.See NVAPI_NVLINK_GET_NVLINK_STATUS_SUBLINK_TX_STATE_* for possible values. + NvU8 nvlinkVersion; //!< This field specifies the NVLink version supported by the link. + NvU8 nciVersion; //!< This field specifies the NCI version supported by the link. + NvU8 phyVersion; //!< This field specifies the version of PHY being used by the link. + NvU32 nvlinkCommonClockSpeedMhz; //!< This field gives the value of nvlink common clock in MHz. + NvU32 nvlinkRefClkSpeedMhz; //!< This field gives the value of nvlink refclk clock in MHz. + NvU8 nvlinkRefClkType; //!< This field specifies whether refclk is taken from NVHS reflck or PEX refclk for the current GPU.See NVAPI_NVLINK_REFCLK_TYPE_INVALID* for possible values. + NvU32 nvlinkLinkClockMhz; //!< This field gives the actual clock/speed at which links is running in MHz. + NvU32 connected:1 ; //!< This field specifies if any device is connected on the other end of the link. + NvU32 reserved:31; //!< Reserved for future use. + NvU8 loopProperty; //!< This field specifies if the link is a loopback/loopout link. See NVAPI_NVLINK_STATUS_LOOP_PROPERTY_* for possible values. + NvU8 remoteDeviceLinkNumber; //!< This field specifies the link number on the remote end of the link. + NVLINK_DEVICE_INFO_V1 remoteDeviceInfo; //!< This field stores the GPU information for the remote end of the link +}NVLINK_LINK_STATUS_INFO_V1; + +typedef struct +{ + NvU32 capsTbl; //!< This is bit field for getting different global caps.The individual bitfields are specified by NVAPI_NVLINK_CAPS_*. + NvU8 phyType; //!< This field specifies the type of PHY (NVHS or GRS) being used for this link. + NvU8 subLinkWidth; //!< This field specifies the no. of lanes per sublink. + NvU32 linkState; //!< This field specifies the current state of the link.See NVAPI_NVLINK_GET_NVLINK_STATUS_LINK_STATE_* for possible values. + NvU8 rxSublinkStatus; //!< This field specifies the current state of RX sublink.See NVAPI_NVLINK_GET_NVLINK_STATUS_SUBLINK_RX_STATE_* for possible values. + NvU8 txSublinkStatus; //!< This field specifies the current state of TX sublink.See NVAPI_NVLINK_GET_NVLINK_STATUS_SUBLINK_TX_STATE_* for possible values. + NvU8 nvlinkVersion; //!< This field specifies the NVLink version supported by the link. + NvU8 nciVersion; //!< This field specifies the NCI version supported by the link. + NvU8 phyVersion; //!< This field specifies the version of PHY being used by the link. + NvU32 nvlinkCommonClockSpeedMhz; //!< This field gives the value of nvlink common clock in MHz. + NvU32 nvlinkRefClkSpeedMhz; //!< This field gives the value of nvlink refclk clock in MHz. + NvU8 nvlinkRefClkType; //!< This field specifies whether refclk is taken from NVHS reflck or PEX refclk for the current GPU.See NVAPI_NVLINK_REFCLK_TYPE_INVALID* for possible values. + NvU32 nvlinkLinkClockMhz; //!< This field gives the actual clock/speed at which links is running in MHz. + NvU32 connected:1 ; //!< This field specifies if any device is connected on the other end of the link. + NvU32 reserved:31; //!< Reserved for future use. + NvU8 loopProperty; //!< This field specifies if the link is a loopback/loopout link. See NVAPI_NVLINK_STATUS_LOOP_PROPERTY_* for possible values. + NvU8 remoteDeviceLinkNumber; //!< This field specifies the link number on the remote end of the link. + NVLINK_DEVICE_INFO_V1 remoteDeviceInfo; //!< This field stores the device information for the remote end of the link + NvU8 localDeviceLinkNumber; //!< This field specifies the link number on the local end of the link. + NVLINK_DEVICE_INFO_V1 localDeviceInfo; //!< This field stores the device information for the local end of the link. + NvU32 nvlinkLineRateMbps; //!< Bit rate at which bits toggle on wires in megabits per second. + NvU32 reservedEx[8]; //!< Reserved for future use to avoid versioning. +}NVLINK_LINK_STATUS_INFO_V2; + +typedef struct +{ + NvU32 version; //!< Version of this structure. Must always be first element in this structure. + NvU32 linkMask; //!< This parameter specifies for which links we want the status. + NVLINK_LINK_STATUS_INFO_V1 linkInfo[NVAPI_NVLINK_MAX_LINKS]; //!< This structure stores the per-link status of different NVLink parameters. The link is identified by the index. +}NVLINK_GET_STATUS_V1; + +typedef struct +{ + NvU32 version; //!< Version of this structure. Must always be first element in this structure. + NvU32 linkMask; //!< This parameter specifies for which links we want the status. + NVLINK_LINK_STATUS_INFO_V2 linkInfo[NVAPI_NVLINK_MAX_LINKS]; //!< This structure stores the per-link status of different NVLink parameters. The link is identified by the index. +}NVLINK_GET_STATUS_V2; + + +typedef NVLINK_GET_STATUS_V2 NVLINK_GET_STATUS; +#define NVLINK_GET_STATUS_VER1 MAKE_NVAPI_VERSION(NVLINK_GET_STATUS_V1, 1) +#define NVLINK_GET_STATUS_VER2 MAKE_NVAPI_VERSION(NVLINK_GET_STATUS_V2, 2) + +#define NVLINK_GET_STATUS_VER NVLINK_GET_STATUS_VER2 +//! @} +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_NVLINK_GetStatus +// +//! DESCRIPTION: This function returns the NVLink status. +//! SUPPORTED OS: Windows 7 and higher +//! +//! +//! \since Release: 361 +//! +//! \param [in] hPhysicalGpu GPU selection +//! +//! \param [in,out] NVLINK_GET_STATUS This structure contains the input and output parameters. +//! linkMask is the input param while others are output parameters. +//! Also need to specify the version. +//! +//! \retval ::NVAPI_INVALID_USER_PRIVILEGE - The caller does not have administrative privileges +//! +//! \return This API can return any of the error codes enumerated in +//! #NvAPI_Status. If there are return error codes with specific +//! meaning for this API, they are listed below. +//! +//! \ingroup nvlink +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_NVLINK_GetStatus(__in NvPhysicalGpuHandle hPhysicalGpu, __inout NVLINK_GET_STATUS* statusParams); + + +typedef struct _NV_GPU_INFO_V1 +{ + NvU32 version; //!< Structure Version. + NvU32 bIsExternalGpu:1; //!< This flag is set for external GPU. + NvU32 reserved:31; //!< Reserved for future use +} NV_GPU_INFO_V1; + +typedef struct _NV_GPU_INFO_V2 +{ + NvU32 version; //!< Structure Version. + NvU32 bIsExternalGpu:1; //!< This flag is set for external GPU. + NvU32 reserved0:31; //!< Reserved for future use + NvU64 reserved1; //!< Reserved for future use + NvU32 rayTracingCores; //!< Number of "Ray Tracing Cores" supported by the GPU. + NvU32 tensorCores; //!< Number of "Tensor Cores" supported by the GPU. + NvU32 reserved2[14]; //!< Reserved for future use. +} NV_GPU_INFO_V2; + +#define NV_GPU_INFO_VER1 MAKE_NVAPI_VERSION(NV_GPU_INFO_V1, 1) +#define NV_GPU_INFO_VER2 MAKE_NVAPI_VERSION(NV_GPU_INFO_V2, 2) +#define NV_GPU_INFO_VER NV_GPU_INFO_VER2 +typedef NV_GPU_INFO_V2 NV_GPU_INFO; + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetGPUInfo +// +//! DESCRIPTION: This API will return NVIDIA GPU related information. +//! +//! SUPPORTED OS: Windows 7 and higher +//! +//! +//! TCC_SUPPORTED +//! +//! \since Release: 400 +//! +//! \param [in,out] pGpuInfo - This structure will be filled with required information. +//! +//! \return This API can return any of the error codes enumerated in +//! #NvAPI_Status. If there are return error codes with specific +//! meaning for this API, they are listed below. +//! +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_GetGPUInfo(__in NvPhysicalGpuHandle hPhysicalGpu, __inout NV_GPU_INFO *pGpuInfo); + + typedef struct _NV_GPU_VR_READY_V1 { @@ -4253,6 +4593,53 @@ typedef NV_GPU_VR_READY_V1 NV_GPU_VR_READY; /////////////////////////////////////////////////////////////////////////////// NVAPI_INTERFACE NvAPI_GPU_GetVRReadyData(__in NvPhysicalGpuHandle hPhysicalGpu, __inout NV_GPU_VR_READY *pGpuVrReadyData); + +//! \ingroup gpu +#define NVAPI_GPU_MAX_BUILD_VERSION_LENGTH (0x0000040) + +//! \ingroup gpu +//! Used in NvAPI_GPU_GetGspFeatures(). +typedef struct _NV_GPU_GSP_INFO_V1 +{ + NvU32 version; //!< [in] Structure version + NvU8 firmwareVersion[NVAPI_GPU_MAX_BUILD_VERSION_LENGTH]; //!< [out] Contains GSP firmware version + NvU32 reserved; //!< Reserved for future use +} NV_GPU_GSP_INFO_V1; + +//! \ingroup gpu +//! Macro for constructing the version field of NV_GPU_GSP_INFO_V1 +#define NV_GPU_GSP_INFO_VER1 MAKE_NVAPI_VERSION(NV_GPU_GSP_INFO_V1, 1) +#define NV_GPU_GSP_INFO_VER NV_GPU_GSP_INFO_VER1 +typedef NV_GPU_GSP_INFO_V1 NV_GPU_GSP_INFO; + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_GPU_GetGspFeatures +// +//! DESCRIPTION: If the device has GSP running, this function populates firmwareVersion field +//! with GSP firmware version and returns NVAPI_OK +//! Otherwise returns NVAPI_NOT_SUPPORTED +//! +//! SUPPORTED OS: Windows 10 and higher +//! +//! +//! TCC_SUPPORTED +//! +//! \since Release: 550 +//! +//! \param [in] hPhysicalGpu GPU selection +//! \param [out] pGspInfo GSP firmware version +//! +//! \retval NVAPI_INVALID_ARGUMENT pMemoryInfo is NULL +//! \retval NVAPI_OK call successful +//! \retval NVAPI_API_NOT_INTIALIZED nvapi not initialized +//! \retval NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE hPhysicalGpu was not a physical GPU handle +//! \retval NVAPI_INCOMPATIBLE_STRUCT_VERSION NV_GPU_GSP_INFO structure version mismatch +//! \retval NVAPI_NOT_SUPPORTED GSP is not running/supported on this device +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_GPU_GetGspFeatures(__in NvPhysicalGpuHandle hPhysicalGpu, __inout NV_GPU_GSP_INFO *pGspInfo); + //! Used in NvAPI_GPU_GetPerfDecreaseInfo. //! Bit masks for knowing the exact reason for performance decrease typedef enum _NVAPI_GPU_PERF_DECREASE @@ -4378,8 +4765,7 @@ typedef NV_GPU_PERF_PSTATES_INFO_V2 NV_GPU_PERF_PSTATES_INFO; // // FUNCTION NAME: NvAPI_GPU_GetPstatesInfoEx // -//! DESCRIPTION: This API retrieves all performance states (P-States) information. This is the same as -//! NvAPI_GPU_GetPstatesInfo(), but supports an input flag for various options. +//! DESCRIPTION: This API retrieves all performance states (P-States) information. //! //! P-States are GPU active/executing performance capability and power consumption states. //! @@ -8188,6 +8574,65 @@ NVAPI_INTERFACE NvAPI_DISP_SetDisplayConfig(__in NvU32 pathInfoCount, __in_ecoun +//! \ingroup dispcontrol +//! @{ +typedef struct _NV_EDID_DATA_V1 +{ + NvU32 version; //!< Structure version. + NvU8 *pEDID; //!< Pointer to EDID data. + NvU32 sizeOfEDID; //!< Size of EDID data. +} NV_EDID_DATA_V1; + +typedef struct _NV_EDID_DATA_V2 +{ + NvU32 version; //!< Structure version. + NvU8 *pEDID; //!< Pointer to EDID data. + NvU32 sizeOfEDID; //!< Size of EDID data. + NvU32 reserved[8]; //!< Reserved for future use. +} NV_EDID_DATA_V2; + +typedef NV_EDID_DATA_V2 NV_EDID_DATA; +#define NV_EDID_DATA_VER1 MAKE_NVAPI_VERSION(NV_EDID_DATA_V1, 1) +#define NV_EDID_DATA_VER2 MAKE_NVAPI_VERSION(NV_EDID_DATA_V2, 2) + +#define NV_EDID_DATA_VER NV_EDID_DATA_VER2 +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_DISP_GetEdidData +// +//! \code +//! DESCRIPTION: This API returns the EDID data for the specified display Id. +//! (NvAPI_GPU_GetConnectedDisplayIds() can be used to get the DisplayIds). +//! +//! USAGE: The caller has to call this API two times to fetch the required details as follows: +//! First Pass : Caller should call NvAPI_DISP_GetEdidData() with pEdidParams->pEDID set to NULL, +//! to get the size of the EDID buffer in pEdidParams->sizeOfEDID. +//! Second Pass: Allocate memory for the EDID buffer of the size - pEdidParams->sizeOfEDID, +//! and call the API again to get the EDID buffer populated. +//! +//! +//! \param [in] displayId - NVIDIA Display ID +//! \param [inout] pEdidParams - Pointer to the structure that contains - pointer to EDID buffer and its size +//! \param [inout] pFlag - The type of EDID to be retrieved (IN). +//! To only retrieve the EDID type, the user should send pEdidParams->pEDID as NULL and +//! pEdidParams->sizeOfEDID as 0. +//! +//! SUPPORTED OS: Windows 7 and higher +//! +//! +//! \since Release: 400 +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. +//! If there are return error codes with specific meaning for this API, they are listed below. +//! NVAPI_INSUFFICIENT_BUFFER: Reallocate buffer with pEdidParams->sizeOfEDID and call again to get complete data. +//! In this case pEdidParams->pEDID contains undefined data. +//! This error occurs only when pEdidParams->pEDID is present. +//! \endcode +//! \ingroup dispcontrol +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DISP_GetEdidData(__in NvU32 displayId, __inout NV_EDID_DATA *pEdidParams, __inout NV_EDID_FLAG *pFlag); +//! @} + typedef struct _NV_GET_ADAPTIVE_SYNC_DATA_V1 { NvU32 version ; //!< [in] structure version @@ -8518,6 +8963,89 @@ NVAPI_INTERFACE NvAPI_DISP_AcquireDedicatedDisplay(__in NvU32 displayId, __inout NVAPI_INTERFACE NvAPI_DISP_ReleaseDedicatedDisplay(__in NvU32 displayId); #endif // defined(__cplusplus) +//! SUPPORTED OS: Windows 11 and higher +//! +#if defined(__cplusplus) + +typedef struct _NV_MANAGED_DEDICATED_DISPLAY_METADATA +{ + NvU32 version; //!< [in] Version of this structure. + NvU32 displayId; //!< [in] DisplayId to identify the display connector the metadata operation is requested for. + NvU32 bSetPosition : 1; //!< [in] Set call: 1 in case the information in variables/fields "positionX" and "positionY" should be stored as metadata. 0 otherwise. + NvU32 bRemovePosition : 1; //!< [in] Set call: 1 in case the stored positionX and positionY metadata should be set to 'not defined', N/A. 0 otherwise. + NvU32 bPositionIsAvailable : 1; //!< [out] Query call: 1 in case the information in variables/fields "positionX" and "positionY" is valid (has been set before). 0 otherwise. + NvU32 bSetName : 1; //!< [in] Set call: 1 in case the information in variable/field "name" should be stored as metadata. 0 otherwise. + NvU32 bRemoveName : 1; //!< [in] Set call: 1 in case the stored name metadata should be set to 'not defined',N/A. 0 otherwise. + NvU32 bNameIsAvailable : 1; //!< [out] Query call: 1 in case the information in variable/field "name" is valid (has been set before). 0 otherwise. + NvU32 reserved : 26; //!< [in][out] Reserved for future use without adding versioning. + NvS32 positionX; //!< [in][out] Metadata for the virtual horizontal position for the display connector specified by displayId. + NvS32 positionY; //!< [in][out] Metadata for the virtual vertical position for the display connector specified by displayId. + NvAPI_ShortString name; //!< [in][out] Metadata for the virtual name of for the display connector specified by displayId. + //!< Valid characters are in the range of 32 ' ' (space) to 126 '~' (both included). +} NV_MANAGED_DEDICATED_DISPLAY_METADATA_V1; + +#define NV_MANAGED_DEDICATED_DISPLAY_METADATA_VER1 MAKE_NVAPI_VERSION(NV_MANAGED_DEDICATED_DISPLAY_METADATA_V1,1) +#define NV_MANAGED_DEDICATED_DISPLAY_METADATA_VER NV_MANAGED_DEDICATED_DISPLAY_METADATA_VER1 + +typedef NV_MANAGED_DEDICATED_DISPLAY_METADATA_V1 NV_MANAGED_DEDICATED_DISPLAY_METADATA; + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_DISP_GetNvManagedDedicatedDisplayMetadata +// +//! DESCRIPTION: This API returns metadata which has been set for the display connector in question. +//! Main use case would be to query the data for an Nvidia managed dedicated display. +//! The function will work for any valid displayId though. +//! +//! \since Release: 550 +//! +//! \param [in/out] pDedicatedDisplayMetadata Data structure containing input and output data. +//! +//! \retval ::NVAPI_OK The call succeeded. +//! \retval ::NVAPI_ERROR The call failed. +//! \retval ::NVAPI_NO_IMPLEMENTATION The API is not implemented in current driver. +//! \retval ::NVAPI_NOT_SUPPORTED The API is not supported on the current operating system or gpu. +//! \retval ::NVAPI_OUT_OF_MEMORY There wasn't sufficient memory to complete the call. +//! \retval ::NVAPI_INVALID_POINTER An invalid pointer was passed as an argument. +//! \retval ::NVAPI_API_NOT_INITIALIZED NvAPI was not initialized. +//! \retval ::NVAPI_INCOMPATIBLE_STRUCT_VERSION The version of the NV_MANAGED_DEDICATED_DISPLAY_METADATA structure is invalid. +//! +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DISP_GetNvManagedDedicatedDisplayMetadata(__inout NV_MANAGED_DEDICATED_DISPLAY_METADATA* pDedicatedDisplayMetadata); +#endif // defined(__cplusplus) + +//! SUPPORTED OS: Windows 11 and higher +//! +#if defined(__cplusplus) +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_DISP_SetNvManagedDedicatedDisplayMetadata +// +//! DESCRIPTION: This API allows to set metadata for the display connector in question. +//! Main use case would be to set the data for an Nvidia managed dedicated display. +//! The function will work for any valid displayId though. +//! +//! \since Release: 550 +//! +//! \param [in/out] pDedicatedDisplayMetadata Data structure containing input and output data. +//! +//! \retval ::NVAPI_OK The call succeeded. +//! \retval ::NVAPI_ERROR The call failed. +//! \retval ::NVAPI_NO_IMPLEMENTATION The API is not implemented in current driver. +//! \retval ::NVAPI_NOT_SUPPORTED The API is not supported on the current operating system or gpu. +//! \retval ::NVAPI_OUT_OF_MEMORY There wasn't sufficient memory to complete the call. +//! \retval ::NVAPI_INVALID_POINTER An invalid pointer was passed as an argument. +//! \retval ::NVAPI_API_NOT_INITIALIZED NvAPI was not initialized. +//! \retval ::NVAPI_INCOMPATIBLE_STRUCT_VERSION The version of the NV_MANAGED_DEDICATED_DISPLAY_METADATA structure is invalid. +//! \retval ::NVAPI_INVALID_USER_PRIVILEGE The caller doesn't have the required administrator privileges to access this API. +//! \retval ::NVAPI_INVALID_ARGUMENT Characters in pDedicatedDisplayMetadata->name are out of the allowed range. +//! +//! \ingroup gpu +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_DISP_SetNvManagedDedicatedDisplayMetadata(__inout NV_MANAGED_DEDICATED_DISPLAY_METADATA* pDedicatedDisplayMetadata); +#endif // defined(__cplusplus) + #if defined (_WINNT_) @@ -9885,6 +10413,8 @@ NVAPI_INTERFACE NvAPI_GSync_GetTopology(__in NvGSyncDeviceHandle hNvGSyncDevice, //! \retval ::NVAPI_INVALID_SYNC_TOPOLOGY 1.If any mosaic grid is partial. //! 2.If timing(HVisible/VVisible/refreshRate) applied of any display is different. //! 3.If There is a across GPU mosaic grid in system and that is not a part of pGsyncDisplays. +//! \retval ::NVAPI_INVALID_USER_PRIVILEGE The application will require Administrator privileges to access this API. +//! The application can be elevated to a higher permission level by selecting "Run as Administrator". //! //! \ingroup gsyncapi /////////////////////////////////////////////////////////////////////////////// @@ -10022,7 +10552,8 @@ NVAPI_INTERFACE NvAPI_GSync_GetControlParameters(__in NvGSyncDeviceHandle hNvGSy //! If there are return error codes with specific meaning for this API, they are listed below. //! \retval ::NVAPI_INVALID_ARGUMENT hNvGSyncDevice is NULL. //! \retval ::NVAPI_NVIDIA_DEVICE_NOT_FOUND The queried Graphics system does not have any Sync Device. -//! \retval ::NVAPI_SYNC_MASTER_NOT_FOUND Control Parameters can only be set if there is a Sync Master enabled on the Gsync card. +//! \retval ::NVAPI_INVALID_USER_PRIVILEGE The application will require Administrator privileges to access this API. +//! The application can be elevated to a higher permission level by selecting "Run as Administrator". //! //! \ingroup gsyncapi /////////////////////////////////////////////////////////////////////////////// @@ -15681,6 +16212,35 @@ NVAPI_INTERFACE NvAPI_D3D_ImplicitSLIControl(__in IMPLICIT_SLI_CONTROL implicitS #endif //defined (__cplusplus) && ( defined(_D3D9_H_) || defined(__d3d10_h__) || defined(__d3d10_1_h__) ||defined(__d3d11_h__) ) + +#if defined (__cplusplus) && defined(__d3d12_h__) +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D12_GetNeedsAppFPBlendClamping +// +//! \code +//! DESCRIPTION: This function returns whether the application needs to do FP blend clamping itself +//! +//! \param [in] pDevice Current d3d device +//! \param [out] pAppClampNeeded If true, app needs to clamp. If false, HW does the clamping +//! +//! \return This API can return any of the error codes enumerated in +//! #NvAPI_Status. If there are return error codes with specific +//! meaning for this API, they are listed below. +//! +//! \since Release: 375 +//! +//! SUPPORTED OS: Windows 10 +//! +//! \endcode +//! \ingroup dx +/////////////////////////////////////////////////////////////////////////////// + +NVAPI_INTERFACE NvAPI_D3D12_GetNeedsAppFPBlendClamping(__in ID3D12Device *pDevice, + __out bool *pAppClampNeeded); + +#endif //defined(__cplusplus) && defined(__d3d12_h__) + //! SUPPORTED OS: Windows 10 //! @@ -17074,7 +17634,8 @@ typedef NV_GET_SLEEP_STATUS_PARAMS_V1 NV_GET_SLEEP_STATUS_PARAMS; //! Note that it may not always reflect the previously requested sleep mode, //! as the feature may not be available on the platform, or the setting has //! been overridden by the control panel, for example. -//! bFsVrr indicates fullscreen GSYNC or GSYNC Compatible mode. +//! bFsVrr indicates fullscreen GSYNC or GSYNC Compatible mode. It is valid +//! only when the application is in the foreground. //! bCplVsyncOn indicates Control Panel VSYNC ON override. //! //! \since Release: 455 @@ -17412,6 +17973,26 @@ NVAPI_INTERFACE NvAPI_D3D12_NotifyOutOfBandCommandQueue(__in ID3D12CommandQueue #endif //defined(__cplusplus) && defined(__d3d12_h__)) +#if defined(__cplusplus) && defined(__d3d12_h__) +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D12_SetCreateCommandQueueLowLatencyHint +// +//! DESCRIPTION: Reserved call. +//! +//! \since Release: 530 +//! \param [in] pDevice The creating device +//! SUPPORTED OS: Windows 10 and higher +//! +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. +//! If there are return error codes with specific meaning for this API, they are listed below. +//! +//! \ingroup dx +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_D3D12_SetCreateCommandQueueLowLatencyHint(__in ID3D12Device *pDevice); +#endif //defined(__cplusplus) && defined(__d3d12_h__)) + #if defined (__cplusplus) && defined(__d3d12_h__) // Experimental API for internal use. DO NOT USE! @@ -17537,6 +18118,28 @@ NVAPI_INTERFACE NvAPI_D3D12_LaunchCuKernelChain(__in ID3D12GraphicsCommandList* __in const NVAPI_CU_KERNEL_LAUNCH_PARAMS* pKernels, __in NvU32 numKernels); +// Experimental API for internal use. DO NOT USE! +//! SUPPORTED OS: Windows 10 and higher +//! + +typedef struct _NVAPI_CU_KERNEL_LAUNCH_PARAMS_EX +{ + NVDX_ObjectHandle hFunction; + NVAPI_DIM3 gridDim; + NVAPI_DIM3 blockDim; + NvU32 dynSharedMemBytes; + + // either pParams/paramsSize is used or kernelParams is used + void const * pParams; + NvU32 paramSize; + void **kernelParams; +} NVAPI_CU_KERNEL_LAUNCH_PARAMS_EX; + +NVAPI_INTERFACE NvAPI_D3D12_LaunchCuKernelChainEx(__in ID3D12GraphicsCommandList* pCommandList, + __in const NVAPI_CU_KERNEL_LAUNCH_PARAMS_EX* pKernels, + __in NvU32 numKernels); + + // Experimental API for internal use. DO NOT USE! //! SUPPORTED OS: Windows 10 and higher //! @@ -17682,6 +18285,17 @@ typedef enum _NVAPI_D3D12_RAYTRACING_OPACITY_MICROMAP_CAPS NVAPI_D3D12_RAYTRACING_OPACITY_MICROMAP_CAP_STANDARD = NV_BIT(0) //!< Standard Opacity Micromap support is available } NVAPI_D3D12_RAYTRACING_OPACITY_MICROMAP_CAPS; +//! Flags specifying raytracing Displacement Micromap support. +//! Additional flags will be added as support becomes available. +//! +//! \ingroup dx +typedef enum _NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_CAPS +{ + NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_CAP_NONE = 0x0, //!< Displacement Micromap support is not available. + //!< The application must not attempt to use any DMM entrypoints or flags. + NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_CAP_STANDARD = NV_BIT(0) //!< Standard Displacement Micromap support is available +} NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_CAPS; + //! List of Raytracing CAPS types that can be queried. //! //! \ingroup dx @@ -17689,6 +18303,7 @@ typedef enum _NVAPI_D3D12_RAYTRACING_CAPS_TYPE { NVAPI_D3D12_RAYTRACING_CAPS_TYPE_THREAD_REORDERING = 0, NVAPI_D3D12_RAYTRACING_CAPS_TYPE_OPACITY_MICROMAP = 1, + NVAPI_D3D12_RAYTRACING_CAPS_TYPE_DISPLACEMENT_MICROMAP = 2, NVAPI_D3D12_RAYTRACING_CAPS_TYPE_INVALID = -1 } NVAPI_D3D12_RAYTRACING_CAPS_TYPE; @@ -17724,6 +18339,283 @@ NVAPI_INTERFACE NvAPI_D3D12_GetRaytracingCaps( __in size_t dataSize); #endif // defined(__cplusplus) && defined(__d3d12_h__) +#if defined(__cplusplus) && defined(__d3d12_h__) && defined(__ID3D12Device5_INTERFACE_DEFINED__) && defined(__ID3D12GraphicsCommandList4_INTERFACE_DEFINED__) + +//! Flags specifying validation behaviour for raytracing operations. +//! \ingroup dx +//! See NvAPI_D3D12_EnableRaytracingValidation +typedef enum _NVAPI_D3D12_RAYTRACING_VALIDATION_FLAGS +{ + NVAPI_D3D12_RAYTRACING_VALIDATION_FLAG_NONE = 0x0, //!< No validation flags. +} NVAPI_D3D12_RAYTRACING_VALIDATION_FLAGS; + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D12_EnableRaytracingValidation +// +//! DESCRIPTION: Enable raytracing validation for a device. +//! This function must be called before any other raytracing-related function +//! is invoked on the device. Raytracing validation can only be enabled when +//! the NV_ALLOW_RAYTRACING_VALIDATION envvar is set to 1. +//! +//! SUPPORTED OS: Windows 10 and higher +//! +//! +//! \since Release: 545 +//! +//! \param [in] pDevice Pointer to the device on which raytracing validation should be enabled. +//! \param [in] flags Raytracing validation flags. +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. +//! If there are return error codes with specific meaning for this API, they are listed below. +//! +//! \retval ::NVAPI_OK Completed request +//! \retval ::NVAPI_INVALID_POINTER A null pointer was passed as device argument +//! \retval ::NVAPI_INVALID_ARGUMENT An unsupported flag was specified +//! \retval ::NVAPI_INVALID_CALL The call was made too late (other raytracing-related calls have already been made) +//! \retval ::NVAPI_ACCESS_DENIED Validation is not allowed by envvar +//! \ingroup dx +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_D3D12_EnableRaytracingValidation( + __in ID3D12Device5* pDevice, + __in NVAPI_D3D12_RAYTRACING_VALIDATION_FLAGS flags); + + + +//! Severity classification of validation messages. +//! \ingroup dx +//! See NVAPI_D3D12_RAYTRACING_VALIDATION_MESSAGE_CALLBACK +typedef enum _NVAPI_D3D12_RAYTRACING_VALIDATION_MESSAGE_SEVERITY +{ + NVAPI_D3D12_RAYTRACING_VALIDATION_MESSAGE_SEVERITY_ERROR = 0x0, //!< Error message (indicates likely bug) + NVAPI_D3D12_RAYTRACING_VALIDATION_MESSAGE_SEVERITY_WARNING = 0x1 //!< Warning message (indicates inadvisable usage or possible bug) +} NVAPI_D3D12_RAYTRACING_VALIDATION_MESSAGE_SEVERITY; + +//! Callback for raytracing validation messages. +//! \param [in] pUserData User data pointer as provided to callback registration. +//! \param [in] severity Severity of message. +//! \param [in] messageCode Type of reported validation message. +//! \param [in] message Human-readable description of what the message code means. +//! \param [in] messageDetails Additional human-readable context for validation message. May contain newlines. +//! \ingroup dx +//! See NvAPI_D3D12_RegisterRaytracingValidationMessageCallback +typedef void(__stdcall *NVAPI_D3D12_RAYTRACING_VALIDATION_MESSAGE_CALLBACK)(void* pUserData, NVAPI_D3D12_RAYTRACING_VALIDATION_MESSAGE_SEVERITY severity, const char* messageCode, const char* message, const char* messageDetails); + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D12_RegisterRaytracingValidationMessageCallback +// +//! DESCRIPTION: Register a message callback for raytracing validation messages. +//! The provided callback may be invoked by the driver using any thread at any time until the callback is unregistered. +//! It is invalid to register/unregister callbacks from within the callback. +//! It is invalid to create or destroy objects for the device or record commands onto command lists from within the callback. +//! +//! SUPPORTED OS: Windows 10 and higher +//! +//! +//! \since Release: 545 +//! +//! \param [in] pDevice Pointer to the device from which to obtain raytracing validation messages. +//! \param [in] pfnMessageCallback Callback used to report validation messages. +//! \param [in] pUserData [optional] User data to pass as argument to message callback. +//! \param [out] pHandle Handle that may be used to unregister the callback. +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. +//! If there are return error codes with specific meaning for this API, they are listed below. +//! +//! \retval ::NVAPI_OK Completed request +//! \retval ::NVAPI_INVALID_POINTER A null pointer was passed as an argument +//! \ingroup dx +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_D3D12_RegisterRaytracingValidationMessageCallback( + __in ID3D12Device5* pDevice, + __in NVAPI_D3D12_RAYTRACING_VALIDATION_MESSAGE_CALLBACK pfnMessageCallback, + __in_opt void* pUserData, + __out void** pHandle); + + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D12_UnregisterRaytracingValidationMessageCallback +// +//! DESCRIPTION: Unregister a previously registered message callback for raytracing validation messages. +//! The provided callback will not be invoked once the unregister call has returned. +//! +//! SUPPORTED OS: Windows 10 and higher +//! +//! +//! \since Release: 545 +//! +//! \param [in] pDevice Pointer to the device from which to stop obtaining raytracing validation messages. +//! \param [in] handle Handle to which callback should be unregistered, obtained at registration. +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. +//! If there are return error codes with specific meaning for this API, they are listed below. +//! +//! \retval ::NVAPI_OK Completed request +//! \retval ::NVAPI_INVALID_POINTER A null pointer was passed as device argument +//! \retval ::NVAPI_INVALID_ARGUMENT Callback handle not recognized +//! \ingroup dx +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_D3D12_UnregisterRaytracingValidationMessageCallback( + __in ID3D12Device5* pDevice, + __in void* handle); + + + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D12_FlushRaytracingValidationMessages +// +//! DESCRIPTION: Flush any validation messages that have not yet been reported. +//! This guarantees that any validation messages for work which is known to be complete on the GPU +//! at the time of the call are reported to registered callbacks. +//! This operation is lightweight if the flushed device does not have raytracing validation enabled. +//! +//! SUPPORTED OS: Windows 10 and higher +//! +//! +//! \since Release: 545 +//! +//! \param [in] pDevice Pointer to the device on which raytracing validation messages should be flushed. +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. +//! If there are return error codes with specific meaning for this API, they are listed below. +//! +//! \retval ::NVAPI_OK Completed request +//! \retval ::NVAPI_INVALID_POINTER A null pointer was passed as device argument +//! \ingroup dx +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_D3D12_FlushRaytracingValidationMessages( + __in ID3D12Device5* pDevice); + +#endif // defined(__cplusplus) && defined(__d3d12_h__) && defined(__ID3D12Device5_INTERFACE_DEFINED__) && defined(__ID3D12GraphicsCommandList4_INTERFACE_DEFINED__) + +//! SUPPORTED OS: Windows 10 and higher +//! +#if defined(__cplusplus) && defined(__d3d12_h__) && (defined(__ID3D12Device5_INTERFACE_DEFINED__) || defined(__ID3D12GraphicsCommandList4_INTERFACE_DEFINED__)) + +// Types used by both device and command list functions. + +//! Flags specifying building instructions and hints when constructing a DMM Array. +//! +//! \ingroup dx +typedef enum _NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_BUILD_FLAGS +{ + NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_BUILD_FLAG_NONE = 0x0, //!< No options specified for the DMM Array build. + NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_BUILD_FLAG_PREFER_FAST_TRACE = NV_BIT(0), //!< Allow the DMM Array build to take a little longer in order to optimize for traversal performance. + //!< This flag is incompatible with #NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_BUILD_FLAG_PREFER_FAST_BUILD. + NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_BUILD_FLAG_PREFER_FAST_BUILD = NV_BIT(1) //!< Spend as little time as possible on the DMM Array build with some potential loss to traversal performance. + //!< This flag is incompatible with #NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_BUILD_FLAG_PREFER_FAST_TRACE. +} NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_BUILD_FLAGS; + +//! Specifies the input Displacement Micromap formats. +//! The DC1 (Displacement Compression 1) format follows the space-filling curve in barycentric space over the uniformly tessellated micro-triangles. +//! +//! \note This is a 16-bit value when used in #NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_DESC +//! +//! \ingroup dx +typedef enum _NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_FORMAT +{ + NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_FORMAT_DC1_64_TRIS_64_BYTES = 0x1, //!< 64 micro-triangles packed into 64 bytes + NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_FORMAT_DC1_256_TRIS_128_BYTES = 0x2, //!< 256 micro-triangles packed into 128 bytes + NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_FORMAT_DC1_1024_TRIS_128_BYTES = 0x3, //!< 1024 micro-triangles packed into 128 bytes + +} NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_FORMAT; + +//! Number of DMMs of a specific configuration in a DMM Array or BLAS build. +//! Used to compute conservative buffer size estimates for DMM Array and BLAS builds. +//! +//! \ingroup dx +typedef struct _NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_USAGE_COUNT +{ + NvU32 count; //!< For DMM Array builds: total number of DMMs in the DMM Array with the particular \p subdivisionLevel and \p format specified in this descriptor. + //!< For BLAS builds: total number of DMMs with the \p subdivisionLevel and \p format combination that is referenced from the BLAS. + NvU32 subdivisionLevel; //!< Number of subdivisions for the DMM; valid inputs are [0, 5] (#NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_DC1_MAX_SUBDIVISION_LEVEL). + //!< The total number of micro-triangles is 4subdivisionLevel. + NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_FORMAT format; //!< Displacement Micromap format. +} NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_USAGE_COUNT; + +//! Describes one Displacement Micromap. +//! +//! \ingroup dx +typedef struct _NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_DESC +{ + NvU32 byteOffset; //!< Byte offset from the \c inputBuffer, specified in the input structure #NVAPI_D3D12_BUILD_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_INPUTS, to where the input DMM data is located. + NvU16 subdivisionLevel; //!< Number of subdivisions for the DMM; valid inputs are [0, 5] (#NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_DC1_MAX_SUBDIVISION_LEVEL). + //!< The total number of micro-triangles is 4subdivisionLevel. + NvU16 format; //!< Format of the DMM of type #NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_FORMAT. +} NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_DESC; + +//! Input structure to DMM Array construction. +//! Individual DMMs are accessed via indices when used in bottom-level acceleration structure (BLAS) construction. +//! +//! \ingroup dx +typedef struct _NVAPI_D3D12_BUILD_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_INPUTS +{ + NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_BUILD_FLAGS flags; //!< Flags which apply to all DMMs in the array. + NvU32 numDMMUsageCounts; //!< Number of DMM usage count entries in the \p pDMMUsageCounts array. + const NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_USAGE_COUNT* pDMMUsageCounts; //!< Usage counts for each subdivision level and format combination across all the DMM entries in the build. + D3D12_GPU_VIRTUAL_ADDRESS inputBuffer; //!< Address for raw DMM input data; it must be 256-byte aligned (#NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_BYTE_ALIGNMENT) + //!< It is recommended to try to organize DMMs together in memory that are expected to be used close together spatially. + D3D12_GPU_VIRTUAL_ADDRESS_AND_STRIDE perDMMDescs; //!< GPU array with one #NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_DESC entry per DMM. +} NVAPI_D3D12_BUILD_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_INPUTS; + +#endif // defined(__cplusplus) && defined(__d3d12_h__) && (defined(__ID3D12Device5_INTERFACE_DEFINED__) || defined(__ID3D12GraphicsCommandList4_INTERFACE_DEFINED__)) + +#if defined(__cplusplus) && defined(__d3d12_h__) && defined(__ID3D12Device5_INTERFACE_DEFINED__) + +//! Conservative memory requirements for building a DMM Array. +//! +//! \ingroup dx +typedef struct _NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PREBUILD_INFO +{ + NvU64 resultDataMaxSizeInBytes; //!< Size required to hold the result of a DMM Array build based on the specified inputs. + NvU64 scratchDataSizeInBytes; //!< Scratch storage on GPU required during DMM Array build based on the specified inputs. +} NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PREBUILD_INFO; + +//! Parameters given to NvAPI_D3D12_GetRaytracingDisplacementMicromapArrayPrebuildInfo(). +//! +//! \ingroup dx +typedef struct _NVAPI_GET_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PREBUILD_INFO_PARAMS_V1 +{ + NvU32 version; //!< [in] Structure version; it should be set to #NVAPI_GET_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PREBUILD_INFO_PARAMS_VER. + const NVAPI_D3D12_BUILD_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_INPUTS* pDesc; //!< [in] Description of the DMM Array build. + NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PREBUILD_INFO* pInfo; //!< [out] Result of the query. +} NVAPI_GET_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PREBUILD_INFO_PARAMS_V1; +#define NVAPI_GET_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PREBUILD_INFO_PARAMS_VER1 MAKE_NVAPI_VERSION(NVAPI_GET_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PREBUILD_INFO_PARAMS_V1, 1) +typedef NVAPI_GET_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PREBUILD_INFO_PARAMS_V1 NVAPI_GET_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PREBUILD_INFO_PARAMS; +#define NVAPI_GET_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PREBUILD_INFO_PARAMS_VER NVAPI_GET_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PREBUILD_INFO_PARAMS_VER1 + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D12_GetRaytracingDisplacementMicromapArrayPrebuildInfo +// +//! DESCRIPTION: Query conservative memory requirements for building a DMM (Displacement Micromap) Array. +//! The returned size is conservative for DMM Array builds containing +//! a lower or equal number of entries for each resolution and format combination. +//! +//! +//! SUPPORTED OS: Windows 10 and higher +//! +//! +//! \since Release: 525 +//! +//! \param [in] pDevice Device on which the DMM Array will be built. +//! \param [in,out] pParams Wrapper around the inputs and outputs of the function. +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. +//! If there are return error codes with specific meaning for this API, they are listed below. +//! +//! \ingroup dx +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_D3D12_GetRaytracingDisplacementMicromapArrayPrebuildInfo( + __in ID3D12Device5* pDevice, + __inout NVAPI_GET_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PREBUILD_INFO_PARAMS* pParams); + +#endif // defined(__cplusplus) && defined(__d3d12_h__) && defined(__ID3D12Device5_INTERFACE_DEFINED__) + //! SUPPORTED OS: Windows 10 and higher //! #if defined(__cplusplus) && defined(__d3d12_h__) && (defined(__ID3D12Device5_INTERFACE_DEFINED__) || defined(__ID3D12GraphicsCommandList4_INTERFACE_DEFINED__)) @@ -17856,6 +18748,9 @@ typedef enum _NVAPI_D3D12_PIPELINE_CREATION_STATE_FLAGS NVAPI_D3D12_PIPELINE_CREATION_STATE_FLAGS_ENABLE_OMM_SUPPORT = NV_BIT(0), //!< [in] Change whether raytracing pipelines are created with support for Opacity Micromaps. //!< If a triangle with an OMM is encountered during traversal and the pipeline was not created with support for them, behavior is undefined. //!< Support should only be enabled if there are OMMs present, since it may incur a small penalty on traversal performance overall. + NVAPI_D3D12_PIPELINE_CREATION_STATE_FLAGS_ENABLE_DMM_SUPPORT = NV_BIT(1), //!< [in] Change whether raytracing pipelines are created with support for Displacement Micromaps. + //!< If a triangle with a DMM is encountered during traversal and the pipeline was not created with support for them, behavior is undefined. + //!< Support should only be enabled if there are DMMs present, since it may incur a small penalty on traversal performance overall. } NVAPI_D3D12_PIPELINE_CREATION_STATE_FLAGS; //! State used when creating new pipelines. @@ -17914,6 +18809,8 @@ typedef enum _NVAPI_D3D12_SERIALIZED_DATA_TYPE_EX // NVAPI_D3D12_SERIALIZED_DATA_TYPE_EX specific flags NVAPI_D3D12_SERIALIZED_DATA_RAYTRACING_OPACITY_MICROMAP_ARRAY_EX = 0x1, //!< Data blob contains an OMM Array. //!< Starting from offset 0, the first bytes of the OMM Array can be reinterpreted as \c D3D12_SERIALIZED_DATA_DRIVER_MATCHING_IDENTIFIER. + NVAPI_D3D12_SERIALIZED_DATA_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_EX = 0x2, //!< Data blob contains a DMM Array. + //!< Starting from offset 0, the first bytes of the DMM Array can be reinterpreted as \c D3D12_SERIALIZED_DATA_DRIVER_MATCHING_IDENTIFIER. } NVAPI_D3D12_SERIALIZED_DATA_TYPE_EX; @@ -17982,6 +18879,7 @@ typedef enum _NVAPI_D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAGS_EX //!< Specifying this build flag may result in some reductions in traversal performance. NVAPI_D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAG_ALLOW_OMM_OPACITY_STATES_UPDATE_EX = NV_BIT(8), //!< The acceleration structure (AS) supports updating OMM data (encoded opacity values). //!< Specifying this flag may reduce traversal performance. + NVAPI_D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAG_ALLOW_DATA_ACCESS_EX = NV_BIT(9), //!< Allows triangle and micro-triangle data to be accessed through the BLAS via shader intrinsics. } NVAPI_D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BUILD_FLAGS_EX; @@ -17998,7 +18896,8 @@ typedef enum _NVAPI_D3D12_RAYTRACING_GEOMETRY_TYPE_EX // NVAPI_D3D12_RAYTRACING_GEOMETRY_TYPE_EX specific flags NVAPI_D3D12_RAYTRACING_GEOMETRY_TYPE_OMM_TRIANGLES_EX = 0x2, //!< Shares most fields with the basic triangle geometry type, but allows an OMM Array to be attached to the geometry. //!< The basic triangle type and this OMM-enabled type geometries may be mixed in the same BLAS build. - + NVAPI_D3D12_RAYTRACING_GEOMETRY_TYPE_DMM_TRIANGLES_EX = 0x3, //!< Triangle geometry with attached DMM data. + //!< This geometry cannot be mixed with other geometry types in the same BLAS. } NVAPI_D3D12_RAYTRACING_GEOMETRY_TYPE_EX; @@ -18032,6 +18931,53 @@ typedef struct _NVAPI_D3D12_RAYTRACING_GEOMETRY_OMM_ATTACHMENT_DESC } NVAPI_D3D12_RAYTRACING_GEOMETRY_OMM_ATTACHMENT_DESC; +//! The edge vA..vB is decimated: after subdivision the number of micro-triangles on that edge is halved. +//! (i.e. the neighboring primitive can have a lower subdivision level without introducing cracks) +//! +//! \ingroup dx +typedef enum _NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_PRIMITIVE_FLAGS +{ + NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_PRIMITIVE_FLAG_DECIMATE_01 = NV_BIT(0), + NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_PRIMITIVE_FLAG_DECIMATE_12 = NV_BIT(1), + NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_PRIMITIVE_FLAG_DECIMATE_20 = NV_BIT(2), + +} NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_PRIMITIVE_FLAGS; + +//! Geometry descriptor attachment with Displacement Micromaps. +//! +//! \ingroup dx +typedef struct _NVAPI_D3D12_RAYTRACING_GEOMETRY_DMM_ATTACHMENT_DESC +{ + D3D12_GPU_VIRTUAL_ADDRESS_AND_STRIDE triangleMicromapIndexBuffer; //!< Optional buffer specifying which DMM index to use for each triangle; if \c NULL, there is a 1:1 mapping between input triangles and DMM Array entries. + //!< For BLAS updates, this input buffer must match that of the original build. + DXGI_FORMAT triangleMicromapIndexFormat; //!< Format of \c displacementMicromapIndexBuffer, either \c DXGI_FORMAT_R32_UINT or \c DXGI_FORMAT_R16_UINT. + NvU32 triangleMicromapBaseLocation; //!< Constant added to all DMM indices in \p displacementMicromapIndexBuffer. + + D3D12_GPU_VIRTUAL_ADDRESS_AND_STRIDE trianglePrimitiveFlagsBuffer; //!< Optional, per-triangle UINT8 mode flags (#NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_PRIMITIVE_FLAGS) + + D3D12_GPU_VIRTUAL_ADDRESS_AND_STRIDE vertexBiasAndScaleBuffer; //!< Optional displacement base vertex bias and displacement vector scale buffer. If not supplied, bias defaults to 0 and scale to 1. + DXGI_FORMAT vertexBiasAndScaleFormat; //!< Format of \c displacementBiasAndScaleBuffer. Supported formats are \c DXGI_FORMAT_R16G16_FLOAT and \c DXGI_FORMAT_R32G32_FLOAT + + D3D12_GPU_VIRTUAL_ADDRESS_AND_STRIDE vertexDisplacementVectorBuffer; //!< Per-vertex displacement vector buffer. This buffer is indexed using the index buffer from the base triangle geometry. + DXGI_FORMAT vertexDisplacementVectorFormat; //!< Format of \c displacementVectorBuffer. Supported formats are \c DXGI_FORMAT_R32G32B32_FLOAT, \c DXGI_FORMAT_R32G32B32A32_FLOAT, and \c DXGI_FORMAT_R16G16B16A16_FLOAT (The Alpha channel is ignored, and stride can be set accordingly). + + D3D12_GPU_VIRTUAL_ADDRESS displacementMicromapArray; //!< Pointer to a DMM Array used by this geometry. + //!< Unlike vertex, index, and transform buffers, this resource is dereferenced during raytracing. + + NvU32 numDMMUsageCounts; //!< Number of DMM usage count entries in the \p pDMMUsageCounts array. + const NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_USAGE_COUNT* pDMMUsageCounts; //!< Usage counts for each subdivision level and format combination across all the DMM entries referred-to by the DMM index buffer specified by this geometry. + +} NVAPI_D3D12_RAYTRACING_GEOMETRY_DMM_ATTACHMENT_DESC; + +//! Geometry triangle descriptor with attached augmented Displacement Micromaps. +//! +//! \ingroup dx +typedef struct _NVAPI_D3D12_RAYTRACING_GEOMETRY_DMM_TRIANGLES_DESC +{ + D3D12_RAYTRACING_GEOMETRY_TRIANGLES_DESC triangles; //!< Triangle mesh descriptor. + NVAPI_D3D12_RAYTRACING_GEOMETRY_DMM_ATTACHMENT_DESC dmmAttachment; //!< Displacement Micromap attachment descriptor. +} NVAPI_D3D12_RAYTRACING_GEOMETRY_DMM_TRIANGLES_DESC; + //! Geometry triangle descriptor with attached augmented Opacity Micromaps. //! //! \ingroup dx @@ -18057,6 +19003,8 @@ typedef struct _NVAPI_D3D12_RAYTRACING_GEOMETRY_DESC_EX //!< Otherwise, this parameter is unused (space repurposed in a union). NVAPI_D3D12_RAYTRACING_GEOMETRY_OMM_TRIANGLES_DESC ommTriangles; //!< Describes triangle geometry which may optionally use Opacity Micromaps, if \c type is #NVAPI_D3D12_RAYTRACING_GEOMETRY_TYPE_OMM_TRIANGLES_EX. //!< Otherwise, this parameter is unused (space repurposed in a union). + NVAPI_D3D12_RAYTRACING_GEOMETRY_DMM_TRIANGLES_DESC dmmTriangles; //!< Describes micro-triangle geometry, if \c type is #NVAPI_D3D12_RAYTRACING_GEOMETRY_TYPE_DMM_TRIANGLES_EX. + //!< Otherwise, this parameter is unused (space repurposed in a union). }; } NVAPI_D3D12_RAYTRACING_GEOMETRY_DESC_EX; @@ -18284,6 +19232,182 @@ NVAPI_INTERFACE NvAPI_D3D12_RelocateRaytracingOpacityMicromapArray( #if defined(__cplusplus) && defined(__d3d12_h__) && defined(__ID3D12GraphicsCommandList4_INTERFACE_DEFINED__) +//! Description of the inputs and memory areas used during the building of DMM Arrays. +//! +//! \ingroup dx +typedef struct _NVAPI_D3D12_BUILD_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_DESC +{ + D3D12_GPU_VIRTUAL_ADDRESS destDisplacementMicromapArrayData; //!< Output location for the DMM Array build. + //!< NvAPI_D3D12_GetRaytracingDisplacementMicromapArrayPrebuildInfo() reports the amount of memory required for the result given a set of input parameters. + //!< The address must be aligned to 256 bytes (#NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_BYTE_ALIGNMENT). + NVAPI_D3D12_BUILD_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_INPUTS inputs; //!< Description of the input data for the DMM Array build. + D3D12_GPU_VIRTUAL_ADDRESS scratchDisplacementMicromapArrayData; //!< Location where the build will store temporary data. + //!< NvAPI_D3D12_GetRaytracingDisplacementMicromapArrayPrebuildInfo() reports the amount of scratch memory the implementation will need for a given set of input parameters. + //!< The address must be aligned to 256 bytes (#NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_BYTE_ALIGNMENT). + //!< Contents of this memory going into a build on the GPU timeline are irrelevant and will not be preserved. + //!< After the build is complete on the GPU timeline, the memory is left with whatever undefined contents the build finished with. + //!< The memory pointed to must be in state \c D3D12_RESOURCE_STATE_UNORDERED_ACCESS. +} NVAPI_D3D12_BUILD_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_DESC; + +//! Structure emitted by NvAPI_D3D12_EmitRaytracingDisplacementMicromapArrayPostbuildInfo(), and optionally NvAPI_D3D12_BuildRaytracingDisplacementMicromapArray(), when \c type equals #NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_CURRENT_SIZE. +//! +//! \ingroup dx +typedef struct _NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_CURRENT_SIZE_DESC +{ + NvU64 currentSizeInBytes; //!< Size of the DMM Array buffer. + //!< The queried size may be smaller than the size reported by NvAPI_D3D12_GetRaytracingDisplacementMicromapArrayPrebuildInfo(). + //!< This allows the application to move and relocate the DMM Array to a smaller buffer to reclaim any unused memory after the DMM Array build is complete. +} NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_CURRENT_SIZE_DESC; + +//! Type of postbuild info to emit after a DMM Array build. +//! +//! \ingroup dx +typedef enum _NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_TYPE +{ + NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_CURRENT_SIZE = 0x0, //!< Size of the current DMM Array. May be smaller than reported by the NvAPI_D3D12_GetRaytracingDisplacementMicromapArrayPrebuildInfo() call. + //!< Unused memory can be reclaimed by copying the DMM Array into a new resource; see #NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_CURRENT_SIZE_DESC. +} NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_TYPE; + +//! Description of the postbuild information to generate from a DMM Array. +//! +//! \ingroup dx +typedef struct _NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_DESC +{ + D3D12_GPU_VIRTUAL_ADDRESS destBuffer; //!< Result storage. + //!< Size required and the layout of the contents written by the system depend on \p infoType. + //!< The memory pointed to must be in state \c D3D12_RESOURCE_STATE_UNORDERED_ACCESS. + //!< The memory must be aligned to the natural alignment for the members of the particular output structure being generated (e.g. 8 bytes for a struct with the largest member being \c NvU64). + NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_TYPE infoType; //!< Type of postbuild information to retrieve. +} NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_DESC; + +//! Parameters given to NvAPI_D3D12_BuildRaytracingDisplacementMicromapArray(). +//! +//! \ingroup dx +typedef struct _NVAPI_BUILD_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PARAMS_V1 +{ + NvU32 version; //!< [in] Structure version; it should be set to #NVAPI_BUILD_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PARAMS_VER. + const NVAPI_D3D12_BUILD_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_DESC* pDesc; //!< [in] Description of the DMM Array build. + NvU32 numPostbuildInfoDescs; //!< [in] Size of postbuild info desc array. Set to 0 if none are needed. + const NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_DESC* pPostbuildInfoDescs; //!< [in] Optional array of descriptions for postbuild info to generate describing properties of the acceleration structure that was built. + //!< [in] Any given postbuild info type, \c D3D12_RAYTRACING_ACCEELRATION_STRUCTURE_POSTBUILD_INFO_TYPE, can only be selected for output by at most one array entry. +} NVAPI_BUILD_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PARAMS_V1; +#define NVAPI_BUILD_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PARAMS_VER1 MAKE_NVAPI_VERSION(NVAPI_BUILD_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PARAMS_V1, 1) +typedef NVAPI_BUILD_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PARAMS_V1 NVAPI_BUILD_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PARAMS; +#define NVAPI_BUILD_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PARAMS_VER NVAPI_BUILD_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PARAMS_VER1 + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D12_BuildRaytracingDisplacementMicromapArray +// +//! DESCRIPTION: Construct DMM Array for a collection of DMMs on the GPU. +//! The CPU-side input buffers are not referenced after this call. +//! The GPU-side input resources are not referenced after the build has concluded after ExecuteCommandList(). +//! Additionally, the application may optionally output postbuild information immediately after the build. +//! +//! SUPPORTED OS: Windows 10 and higher +//! +//! +//! \since Release: 525 +//! +//! \param [in] pCommandList Command list on which the command will execute. +//! \param [in] pParams Wrapper around the inputs of the function. +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. +//! If there are return error codes with specific meaning for this API, they are listed below. +//! +//! \retval NVAPI_INVALID_COMBINATION pParams->pPostbuildInfoDescs was set to \c NULL while pParams->numPostbuildInfoDescs is non zero. +//! +//! \ingroup dx +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_D3D12_BuildRaytracingDisplacementMicromapArray( + __in ID3D12GraphicsCommandList4* pCommandList, + __in NVAPI_BUILD_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PARAMS* pParams); + +#endif // defined(__cplusplus) && defined(__d3d12_h__) && defined(__ID3D12GraphicsCommandList4_INTERFACE_DEFINED__) + +#if defined(__cplusplus) && defined(__d3d12_h__) && defined(__ID3D12GraphicsCommandList4_INTERFACE_DEFINED__) + +//! Parameters given to NvAPI_D3D12_RelocateRaytracingDisplacementMicromapArray(). +//! +//! \ingroup dx +typedef struct _NVAPI_RELOCATE_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PARAMS_V1 +{ + NvU32 version; //!< [in] Structure version; it should be set to #NVAPI_RELOCATE_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PARAMS_VER. + D3D12_GPU_VIRTUAL_ADDRESS displacementMicromapArray; //!< [in] DMM Array current memory address; it must be 256-byte aligned (#NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_BYTE_ALIGNMENT). +} NVAPI_RELOCATE_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PARAMS_V1; +#define NVAPI_RELOCATE_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PARAMS_VER1 MAKE_NVAPI_VERSION(NVAPI_RELOCATE_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PARAMS_V1, 1) +typedef NVAPI_RELOCATE_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PARAMS_V1 NVAPI_RELOCATE_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PARAMS; +#define NVAPI_RELOCATE_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PARAMS_VER NVAPI_RELOCATE_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PARAMS_VER1 + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D12_RelocateRaytracingDisplacementMicromapArray +// +//! DESCRIPTION: Makes the DMM Array usable at its current location in memory. +//! A DMM Array that has been copied to a new location must be relocated using this function before it may be attached to any BLAS. +//! +//! SUPPORTED OS: Windows 10 and higher +//! +//! +//! \since Release: 525 +//! +//! \param [in] pCommandList Command list on which the command will execute. +//! \param [in] pParams Wrapper around the inputs of the function. +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. +//! If there are return error codes with specific meaning for this API, they are listed below. +//! +//! \ingroup dx +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_D3D12_RelocateRaytracingDisplacementMicromapArray( + __in ID3D12GraphicsCommandList4* pCommandList, + __in const NVAPI_RELOCATE_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_PARAMS* pParams); + +#endif // defined(__cplusplus) && defined(__d3d12_h__) && defined(__ID3D12GraphicsCommandList4_INTERFACE_DEFINED__) + +#if defined(__cplusplus) && defined(__d3d12_h__) && defined(__ID3D12GraphicsCommandList4_INTERFACE_DEFINED__) + +//! Parameters given to NvAPI_D3D12_EmitRaytracingDisplacementMicromapArrayPostbuildInfo(). +//! +//! \ingroup dx +typedef struct _NVAPI_EMIT_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_PARAMS_V1 +{ + NvU32 version; //!< [in] Structure version; it should be set to #NVAPI_EMIT_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_PARAMS_VER. + const NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_DESC* pDesc; //!< [in] Description of which postbuild info to emit. + NvU32 numSources; //!< [in] Number of DMM Arrays in \p pSources. + const D3D12_GPU_VIRTUAL_ADDRESS* pSources; //!< [in] List of DMM Arrays for which postbuild info should be emitted. +} NVAPI_EMIT_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_PARAMS_V1; +#define NVAPI_EMIT_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_PARAMS_VER1 MAKE_NVAPI_VERSION(NVAPI_EMIT_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_PARAMS_V1, 1) +typedef NVAPI_EMIT_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_PARAMS_V1 NVAPI_EMIT_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_PARAMS; +#define NVAPI_EMIT_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_PARAMS_VER NVAPI_EMIT_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_PARAMS_VER1 + +/////////////////////////////////////////////////////////////////////////////// +// +// FUNCTION NAME: NvAPI_D3D12_EmitRaytracingDisplacementMicromapArrayPostbuildInfo +// +//! DESCRIPTION: Emits information about one or more DMM Arrays, only available after the DMM Array constructions have finished. +//! +//! SUPPORTED OS: Windows 10 and higher +//! +//! +//! \since Release: 525 +//! +//! \param [in] pCommandList Command list on which the command will execute. +//! \param [in] pParams Wrapper around the inputs of the function. +//! +//! \return This API can return any of the error codes enumerated in #NvAPI_Status. +//! If there are return error codes with specific meaning for this API, they are listed below. +//! +//! \ingroup dx +/////////////////////////////////////////////////////////////////////////////// +NVAPI_INTERFACE NvAPI_D3D12_EmitRaytracingDisplacementMicromapArrayPostbuildInfo( + __in ID3D12GraphicsCommandList4* pCommandList, + __in const NVAPI_EMIT_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_POSTBUILD_INFO_PARAMS* pParams); + +#endif // defined(__cplusplus) && defined(__d3d12_h__) && defined(__ID3D12GraphicsCommandList4_INTERFACE_DEFINED__) + +#if defined(__cplusplus) && defined(__d3d12_h__) && defined(__ID3D12GraphicsCommandList4_INTERFACE_DEFINED__) + //! Parameters given to NvAPI_D3D12_EmitRaytracingOpacityMicromapArrayPostbuildInfo(). //! //! \ingroup dx @@ -18443,6 +19567,16 @@ typedef enum _NVAPI_RAY_FLAGS_EX //!< If an instance is flagged with #NVAPI_D3D12_RAYTRACING_INSTANCE_FLAG_DISABLE_OMMS_EX, that takes precedence over this flag. } NVAPI_RAY_FLAG_EX; +//! Mandatory alignment for the address of a DMM Array. +//! +//! \ingroup dx +#define NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_ARRAY_BYTE_ALIGNMENT 256 + +//! Highest subdivision-level allowed with DC1. +//! +//! \ingroup dx +#define NVAPI_D3D12_RAYTRACING_DISPLACEMENT_MICROMAP_DC1_MAX_SUBDIVISION_LEVEL 5 + #endif // defined(__cplusplus) && defined(__d3d12_h__) && defined(__ID3D12GraphicsCommandList4_INTERFACE_DEFINED__) @@ -18544,6 +19678,7 @@ NVAPI_INTERFACE NvAPI_D3D12_CreateCommittedRDMABuffer( __out void **ppRDMAAddress); #endif //defined(__cplusplus) && defined(__d3d12_h__) + //! SUPPORTED OS: Windows 10 and higher //! #if defined(__cplusplus) && defined(__d3d12_h__) diff --git a/vendor/nvapi/nvapi_lite_common.h b/vendor/nvapi/nvapi_lite_common.h index 21263566c1..c922ffb512 100644 --- a/vendor/nvapi/nvapi_lite_common.h +++ b/vendor/nvapi/nvapi_lite_common.h @@ -70,7 +70,7 @@ typedef signed long NvS32; /* -2147483648 to 2147483647 */ typedef signed int NvS32; /* -2147483648 to 2147483647 */ #endif -#ifndef __unix +#if !(NVOS_IS_UNIX || (defined(__unix))) // mac os 32-bit still needs this #if ( (defined(macintosh) && defined(__LP64__) && (__NVAPI_RESERVED0__)) || \ (!defined(macintosh) && defined(__NVAPI_RESERVED0__)) ) @@ -409,6 +409,7 @@ typedef enum _NvAPI_Status NVAPI_NOT_PERMITTED = -240, //!< Attempted operation is not permitted. NVAPI_CALLBACK_ALREADY_REGISTERED = -241, //!< The callback function has already been registered. NVAPI_CALLBACK_NOT_FOUND = -242, //!< The callback function is not found or not registered. + NVAPI_INVALID_OUTPUT_WIRE_FORMAT = -243, //!< Invalid Wire Format for the VR HMD } NvAPI_Status; /////////////////////////////////////////////////////////////////////////////// @@ -527,10 +528,14 @@ NVAPI_INTERFACE NvAPI_GPU_GetMemoryInfo(NvPhysicalGpuHandle hPhysicalGpu, NV_DIS typedef struct { NvU32 version; //!< Structure version - NvU64 dedicatedVideoMemory; //!< Size(in bytes) of the physical framebuffer. + NvU64 dedicatedVideoMemory; //!< Size(in bytes) of the physical framebuffer. Refers to the dedicated video memory on discrete GPUs. + //! It is more performant for GPU operations than the reserved systemVideoMemory. NvU64 availableDedicatedVideoMemory; //!< Size(in bytes) of the available physical framebuffer for allocating video memory surfaces. - NvU64 systemVideoMemory; //!< Size(in bytes) of system memory the driver allocates at load time. + NvU64 systemVideoMemory; //!< Size(in bytes) of system memory the driver allocates at load time. It is a substitute for dedicated video memory. + //!< Typically used with integrated GPUs that do not have dedicated video memory. NvU64 sharedSystemMemory; //!< Size(in bytes) of shared system memory that driver is allowed to commit for surfaces across all allocations. + //!< On discrete GPUs, it is used to utilize system memory for various operations. It does not need to be reserved during boot. + //!< It may be used by both GPU and CPU, and has an “on-demand” type of usage. NvU64 curAvailableDedicatedVideoMemory; //!< Size(in bytes) of the current available physical framebuffer for allocating video memory surfaces. NvU64 dedicatedVideoMemoryEvictionsSize; //!< Size(in bytes) of the total size of memory released as a result of the evictions. NvU64 dedicatedVideoMemoryEvictionCount; //!< Indicates the number of eviction events that caused an allocation to be removed from dedicated video memory to free GPU diff --git a/vendor/nvapi/nvapi_lite_surround.h b/vendor/nvapi/nvapi_lite_surround.h index e680dd2e77..43b7000886 100644 --- a/vendor/nvapi/nvapi_lite_surround.h +++ b/vendor/nvapi/nvapi_lite_surround.h @@ -60,8 +60,6 @@ extern "C" { /////////////////////////////////////////////////////////////////////////////// NVAPI_INTERFACE NvAPI_DISP_GetGDIPrimaryDisplayId(NvU32* displayId); #define NV_MOSAIC_MAX_DISPLAYS (64) -//! SUPPORTED OS: Windows 7 and higher -//! /////////////////////////////////////////////////////////////////////////////// // // FUNCTION NAME: NvAPI_Mosaic_GetDisplayViewportsByResolution @@ -77,10 +75,10 @@ NVAPI_INTERFACE NvAPI_DISP_GetGDIPrimaryDisplayId(NvU32* displayId); //! \param [in] srcHeight Height of full display topology. If both //! width and height are 0, the current //! resolution is used. -//! \param [out] viewports Array of NV_RECT viewports which represent -//! the displays as identified in -//! NvAPI_Mosaic_EnumGridTopologies. If the -//! requested resolution is a single-wide +//! \param [out] viewports Array of NV_RECT viewports. +//! SUPPORTED OS: Windows 7 and higher +//! +//! If the requested resolution is a single-wide //! resolution, only viewports[0] will //! contain the viewport details, regardless //! of which display is driving the display. diff --git a/vendor/nvapi/x86/nvapi.lib b/vendor/nvapi/x86/nvapi.lib index 6bb2307a02..7e80aa8814 100644 Binary files a/vendor/nvapi/x86/nvapi.lib and b/vendor/nvapi/x86/nvapi.lib differ