| @@ -352,7 +352,8 @@ struct FindFileStruct | |||
| // returns 0 on failure | |||
| void* juce_findFileStart (const String& directory, const String& wildCard, String& firstResultFile, | |||
| bool* isDir, bool* isHidden, int64* fileSize, Time* modTime, Time* creationTime, bool* isReadOnly) throw() | |||
| bool* isDir, bool* isHidden, int64* fileSize, Time* modTime, | |||
| Time* creationTime, bool* isReadOnly) throw() | |||
| { | |||
| DIR* d = opendir (directory.toUTF8()); | |||
| @@ -177,8 +177,6 @@ bool juce_isRunningAsApplication() | |||
| extern Display* display; | |||
| extern XContext improbableNumber; | |||
| const int juce_windowIsSemiTransparentFlag = (1 << 31); // also in component.cpp | |||
| static const int eventMask = NoEventMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | |||
| | EnterWindowMask | LeaveWindowMask | PointerMotionMask | KeymapStateMask | |||
| | ExposureMask | StructureNotifyMask | FocusChangeMask; | |||
| @@ -2052,7 +2050,7 @@ private: | |||
| XSetWMHints (display, wndH, wmHints); | |||
| XFree (wmHints); | |||
| if ((styleFlags & juce_windowIsSemiTransparentFlag) != 0) | |||
| if ((styleFlags & windowIsSemiTransparent) != 0) | |||
| { | |||
| //xxx | |||
| } | |||
| @@ -48,14 +48,16 @@ BEGIN_JUCE_NAMESPACE | |||
| #endif | |||
| //============================================================================== | |||
| #undef log | |||
| #if JUCE_COREAUDIO_LOGGING_ENABLED | |||
| #define log(a) Logger::writeToLog (a) | |||
| #else | |||
| #define log(a) | |||
| #endif | |||
| #undef OK | |||
| #if JUCE_COREAUDIO_ERROR_LOGGING_ENABLED | |||
| static bool logAnyErrors (const OSStatus err, const int lineNum) | |||
| static bool logAnyErrors_CoreAudio (const OSStatus err, const int lineNum) | |||
| { | |||
| if (err == noErr) | |||
| return true; | |||
| @@ -65,7 +67,7 @@ BEGIN_JUCE_NAMESPACE | |||
| return false; | |||
| } | |||
| #define OK(a) logAnyErrors (a, __LINE__) | |||
| #define OK(a) logAnyErrors_CoreAudio (a, __LINE__) | |||
| #else | |||
| #define OK(a) (a == noErr) | |||
| #endif | |||
| @@ -398,8 +400,8 @@ public: | |||
| { | |||
| if (((unsigned int) index) < num) | |||
| { | |||
| OSType id = types[index]; | |||
| AudioDeviceSetProperty (deviceID, 0, 0, input, kAudioDevicePropertyDataSource, sizeof (id), &id); | |||
| OSType typeId = types[index]; | |||
| AudioDeviceSetProperty (deviceID, 0, 0, input, kAudioDevicePropertyDataSource, sizeof (typeId), &typeId); | |||
| } | |||
| juce_free (types); | |||
| @@ -1188,5 +1190,6 @@ AudioIODeviceType* juce_createDefaultAudioIODeviceType() | |||
| return new CoreAudioIODeviceType(); | |||
| } | |||
| #undef log | |||
| END_JUCE_NAMESPACE | |||
| @@ -43,9 +43,10 @@ BEGIN_JUCE_NAMESPACE | |||
| #include "../../../src/juce_core/threads/juce_ScopedLock.h" | |||
| //============================================================================== | |||
| #undef log | |||
| #define log(a) Logger::writeToLog(a) | |||
| static bool logAnyErrors (const OSStatus err, const int lineNum) | |||
| static bool logAnyErrorsMidi (const OSStatus err, const int lineNum) | |||
| { | |||
| if (err == noErr) | |||
| return true; | |||
| @@ -55,7 +56,8 @@ static bool logAnyErrors (const OSStatus err, const int lineNum) | |||
| return false; | |||
| } | |||
| #define OK(a) logAnyErrors(a, __LINE__) | |||
| #undef OK | |||
| #define OK(a) logAnyErrorsMidi(a, __LINE__) | |||
| //============================================================================== | |||
| @@ -141,10 +143,10 @@ static const String getConnectedEndpointName (MIDIEndpointRef endpoint) | |||
| for (int i = 0; i < numConnections; ++i, ++pid) | |||
| { | |||
| MIDIUniqueID id = EndianS32_BtoN (*pid); | |||
| MIDIUniqueID uid = EndianS32_BtoN (*pid); | |||
| MIDIObjectRef connObject; | |||
| MIDIObjectType connObjectType; | |||
| OSStatus err = MIDIObjectFindByUniqueID (id, &connObject, &connObjectType); | |||
| OSStatus err = MIDIObjectFindByUniqueID (uid, &connObject, &connObjectType); | |||
| if (err == noErr) | |||
| { | |||
| @@ -585,4 +587,6 @@ void MidiInput::stop() | |||
| mpe->active = false; | |||
| } | |||
| #undef log | |||
| END_JUCE_NAMESPACE | |||
| @@ -43,7 +43,6 @@ | |||
| BEGIN_JUCE_NAMESPACE | |||
| #include "../../../src/juce_core/io/files/juce_FileInputStream.h" | |||
| #include "../../../src/juce_core/io/files/juce_FileOutputStream.h" | |||
| #include "../../../src/juce_core/io/network/juce_URL.h" | |||
| @@ -634,7 +633,8 @@ struct FindFileStruct | |||
| // returns 0 on failure | |||
| void* juce_findFileStart (const String& directory, const String& wildCard, String& firstResultFile, | |||
| bool* isDir, bool* isHidden, int64* fileSize, Time* modTime, Time* creationTime, bool* isReadOnly) throw() | |||
| bool* isDir, bool* isHidden, int64* fileSize, Time* modTime, | |||
| Time* creationTime, bool* isReadOnly) throw() | |||
| { | |||
| DIR* const d = opendir (directory.toUTF8()); | |||
| @@ -29,9 +29,6 @@ | |||
| ============================================================================== | |||
| */ | |||
| #ifndef __JUCE_MAC_HTTPSTREAM_JUCEHEADER__ | |||
| #define __JUCE_MAC_HTTPSTREAM_JUCEHEADER__ | |||
| // (This file gets included by the mac + linux networking code) | |||
| //============================================================================== | |||
| @@ -42,8 +39,7 @@ class JUCE_HTTPSocketStream | |||
| public: | |||
| //============================================================================== | |||
| JUCE_HTTPSocketStream() | |||
| : statusCode (0), | |||
| readPosition (0), | |||
| : readPosition (0), | |||
| socketHandle (-1), | |||
| levelsOfRedirection (0), | |||
| timeoutSeconds (15) | |||
| @@ -146,9 +142,11 @@ public: | |||
| StringArray lines; | |||
| lines.addLines (responseHeader); | |||
| statusCode = responseHeader.fromFirstOccurrenceOf (T(" "), false, false) | |||
| .substring (0, 3).getIntValue(); | |||
| // NB - using charToString() here instead of just T(" "), because that was | |||
| // causing a mysterious gcc internal compiler error... | |||
| const int statusCode = responseHeader.fromFirstOccurrenceOf (String::charToString (T(' ')), false, false) | |||
| .substring (0, 3) | |||
| .getIntValue(); | |||
| //int contentLength = findHeaderItem (lines, T("Content-Length:")).getIntValue(); | |||
| //bool isChunked = findHeaderItem (lines, T("Transfer-Encoding:")).equalsIgnoreCase ("chunked"); | |||
| @@ -195,7 +193,7 @@ public: | |||
| } | |||
| //============================================================================== | |||
| int statusCode, readPosition; | |||
| int readPosition; | |||
| //============================================================================== | |||
| juce_UseDebuggingNewOperator | |||
| @@ -402,5 +400,3 @@ int juce_seekInInternetFile (void* handle, int newPosition) | |||
| return 0; | |||
| } | |||
| #endif // __JUCE_MAC_HTTPSTREAM_JUCEHEADER__ | |||
| @@ -31,11 +31,11 @@ | |||
| #include "../../../src/juce_core/basics/juce_StandardHeader.h" | |||
| #import <Cocoa/Cocoa.h> | |||
| #import <IOKit/IOKitLib.h> | |||
| #import <IOKit/network/IOEthernetInterface.h> | |||
| #import <IOKit/network/IONetworkInterface.h> | |||
| #import <IOKit/network/IOEthernetController.h> | |||
| #include <Cocoa/Cocoa.h> | |||
| #include <IOKit/IOKitLib.h> | |||
| #include <IOKit/network/IOEthernetInterface.h> | |||
| #include <IOKit/network/IONetworkInterface.h> | |||
| #include <IOKit/network/IOEthernetController.h> | |||
| #include <netdb.h> | |||
| #include <arpa/inet.h> | |||
| @@ -159,8 +159,10 @@ void SystemStats::initialiseStats() throw() | |||
| highResTimerFrequency = (int64) AudioGetHostClockFrequency(); | |||
| #if ! ONLY_INCLUDE_JUCE_CORE_HEADERS | |||
| if (JUCEApplication::getInstance() != 0) | |||
| RegisterAppearanceClient(); | |||
| #endif | |||
| TXNInitTextension (0, 0, kTXNWantMoviesMask | kTXNWantGraphicsMask); | |||
| @@ -31,10 +31,10 @@ | |||
| #include "../../../src/juce_core/basics/juce_StandardHeader.h" | |||
| #import <Cocoa/Cocoa.h> | |||
| #import <WebKit/HIWebView.h> | |||
| #import <WebKit/WebPolicyDelegate.h> | |||
| #import <WebKit/CarbonUtils.h> | |||
| #include <Cocoa/Cocoa.h> | |||
| #include <WebKit/HIWebView.h> | |||
| #include <WebKit/WebPolicyDelegate.h> | |||
| #include <WebKit/CarbonUtils.h> | |||
| BEGIN_JUCE_NAMESPACE | |||
| #include "../../../src/juce_appframework/events/juce_Timer.h" | |||
| @@ -47,7 +47,7 @@ END_JUCE_NAMESPACE | |||
| juce::WebBrowserComponent* ownerComponent; | |||
| } | |||
| - (DownloadClickDetector*) init: (juce::WebBrowserComponent*) ownerComponent; | |||
| - (DownloadClickDetector*) initWithOwner: (juce::WebBrowserComponent*) ownerComponent; | |||
| - (void) webView: (WebView*) webView decidePolicyForNavigationAction: (NSDictionary*) actionInformation | |||
| request: (NSURLRequest*) request | |||
| @@ -58,7 +58,7 @@ END_JUCE_NAMESPACE | |||
| //============================================================================== | |||
| @implementation DownloadClickDetector | |||
| - (DownloadClickDetector*) init: (juce::WebBrowserComponent*) ownerComponent_ | |||
| - (DownloadClickDetector*) initWithOwner: (juce::WebBrowserComponent*) ownerComponent_ | |||
| { | |||
| [super init]; | |||
| ownerComponent = ownerComponent_; | |||
| @@ -83,7 +83,7 @@ BEGIN_JUCE_NAMESPACE | |||
| class WebBrowserComponentInternal : public Timer | |||
| { | |||
| public: | |||
| WebBrowserComponentInternal (WebBrowserComponent* const owner_) | |||
| WebBrowserComponentInternal (WebBrowserComponent* owner_) | |||
| : owner (owner_), | |||
| view (0), | |||
| webView (0) | |||
| @@ -124,7 +124,7 @@ public: | |||
| webView = HIWebViewGetWebView (view); | |||
| clickListener = [[DownloadClickDetector alloc] init: owner_]; | |||
| clickListener = [[DownloadClickDetector alloc] initWithOwner: owner_]; | |||
| [webView setPolicyDelegate: clickListener]; | |||
| } | |||
| @@ -2547,16 +2547,16 @@ const unsigned int kSpecialNoCursor = 'nocr'; | |||
| void* juce_createStandardMouseCursor (MouseCursor::StandardCursorType type) throw() | |||
| { | |||
| ThemeCursor id = kThemeArrowCursor; | |||
| ThemeCursor cursorId = kThemeArrowCursor; | |||
| switch (type) | |||
| { | |||
| case MouseCursor::NormalCursor: | |||
| id = kThemeArrowCursor; | |||
| cursorId = kThemeArrowCursor; | |||
| break; | |||
| case MouseCursor::NoCursor: | |||
| id = kSpecialNoCursor; | |||
| cursorId = kSpecialNoCursor; | |||
| break; | |||
| case MouseCursor::DraggingHandCursor: | |||
| @@ -2573,19 +2573,19 @@ void* juce_createStandardMouseCursor (MouseCursor::StandardCursorType type) thro | |||
| break; | |||
| case MouseCursor::CopyingCursor: | |||
| id = kThemeCopyArrowCursor; | |||
| cursorId = kThemeCopyArrowCursor; | |||
| break; | |||
| case MouseCursor::WaitCursor: | |||
| id = kThemeWatchCursor; | |||
| cursorId = kThemeWatchCursor; | |||
| break; | |||
| case MouseCursor::IBeamCursor: | |||
| id = kThemeIBeamCursor; | |||
| cursorId = kThemeIBeamCursor; | |||
| break; | |||
| case MouseCursor::PointingHandCursor: | |||
| id = kThemePointingHandCursor; | |||
| cursorId = kThemePointingHandCursor; | |||
| break; | |||
| case MouseCursor::LeftRightResizeCursor: | |||
| @@ -2655,13 +2655,13 @@ void* juce_createStandardMouseCursor (MouseCursor::StandardCursorType type) thro | |||
| } | |||
| case MouseCursor::CrosshairCursor: | |||
| id = kThemeCrossCursor; | |||
| cursorId = kThemeCrossCursor; | |||
| break; | |||
| } | |||
| CursorWrapper* cw = new CursorWrapper(); | |||
| cw->cursor = 0; | |||
| cw->themeCursor = id; | |||
| cw->themeCursor = cursorId; | |||
| return (void*) cw; | |||
| } | |||
| @@ -2767,14 +2767,14 @@ public: | |||
| if (currentModel != 0) | |||
| { | |||
| int id = 1000; | |||
| int menuId = 1000; | |||
| const StringArray menuNames (currentModel->getMenuBarNames()); | |||
| for (int i = 0; i < menuNames.size(); ++i) | |||
| { | |||
| const PopupMenu menu (currentModel->getMenuForIndex (i, menuNames [i])); | |||
| MenuRef m = createMenu (menu, menuNames [i], id, i); | |||
| MenuRef m = createMenu (menu, menuNames [i], menuId, i); | |||
| InsertMenu (m, 0); | |||
| CFRelease (m); | |||
| @@ -2795,19 +2795,19 @@ public: | |||
| } | |||
| } | |||
| void invoke (const int id, ApplicationCommandManager* const commandManager, const int topLevelIndex) const | |||
| void invoke (const int commandId, ApplicationCommandManager* const commandManager, const int topLevelIndex) const | |||
| { | |||
| if (currentModel != 0) | |||
| { | |||
| if (commandManager != 0) | |||
| { | |||
| ApplicationCommandTarget::InvocationInfo info (id); | |||
| ApplicationCommandTarget::InvocationInfo info (commandId); | |||
| info.invocationMethod = ApplicationCommandTarget::InvocationInfo::fromMenu; | |||
| commandManager->invoke (info, true); | |||
| } | |||
| currentModel->menuItemSelected (id, topLevelIndex); | |||
| currentModel->menuItemSelected (commandId, topLevelIndex); | |||
| } | |||
| } | |||
| @@ -30,6 +30,7 @@ | |||
| */ | |||
| #include "win32_headers.h" | |||
| #undef WINDOWS | |||
| #if JUCE_ASIO | |||
| @@ -1959,4 +1960,6 @@ AudioIODeviceType* juce_createASIOAudioIODeviceType() | |||
| END_JUCE_NAMESPACE | |||
| #undef log | |||
| #endif | |||
| @@ -219,7 +219,9 @@ static const String getDSErrorMessage (HRESULT hr) | |||
| #ifdef DS_DEBUGGING | |||
| #define CATCH JUCE_CATCH_EXCEPTION | |||
| #undef log | |||
| #define log(a) Logger::writeToLog(a); | |||
| #undef logError | |||
| #define logError(a) logDSError(a, __LINE__); | |||
| static void logDSError (HRESULT hr, int lineNum) | |||
| @@ -1783,5 +1785,6 @@ const String DSoundAudioIODevice::openDevice (const BitArray& inputChannels, | |||
| return error; | |||
| } | |||
| #undef log | |||
| END_JUCE_NAMESPACE | |||
| @@ -41,6 +41,7 @@ BEGIN_JUCE_NAMESPACE | |||
| //============================================================================== | |||
| #if ! ONLY_INCLUDE_JUCE_CORE_HEADERS | |||
| bool AlertWindow::showNativeDialogBox (const String& title, | |||
| const String& bodyText, | |||
| bool isOkCancel) | |||
| @@ -50,6 +51,8 @@ bool AlertWindow::showNativeDialogBox (const String& title, | |||
| : MB_OK) == IDOK; | |||
| } | |||
| #endif | |||
| //============================================================================== | |||
| void PlatformUtilities::beep() | |||
| { | |||
| @@ -62,6 +65,8 @@ void PlatformUtilities::beep() | |||
| #pragma warning (disable : 4127) // "Conditional expression is constant" warning | |||
| #endif | |||
| #if ! ONLY_INCLUDE_JUCE_CORE_HEADERS | |||
| void SystemClipboard::copyTextToClipboard (const String& text) throw() | |||
| { | |||
| if (OpenClipboard (0) != 0) | |||
| @@ -116,5 +121,6 @@ const String SystemClipboard::getTextFromClipboard() throw() | |||
| return result; | |||
| } | |||
| #endif | |||
| END_JUCE_NAMESPACE | |||
| @@ -358,7 +358,7 @@ int SystemStats::getMACAddresses (int64* addresses, int maxNum, const bool littl | |||
| } | |||
| //============================================================================== | |||
| typedef ULONG (WINAPI *MAPISendMailType) (LHANDLE, ULONG, lpMapiMessage, FLAGS, ULONG); | |||
| typedef ULONG (WINAPI *MAPISendMailType) (LHANDLE, ULONG, lpMapiMessage, ::FLAGS, ULONG); | |||
| bool PlatformUtilities::launchEmailWithAttachments (const String& targetEmailAddress, | |||
| const String& emailSubject, | |||
| @@ -49,7 +49,9 @@ BEGIN_JUCE_NAMESPACE | |||
| #include "../../../src/juce_core/threads/juce_Process.h" | |||
| #include "../../../src/juce_core/threads/juce_InterProcessLock.h" | |||
| extern HWND juce_messageWindowHandle; | |||
| #if ! ONLY_INCLUDE_JUCE_CORE_HEADERS | |||
| extern HWND juce_messageWindowHandle; | |||
| #endif | |||
| #ifdef _MSC_VER | |||
| #pragma warning (pop) | |||
| @@ -120,8 +122,10 @@ void JUCE_API juce_threadEntryPoint (void*); | |||
| static unsigned int __stdcall threadEntryProc (void* userData) throw() | |||
| { | |||
| #if ! ONLY_INCLUDE_JUCE_CORE_HEADERS | |||
| AttachThreadInput (GetWindowThreadProcessId (juce_messageWindowHandle, 0), | |||
| GetCurrentThreadId(), TRUE); | |||
| #endif | |||
| juce_threadEntryPoint (userData); | |||
| @@ -95,8 +95,6 @@ extern void juce_repeatLastProcessPriority() throw(); // in juce_win32_Threads.c | |||
| extern void juce_CheckCurrentlyFocusedTopLevelWindow() throw(); // in juce_TopLevelWindow.cpp | |||
| extern bool juce_IsRunningInWine() throw(); | |||
| const int juce_windowIsSemiTransparentFlag = (1 << 31); // also in component.cpp | |||
| #ifndef ULW_ALPHA | |||
| #define ULW_ALPHA 0x00000002 | |||
| #endif | |||
| @@ -1053,7 +1051,7 @@ private: | |||
| if ((styleFlags & windowIgnoresMouseClicks) != 0) | |||
| exstyle |= WS_EX_TRANSPARENT; | |||
| if ((styleFlags & juce_windowIsSemiTransparentFlag) != 0 | |||
| if ((styleFlags & windowIsSemiTransparent) != 0 | |||
| && Desktop::canUseSemiTransparentWindows()) | |||
| exstyle |= WS_EX_LAYERED; | |||
| @@ -34,7 +34,9 @@ | |||
| #include "../../../juce_Config.h" | |||
| #define STRICT | |||
| #ifndef STRICT | |||
| #define STRICT 1 | |||
| #endif | |||
| #define WIN32_LEAN_AND_MEAN | |||
| // don't want to get told about microsoft's mistakes.. | |||
| @@ -121,7 +121,7 @@ public: | |||
| StringArray lines; | |||
| lines.addLines (c->getComponentProperty (T("items"), false)); | |||
| int id = 1; | |||
| int itemId = 1; | |||
| for (int i = 0; i < lines.size(); ++i) | |||
| { | |||
| @@ -129,7 +129,7 @@ public: | |||
| s << memberVariableName << "->addSeparator();\n"; | |||
| else | |||
| s << memberVariableName << "->addItem (" | |||
| << quotedString (lines[i]) << ", " << id++ << ");\n"; | |||
| << quotedString (lines[i]) << ", " << itemId++ << ");\n"; | |||
| } | |||
| if (needsCallback (component)) | |||
| @@ -169,14 +169,14 @@ public: | |||
| lines.addLines (c->getComponentProperty (T("items"), false)); | |||
| c->clear(); | |||
| int id = 1; | |||
| int itemId = 1; | |||
| for (int i = 0; i < lines.size(); ++i) | |||
| { | |||
| if (lines[i].trim().isEmpty()) | |||
| c->addSeparator(); | |||
| else | |||
| c->addItem (lines[i], id++); | |||
| c->addItem (lines[i], itemId++); | |||
| } | |||
| } | |||
| @@ -224,15 +224,15 @@ int64 ComponentTypeHandler::getComponentId (Component* comp) | |||
| if (comp == 0) | |||
| return 0; | |||
| int64 id = comp->getComponentProperty (T("jucerCompId"), false).getHexValue64(); | |||
| int64 compId = comp->getComponentProperty (T("jucerCompId"), false).getHexValue64(); | |||
| if (id == 0) | |||
| if (compId == 0) | |||
| { | |||
| id = Random::getSystemRandom().nextInt64(); | |||
| setComponentId (comp, id); | |||
| compId = Random::getSystemRandom().nextInt64(); | |||
| setComponentId (comp, compId); | |||
| } | |||
| return id; | |||
| return compId; | |||
| } | |||
| void ComponentTypeHandler::setComponentId (Component* comp, const int64 newID) | |||
| @@ -463,18 +463,18 @@ Component* ComponentLayout::getComponentRelativePosTarget (Component* comp, int | |||
| if (pe != 0) | |||
| { | |||
| int64 id; | |||
| int64 compId; | |||
| if (whichDimension == 0) | |||
| id = pe->getPosition().relativeToX; | |||
| compId = pe->getPosition().relativeToX; | |||
| else if (whichDimension == 1) | |||
| id = pe->getPosition().relativeToY; | |||
| compId = pe->getPosition().relativeToY; | |||
| else if (whichDimension == 2) | |||
| id = pe->getPosition().relativeToW; | |||
| compId = pe->getPosition().relativeToW; | |||
| else | |||
| id = pe->getPosition().relativeToH; | |||
| compId = pe->getPosition().relativeToH; | |||
| return findComponentWithId (id); | |||
| return findComponentWithcompId (id); | |||
| } | |||
| else | |||
| { | |||
| @@ -495,7 +495,7 @@ void ComponentLayout::setComponentRelativeTarget (Component* comp, int whichDime | |||
| if (compToBeRelativeTo != getComponentRelativePosTarget (comp, whichDimension) | |||
| && (compToBeRelativeTo == 0 || ! dependsOnComponentForRelativePos (compToBeRelativeTo, comp))) | |||
| { | |||
| const int64 id = ComponentTypeHandler::getComponentId (compToBeRelativeTo); | |||
| const int64 compId = ComponentTypeHandler::getComponentId (compToBeRelativeTo); | |||
| Rectangle oldBounds (comp->getBounds()); | |||
| RelativePositionedRectangle pos; | |||
| @@ -511,13 +511,13 @@ void ComponentLayout::setComponentRelativeTarget (Component* comp, int whichDime | |||
| } | |||
| if (whichDimension == 0) | |||
| pos.relativeToX = id; | |||
| pos.relativeToX = compId; | |||
| else if (whichDimension == 1) | |||
| pos.relativeToY = id; | |||
| pos.relativeToY = compId; | |||
| else if (whichDimension == 2) | |||
| pos.relativeToW = id; | |||
| pos.relativeToW = compId; | |||
| else if (whichDimension == 3) | |||
| pos.relativeToH = id; | |||
| pos.relativeToH = compId; | |||
| if (pe != 0) | |||
| { | |||
| @@ -42,6 +42,38 @@ | |||
| #include "stream_decoder.h" | |||
| #include "stream_encoder.h" | |||
| #ifdef _MSC_VER | |||
| /* OPT: an MSVC built-in would be better */ | |||
| static _inline FLAC__uint32 local_swap32_(FLAC__uint32 x) | |||
| { | |||
| x = ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); | |||
| return (x>>16) | (x<<16); | |||
| } | |||
| #endif | |||
| #if defined(_MSC_VER) && defined(_X86_) | |||
| /* OPT: an MSVC built-in would be better */ | |||
| static void local_swap32_block_(FLAC__uint32 *start, FLAC__uint32 len) | |||
| { | |||
| __asm { | |||
| mov edx, start | |||
| mov ecx, len | |||
| test ecx, ecx | |||
| loop1: | |||
| jz done1 | |||
| mov eax, [edx] | |||
| bswap eax | |||
| mov [edx], eax | |||
| add edx, 4 | |||
| dec ecx | |||
| jmp short loop1 | |||
| done1: | |||
| } | |||
| } | |||
| #endif | |||
| /** \mainpage | |||
| * | |||
| * \section intro Introduction | |||
| @@ -152,32 +152,6 @@ struct FLAC__BitReader { | |||
| FLAC__CPUInfo cpu_info; | |||
| }; | |||
| #if defined(_MSC_VER) && defined(_X86_) | |||
| /* OPT: an MSVC built-in would be better */ | |||
| static _inline FLAC__uint32 local_swap32_(FLAC__uint32 x) | |||
| { | |||
| x = ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); | |||
| return (x>>16) | (x<<16); | |||
| } | |||
| static void local_swap32_block_(FLAC__uint32 *start, FLAC__uint32 len) | |||
| { | |||
| __asm { | |||
| mov edx, start | |||
| mov ecx, len | |||
| test ecx, ecx | |||
| loop1: | |||
| jz done1 | |||
| mov eax, [edx] | |||
| bswap eax | |||
| mov [edx], eax | |||
| add edx, 4 | |||
| dec ecx | |||
| jmp short loop1 | |||
| done1: | |||
| } | |||
| } | |||
| #endif | |||
| static FLaC__INLINE void crc16_update_word_(FLAC__BitReader *br, brword word) | |||
| { | |||
| register unsigned crc = br->read_crc16; | |||
| @@ -110,15 +110,6 @@ struct FLAC__BitWriter { | |||
| unsigned bits; /* # of used bits in accum */ | |||
| }; | |||
| #ifdef _MSC_VER | |||
| /* OPT: an MSVC built-in would be better */ | |||
| static _inline FLAC__uint32 local_swap32_(FLAC__uint32 x) | |||
| { | |||
| x = ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); | |||
| return (x>>16) | (x<<16); | |||
| } | |||
| #endif | |||
| /* * WATCHOUT: The current implementation only grows the buffer. */ | |||
| static FLAC__bool bitwriter_grow_(FLAC__BitWriter *bw, unsigned bits_to_add) | |||
| { | |||
| @@ -105,7 +105,7 @@ static FLAC__byte ID3V2_TAG_[3] = { 'I', 'D', '3' }; | |||
| * | |||
| ***********************************************************************/ | |||
| static void set_defaults_(FLAC__StreamDecoder *decoder); | |||
| static void set_defaults_dec(FLAC__StreamDecoder *decoder); | |||
| static FILE *get_binary_stdin_(void); | |||
| static FLAC__bool allocate_output_(FLAC__StreamDecoder *decoder, unsigned size, unsigned channels); | |||
| static FLAC__bool has_id_filtered_(FLAC__StreamDecoder *decoder, FLAC__byte *id); | |||
| @@ -138,9 +138,9 @@ static FLAC__bool seek_to_absolute_sample_(FLAC__StreamDecoder *decoder, FLAC__u | |||
| #if FLAC__HAS_OGG | |||
| static FLAC__bool seek_to_absolute_sample_ogg_(FLAC__StreamDecoder *decoder, FLAC__uint64 stream_length, FLAC__uint64 target_sample); | |||
| #endif | |||
| static FLAC__StreamDecoderReadStatus file_read_callback_(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data); | |||
| static FLAC__StreamDecoderSeekStatus file_seek_callback_(const FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data); | |||
| static FLAC__StreamDecoderTellStatus file_tell_callback_(const FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data); | |||
| static FLAC__StreamDecoderReadStatus file_read_callback_dec (const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data); | |||
| static FLAC__StreamDecoderSeekStatus file_seek_callback_dec (const FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data); | |||
| static FLAC__StreamDecoderTellStatus file_tell_callback_dec (const FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data); | |||
| static FLAC__StreamDecoderLengthStatus file_length_callback_(const FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data); | |||
| static FLAC__bool file_eof_callback_(const FLAC__StreamDecoder *decoder, void *client_data); | |||
| @@ -333,7 +333,7 @@ FLAC_API FLAC__StreamDecoder *FLAC__stream_decoder_new(void) | |||
| decoder->private_->file = 0; | |||
| set_defaults_(decoder); | |||
| set_defaults_dec(decoder); | |||
| decoder->protected_->state = FLAC__STREAM_DECODER_UNINITIALIZED; | |||
| @@ -370,7 +370,7 @@ FLAC_API void FLAC__stream_decoder_delete(FLAC__StreamDecoder *decoder) | |||
| * | |||
| ***********************************************************************/ | |||
| static FLAC__StreamDecoderInitStatus init_stream_internal_( | |||
| static FLAC__StreamDecoderInitStatus init_stream_internal_dec( | |||
| FLAC__StreamDecoder *decoder, | |||
| FLAC__StreamDecoderReadCallback read_callback, | |||
| FLAC__StreamDecoderSeekCallback seek_callback, | |||
| @@ -495,7 +495,7 @@ FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_stream( | |||
| void *client_data | |||
| ) | |||
| { | |||
| return init_stream_internal_( | |||
| return init_stream_internal_dec( | |||
| decoder, | |||
| read_callback, | |||
| seek_callback, | |||
| @@ -523,7 +523,7 @@ FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_ogg_stream( | |||
| void *client_data | |||
| ) | |||
| { | |||
| return init_stream_internal_( | |||
| return init_stream_internal_dec( | |||
| decoder, | |||
| read_callback, | |||
| seek_callback, | |||
| @@ -552,10 +552,10 @@ static FLAC__StreamDecoderInitStatus init_FILE_internal_( | |||
| FLAC__ASSERT(0 != file); | |||
| if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED) | |||
| return decoder->protected_->state = FLAC__STREAM_DECODER_INIT_STATUS_ALREADY_INITIALIZED; | |||
| return (FLAC__StreamDecoderInitStatus) (decoder->protected_->state = (FLAC__StreamDecoderState) FLAC__STREAM_DECODER_INIT_STATUS_ALREADY_INITIALIZED); | |||
| if(0 == write_callback || 0 == error_callback) | |||
| return decoder->protected_->state = FLAC__STREAM_DECODER_INIT_STATUS_INVALID_CALLBACKS; | |||
| return (FLAC__StreamDecoderInitStatus) (decoder->protected_->state = (FLAC__StreamDecoderState) FLAC__STREAM_DECODER_INIT_STATUS_INVALID_CALLBACKS); | |||
| /* | |||
| * To make sure that our file does not go unclosed after an error, we | |||
| @@ -567,11 +567,11 @@ static FLAC__StreamDecoderInitStatus init_FILE_internal_( | |||
| decoder->private_->file = file; | |||
| return init_stream_internal_( | |||
| return init_stream_internal_dec( | |||
| decoder, | |||
| file_read_callback_, | |||
| decoder->private_->file == stdin? 0: file_seek_callback_, | |||
| decoder->private_->file == stdin? 0: file_tell_callback_, | |||
| file_read_callback_dec, | |||
| decoder->private_->file == stdin? 0: file_seek_callback_dec, | |||
| decoder->private_->file == stdin? 0: file_tell_callback_dec, | |||
| decoder->private_->file == stdin? 0: file_length_callback_, | |||
| file_eof_callback_, | |||
| write_callback, | |||
| @@ -626,10 +626,10 @@ static FLAC__StreamDecoderInitStatus init_file_internal_( | |||
| * in FLAC__stream_decoder_init_FILE() before the FILE* is assigned. | |||
| */ | |||
| if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED) | |||
| return decoder->protected_->state = FLAC__STREAM_DECODER_INIT_STATUS_ALREADY_INITIALIZED; | |||
| return (FLAC__StreamDecoderInitStatus) (decoder->protected_->state = (FLAC__StreamDecoderState) FLAC__STREAM_DECODER_INIT_STATUS_ALREADY_INITIALIZED); | |||
| if(0 == write_callback || 0 == error_callback) | |||
| return decoder->protected_->state = FLAC__STREAM_DECODER_INIT_STATUS_INVALID_CALLBACKS; | |||
| return (FLAC__StreamDecoderInitStatus) (decoder->protected_->state = (FLAC__StreamDecoderState) FLAC__STREAM_DECODER_INIT_STATUS_INVALID_CALLBACKS); | |||
| file = filename? fopen(filename, "rb") : stdin; | |||
| @@ -722,7 +722,7 @@ FLAC_API FLAC__bool FLAC__stream_decoder_finish(FLAC__StreamDecoder *decoder) | |||
| } | |||
| decoder->private_->is_seeking = false; | |||
| set_defaults_(decoder); | |||
| set_defaults_dec(decoder); | |||
| decoder->protected_->state = FLAC__STREAM_DECODER_UNINITIALIZED; | |||
| @@ -1254,7 +1254,7 @@ unsigned FLAC__stream_decoder_get_input_bytes_unconsumed(const FLAC__StreamDecod | |||
| * | |||
| ***********************************************************************/ | |||
| void set_defaults_(FLAC__StreamDecoder *decoder) | |||
| void set_defaults_dec(FLAC__StreamDecoder *decoder) | |||
| { | |||
| #if FLAC__HAS_OGG | |||
| decoder->private_->is_ogg = false; | |||
| @@ -1369,12 +1369,12 @@ FLAC__bool has_id_filtered_(FLAC__StreamDecoder *decoder, FLAC__byte *id) | |||
| FLAC__bool find_metadata_(FLAC__StreamDecoder *decoder) | |||
| { | |||
| FLAC__uint32 x; | |||
| unsigned i, id; | |||
| unsigned i, id_; | |||
| FLAC__bool first = true; | |||
| FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input)); | |||
| for(i = id = 0; i < 4; ) { | |||
| for(i = id_ = 0; i < 4; ) { | |||
| if(decoder->private_->cached) { | |||
| x = (FLAC__uint32)decoder->private_->lookahead; | |||
| decoder->private_->cached = false; | |||
| @@ -1386,19 +1386,19 @@ FLAC__bool find_metadata_(FLAC__StreamDecoder *decoder) | |||
| if(x == FLAC__STREAM_SYNC_STRING[i]) { | |||
| first = true; | |||
| i++; | |||
| id = 0; | |||
| id_ = 0; | |||
| continue; | |||
| } | |||
| if(x == ID3V2_TAG_[id]) { | |||
| id++; | |||
| if(x == ID3V2_TAG_[id_]) { | |||
| id_++; | |||
| i = 0; | |||
| if(id == 3) { | |||
| if(id_ == 3) { | |||
| if(!skip_id3v2_tag_(decoder)) | |||
| return false; /* skip_id3v2_tag_ sets the state for us */ | |||
| } | |||
| continue; | |||
| } | |||
| id = 0; | |||
| id_ = 0; | |||
| if(x == 0xff) { /* MAGIC NUMBER for the first 8 frame sync bits */ | |||
| decoder->private_->header_warmup[0] = (FLAC__byte)x; | |||
| if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, 8)) | |||
| @@ -1859,7 +1859,7 @@ FLAC__bool read_metadata_picture_(FLAC__StreamDecoder *decoder, FLAC__StreamMeta | |||
| /* read type */ | |||
| if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_PICTURE_TYPE_LEN)) | |||
| return false; /* read_callback_ sets the state for us */ | |||
| obj->type = x; | |||
| obj->type = (FLAC__StreamMetadata_Picture_Type) x; | |||
| /* read MIME type */ | |||
| if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN)) | |||
| @@ -3323,7 +3323,7 @@ FLAC__bool seek_to_absolute_sample_ogg_(FLAC__StreamDecoder *decoder, FLAC__uint | |||
| } | |||
| #endif | |||
| FLAC__StreamDecoderReadStatus file_read_callback_(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data) | |||
| FLAC__StreamDecoderReadStatus file_read_callback_dec(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data) | |||
| { | |||
| (void)client_data; | |||
| @@ -3340,7 +3340,7 @@ FLAC__StreamDecoderReadStatus file_read_callback_(const FLAC__StreamDecoder *dec | |||
| return FLAC__STREAM_DECODER_READ_STATUS_ABORT; /* abort to avoid a deadlock */ | |||
| } | |||
| FLAC__StreamDecoderSeekStatus file_seek_callback_(const FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data) | |||
| FLAC__StreamDecoderSeekStatus file_seek_callback_dec(const FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data) | |||
| { | |||
| (void)client_data; | |||
| @@ -3352,7 +3352,7 @@ FLAC__StreamDecoderSeekStatus file_seek_callback_(const FLAC__StreamDecoder *dec | |||
| return FLAC__STREAM_DECODER_SEEK_STATUS_OK; | |||
| } | |||
| FLAC__StreamDecoderTellStatus file_tell_callback_(const FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data) | |||
| FLAC__StreamDecoderTellStatus file_tell_callback_dec(const FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data) | |||
| { | |||
| off_t pos; | |||
| (void)client_data; | |||
| @@ -150,7 +150,7 @@ static struct CompressionLevels { | |||
| * | |||
| ***********************************************************************/ | |||
| static void set_defaults_(FLAC__StreamEncoder *encoder); | |||
| static void set_defaults_enc(FLAC__StreamEncoder *encoder); | |||
| static void free_(FLAC__StreamEncoder *encoder); | |||
| static FLAC__bool resize_buffers_(FLAC__StreamEncoder *encoder, unsigned new_blocksize); | |||
| static FLAC__bool write_bitbuffer_(FLAC__StreamEncoder *encoder, unsigned samples, FLAC__bool is_last_block); | |||
| @@ -319,9 +319,9 @@ static FLAC__StreamDecoderWriteStatus verify_write_callback_(const FLAC__StreamD | |||
| static void verify_metadata_callback_(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data); | |||
| static void verify_error_callback_(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data); | |||
| static FLAC__StreamEncoderReadStatus file_read_callback_(const FLAC__StreamEncoder *encoder, FLAC__byte buffer[], size_t *bytes, void *client_data); | |||
| static FLAC__StreamEncoderSeekStatus file_seek_callback_(const FLAC__StreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data); | |||
| static FLAC__StreamEncoderTellStatus file_tell_callback_(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data); | |||
| static FLAC__StreamEncoderReadStatus file_read_callback_enc(const FLAC__StreamEncoder *encoder, FLAC__byte buffer[], size_t *bytes, void *client_data); | |||
| static FLAC__StreamEncoderSeekStatus file_seek_callback_enc(const FLAC__StreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data); | |||
| static FLAC__StreamEncoderTellStatus file_tell_callback_enc(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data); | |||
| static FLAC__StreamEncoderWriteStatus file_write_callback_(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data); | |||
| static FILE *get_binary_stdout_(void); | |||
| @@ -557,7 +557,7 @@ FLAC_API FLAC__StreamEncoder *FLAC__stream_encoder_new(void) | |||
| encoder->private_->file = 0; | |||
| set_defaults_(encoder); | |||
| set_defaults_enc(encoder); | |||
| encoder->private_->is_being_deleted = false; | |||
| @@ -633,7 +633,7 @@ FLAC_API void FLAC__stream_encoder_delete(FLAC__StreamEncoder *encoder) | |||
| * | |||
| ***********************************************************************/ | |||
| static FLAC__StreamEncoderInitStatus init_stream_internal_( | |||
| static FLAC__StreamEncoderInitStatus init_stream_internal_enc( | |||
| FLAC__StreamEncoder *encoder, | |||
| FLAC__StreamEncoderReadCallback read_callback, | |||
| FLAC__StreamEncoderWriteCallback write_callback, | |||
| @@ -1150,7 +1150,7 @@ FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_stream( | |||
| void *client_data | |||
| ) | |||
| { | |||
| return init_stream_internal_( | |||
| return init_stream_internal_enc( | |||
| encoder, | |||
| /*read_callback=*/0, | |||
| write_callback, | |||
| @@ -1172,7 +1172,7 @@ FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_ogg_stream( | |||
| void *client_data | |||
| ) | |||
| { | |||
| return init_stream_internal_( | |||
| return init_stream_internal_enc( | |||
| encoder, | |||
| read_callback, | |||
| write_callback, | |||
| @@ -1184,7 +1184,7 @@ FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_ogg_stream( | |||
| ); | |||
| } | |||
| static FLAC__StreamEncoderInitStatus init_FILE_internal_( | |||
| static FLAC__StreamEncoderInitStatus init_FILE_internal_enc( | |||
| FLAC__StreamEncoder *encoder, | |||
| FILE *file, | |||
| FLAC__StreamEncoderProgressCallback progress_callback, | |||
| @@ -1221,12 +1221,12 @@ static FLAC__StreamEncoderInitStatus init_FILE_internal_( | |||
| encoder->private_->samples_written = 0; | |||
| encoder->private_->frames_written = 0; | |||
| init_status = init_stream_internal_( | |||
| init_status = init_stream_internal_enc( | |||
| encoder, | |||
| encoder->private_->file == stdout? 0 : is_ogg? file_read_callback_ : 0, | |||
| encoder->private_->file == stdout? 0 : is_ogg? file_read_callback_enc : 0, | |||
| file_write_callback_, | |||
| encoder->private_->file == stdout? 0 : file_seek_callback_, | |||
| encoder->private_->file == stdout? 0 : file_tell_callback_, | |||
| encoder->private_->file == stdout? 0 : file_seek_callback_enc, | |||
| encoder->private_->file == stdout? 0 : file_tell_callback_enc, | |||
| /*metadata_callback=*/0, | |||
| client_data, | |||
| is_ogg | |||
| @@ -1253,7 +1253,7 @@ FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_FILE( | |||
| void *client_data | |||
| ) | |||
| { | |||
| return init_FILE_internal_(encoder, file, progress_callback, client_data, /*is_ogg=*/false); | |||
| return init_FILE_internal_enc(encoder, file, progress_callback, client_data, /*is_ogg=*/false); | |||
| } | |||
| FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_ogg_FILE( | |||
| @@ -1263,10 +1263,10 @@ FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_ogg_FILE( | |||
| void *client_data | |||
| ) | |||
| { | |||
| return init_FILE_internal_(encoder, file, progress_callback, client_data, /*is_ogg=*/true); | |||
| return init_FILE_internal_enc(encoder, file, progress_callback, client_data, /*is_ogg=*/true); | |||
| } | |||
| static FLAC__StreamEncoderInitStatus init_file_internal_( | |||
| static FLAC__StreamEncoderInitStatus init_file_internal_enc( | |||
| FLAC__StreamEncoder *encoder, | |||
| const char *filename, | |||
| FLAC__StreamEncoderProgressCallback progress_callback, | |||
| @@ -1293,7 +1293,7 @@ static FLAC__StreamEncoderInitStatus init_file_internal_( | |||
| return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR; | |||
| } | |||
| return init_FILE_internal_(encoder, file, progress_callback, client_data, is_ogg); | |||
| return init_FILE_internal_enc(encoder, file, progress_callback, client_data, is_ogg); | |||
| } | |||
| FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_file( | |||
| @@ -1303,7 +1303,7 @@ FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_file( | |||
| void *client_data | |||
| ) | |||
| { | |||
| return init_file_internal_(encoder, filename, progress_callback, client_data, /*is_ogg=*/false); | |||
| return init_file_internal_enc(encoder, filename, progress_callback, client_data, /*is_ogg=*/false); | |||
| } | |||
| FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_ogg_file( | |||
| @@ -1313,7 +1313,7 @@ FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_ogg_file( | |||
| void *client_data | |||
| ) | |||
| { | |||
| return init_file_internal_(encoder, filename, progress_callback, client_data, /*is_ogg=*/true); | |||
| return init_file_internal_enc(encoder, filename, progress_callback, client_data, /*is_ogg=*/true); | |||
| } | |||
| FLAC_API FLAC__bool FLAC__stream_encoder_finish(FLAC__StreamEncoder *encoder) | |||
| @@ -1376,7 +1376,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_finish(FLAC__StreamEncoder *encoder) | |||
| #endif | |||
| free_(encoder); | |||
| set_defaults_(encoder); | |||
| set_defaults_enc(encoder); | |||
| if(!error) | |||
| encoder->protected_->state = FLAC__STREAM_ENCODER_UNINITIALIZED; | |||
| @@ -2119,7 +2119,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_process_interleaved(FLAC__StreamEncoder | |||
| * | |||
| ***********************************************************************/ | |||
| void set_defaults_(FLAC__StreamEncoder *encoder) | |||
| void set_defaults_enc(FLAC__StreamEncoder *encoder) | |||
| { | |||
| FLAC__ASSERT(0 != encoder); | |||
| @@ -2450,7 +2450,7 @@ FLAC__StreamEncoderWriteStatus write_frame_(FLAC__StreamEncoder *encoder, const | |||
| * Watch for the STREAMINFO block and first SEEKTABLE block to go by and store their offsets. | |||
| */ | |||
| if(samples == 0) { | |||
| FLAC__MetadataType type = (buffer[0] & 0x7f); | |||
| FLAC__MetadataType type = (FLAC__MetadataType) (buffer[0] & 0x7f); | |||
| if(type == FLAC__METADATA_TYPE_STREAMINFO) | |||
| encoder->protected_->streaminfo_offset = output_position; | |||
| else if(type == FLAC__METADATA_TYPE_SEEKTABLE && encoder->protected_->seektable_offset == 0) | |||
| @@ -4256,7 +4256,7 @@ void verify_error_callback_(const FLAC__StreamDecoder *decoder, FLAC__StreamDeco | |||
| encoder->protected_->state = FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR; | |||
| } | |||
| FLAC__StreamEncoderReadStatus file_read_callback_(const FLAC__StreamEncoder *encoder, FLAC__byte buffer[], size_t *bytes, void *client_data) | |||
| FLAC__StreamEncoderReadStatus file_read_callback_enc(const FLAC__StreamEncoder *encoder, FLAC__byte buffer[], size_t *bytes, void *client_data) | |||
| { | |||
| (void)client_data; | |||
| @@ -4270,7 +4270,7 @@ FLAC__StreamEncoderReadStatus file_read_callback_(const FLAC__StreamEncoder *enc | |||
| return FLAC__STREAM_ENCODER_READ_STATUS_CONTINUE; | |||
| } | |||
| FLAC__StreamEncoderSeekStatus file_seek_callback_(const FLAC__StreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data) | |||
| FLAC__StreamEncoderSeekStatus file_seek_callback_enc(const FLAC__StreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data) | |||
| { | |||
| (void)client_data; | |||
| @@ -4280,7 +4280,7 @@ FLAC__StreamEncoderSeekStatus file_seek_callback_(const FLAC__StreamEncoder *enc | |||
| return FLAC__STREAM_ENCODER_SEEK_STATUS_OK; | |||
| } | |||
| FLAC__StreamEncoderTellStatus file_tell_callback_(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data) | |||
| FLAC__StreamEncoderTellStatus file_tell_callback_enc(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data) | |||
| { | |||
| off_t offset; | |||
| @@ -41,7 +41,7 @@ static const unsigned int mask8B[]= | |||
| void oggpack_writeinit(oggpack_buffer *b){ | |||
| memset(b,0,sizeof(*b)); | |||
| b->ptr=b->buffer=_ogg_malloc(BUFFER_INCREMENT); | |||
| b->ptr=b->buffer=(unsigned char*) _ogg_malloc(BUFFER_INCREMENT); | |||
| b->buffer[0]='\0'; | |||
| b->storage=BUFFER_INCREMENT; | |||
| } | |||
| @@ -71,7 +71,7 @@ void oggpackB_writetrunc(oggpack_buffer *b,long bits){ | |||
| /* Takes only up to 32 bits. */ | |||
| void oggpack_write(oggpack_buffer *b,unsigned long value,int bits){ | |||
| if(b->endbyte+4>=b->storage){ | |||
| b->buffer=_ogg_realloc(b->buffer,b->storage+BUFFER_INCREMENT); | |||
| b->buffer=(unsigned char*) _ogg_realloc(b->buffer,b->storage+BUFFER_INCREMENT); | |||
| b->storage+=BUFFER_INCREMENT; | |||
| b->ptr=b->buffer+b->endbyte; | |||
| } | |||
| @@ -105,7 +105,7 @@ void oggpack_write(oggpack_buffer *b,unsigned long value,int bits){ | |||
| /* Takes only up to 32 bits. */ | |||
| void oggpackB_write(oggpack_buffer *b,unsigned long value,int bits){ | |||
| if(b->endbyte+4>=b->storage){ | |||
| b->buffer=_ogg_realloc(b->buffer,b->storage+BUFFER_INCREMENT); | |||
| b->buffer=(unsigned char*) _ogg_realloc(b->buffer,b->storage+BUFFER_INCREMENT); | |||
| b->storage+=BUFFER_INCREMENT; | |||
| b->ptr=b->buffer+b->endbyte; | |||
| } | |||
| @@ -169,7 +169,7 @@ static void oggpack_writecopy_helper(oggpack_buffer *b, | |||
| /* aligned block copy */ | |||
| if(b->endbyte+bytes+1>=b->storage){ | |||
| b->storage=b->endbyte+bytes+BUFFER_INCREMENT; | |||
| b->buffer=_ogg_realloc(b->buffer,b->storage); | |||
| b->buffer=(unsigned char*) _ogg_realloc(b->buffer,b->storage); | |||
| b->ptr=b->buffer+b->endbyte; | |||
| } | |||
| @@ -192,11 +192,11 @@ int ogg_stream_init(ogg_stream_state *os,int serialno){ | |||
| if(os){ | |||
| memset(os,0,sizeof(*os)); | |||
| os->body_storage=16*1024; | |||
| os->body_data=_ogg_malloc(os->body_storage*sizeof(*os->body_data)); | |||
| os->body_data=(unsigned char*) _ogg_malloc(os->body_storage*sizeof(*os->body_data)); | |||
| os->lacing_storage=1024; | |||
| os->lacing_vals=_ogg_malloc(os->lacing_storage*sizeof(*os->lacing_vals)); | |||
| os->granule_vals=_ogg_malloc(os->lacing_storage*sizeof(*os->granule_vals)); | |||
| os->lacing_vals=(int*) _ogg_malloc(os->lacing_storage*sizeof(*os->lacing_vals)); | |||
| os->granule_vals=(ogg_int64_t*) _ogg_malloc(os->lacing_storage*sizeof(*os->granule_vals)); | |||
| os->serialno=serialno; | |||
| @@ -231,15 +231,15 @@ int ogg_stream_destroy(ogg_stream_state *os){ | |||
| static void _os_body_expand(ogg_stream_state *os,int needed){ | |||
| if(os->body_storage<=os->body_fill+needed){ | |||
| os->body_storage+=(needed+1024); | |||
| os->body_data=_ogg_realloc(os->body_data,os->body_storage*sizeof(*os->body_data)); | |||
| os->body_data=(unsigned char*) _ogg_realloc(os->body_data,os->body_storage*sizeof(*os->body_data)); | |||
| } | |||
| } | |||
| static void _os_lacing_expand(ogg_stream_state *os,int needed){ | |||
| if(os->lacing_storage<=os->lacing_fill+needed){ | |||
| os->lacing_storage+=(needed+32); | |||
| os->lacing_vals=_ogg_realloc(os->lacing_vals,os->lacing_storage*sizeof(*os->lacing_vals)); | |||
| os->granule_vals=_ogg_realloc(os->granule_vals,os->lacing_storage*sizeof(*os->granule_vals)); | |||
| os->lacing_vals=(int*)_ogg_realloc(os->lacing_vals,os->lacing_storage*sizeof(*os->lacing_vals)); | |||
| os->granule_vals=(ogg_int64_t*)_ogg_realloc(os->granule_vals,os->lacing_storage*sizeof(*os->granule_vals)); | |||
| } | |||
| } | |||
| @@ -520,9 +520,9 @@ char *ogg_sync_buffer(ogg_sync_state *oy, long size){ | |||
| long newsize=size+oy->fill+4096; /* an extra page to be nice */ | |||
| if(oy->data) | |||
| oy->data=_ogg_realloc(oy->data,newsize); | |||
| oy->data=(unsigned char*) _ogg_realloc(oy->data,newsize); | |||
| else | |||
| oy->data=_ogg_malloc(newsize); | |||
| oy->data=(unsigned char*) _ogg_malloc(newsize); | |||
| oy->storage=newsize; | |||
| } | |||
| @@ -623,7 +623,7 @@ long ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og){ | |||
| oy->bodybytes=0; | |||
| /* search for possible capture */ | |||
| next=memchr(page+1,'O',bytes-1); | |||
| next=(unsigned char*)memchr(page+1,'O',bytes-1); | |||
| if(!next) | |||
| next=oy->data+oy->fill; | |||
| @@ -34,7 +34,7 @@ int analysis_noisy=1; | |||
| /* decides between modes, dispatches to the appropriate mapping. */ | |||
| int vorbis_analysis(vorbis_block *vb, ogg_packet *op){ | |||
| int ret,i; | |||
| vorbis_block_internal *vbi=vb->internal; | |||
| vorbis_block_internal *vbi=(vorbis_block_internal *)vb->internal; | |||
| vb->glue_bits=0; | |||
| vb->time_bits=0; | |||
| @@ -92,7 +92,7 @@ typedef struct{ | |||
| vorbis_info_residue *); | |||
| void (*free_info) (vorbis_info_residue *); | |||
| void (*free_look) (vorbis_look_residue *); | |||
| long **(*class) (struct vorbis_block *,vorbis_look_residue *, | |||
| long **(*classx) (struct vorbis_block *,vorbis_look_residue *, | |||
| float **,int *,int); | |||
| int (*forward) (oggpack_buffer *,struct vorbis_block *, | |||
| vorbis_look_residue *, | |||
| @@ -31,7 +31,7 @@ | |||
| /* compute bitrate tracking setup */ | |||
| void vorbis_bitrate_init(vorbis_info *vi,bitrate_manager_state *bm){ | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info *)vi->codec_setup; | |||
| bitrate_manager_info *bi=&ci->bi; | |||
| memset(bm,0,sizeof(*bm)); | |||
| @@ -67,7 +67,7 @@ void vorbis_bitrate_clear(bitrate_manager_state *bm){ | |||
| int vorbis_bitrate_managed(vorbis_block *vb){ | |||
| vorbis_dsp_state *vd=vb->vd; | |||
| private_state *b=vd->backend_state; | |||
| private_state *b=(private_state*)vd->backend_state; | |||
| bitrate_manager_state *bm=&b->bms; | |||
| if(bm && bm->managed)return(1); | |||
| @@ -76,12 +76,12 @@ int vorbis_bitrate_managed(vorbis_block *vb){ | |||
| /* finish taking in the block we just processed */ | |||
| int vorbis_bitrate_addblock(vorbis_block *vb){ | |||
| vorbis_block_internal *vbi=vb->internal; | |||
| vorbis_block_internal *vbi=(vorbis_block_internal*)vb->internal; | |||
| vorbis_dsp_state *vd=vb->vd; | |||
| private_state *b=vd->backend_state; | |||
| private_state *b=(private_state*)vd->backend_state; | |||
| bitrate_manager_state *bm=&b->bms; | |||
| vorbis_info *vi=vd->vi; | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info*)vi->codec_setup; | |||
| bitrate_manager_info *bi=&ci->bi; | |||
| int choice=rint(bm->avgfloat); | |||
| @@ -232,14 +232,14 @@ int vorbis_bitrate_addblock(vorbis_block *vb){ | |||
| } | |||
| int vorbis_bitrate_flushpacket(vorbis_dsp_state *vd,ogg_packet *op){ | |||
| private_state *b=vd->backend_state; | |||
| private_state *b=(private_state*)vd->backend_state; | |||
| bitrate_manager_state *bm=&b->bms; | |||
| vorbis_block *vb=bm->vb; | |||
| int choice=PACKETBLOBS/2; | |||
| if(!vb)return 0; | |||
| if(op){ | |||
| vorbis_block_internal *vbi=vb->internal; | |||
| vorbis_block_internal *vbi=(vorbis_block_internal*)vb->internal; | |||
| if(vorbis_bitrate_managed(vb)) | |||
| choice=bm->choice; | |||
| @@ -34,16 +34,6 @@ | |||
| #include "registry.h" | |||
| #include "misc.h" | |||
| static int ilog2(unsigned int v){ | |||
| int ret=0; | |||
| if(v)--v; | |||
| while(v){ | |||
| ret++; | |||
| v>>=1; | |||
| } | |||
| return(ret); | |||
| } | |||
| /* pcm accumulator examples (not exhaustive): | |||
| <-------------- lW ----------------> | |||
| @@ -95,8 +85,8 @@ int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb){ | |||
| vb->localalloc=0; | |||
| vb->localstore=NULL; | |||
| if(v->analysisp){ | |||
| vorbis_block_internal *vbi= | |||
| vb->internal=_ogg_calloc(1,sizeof(vorbis_block_internal)); | |||
| vorbis_block_internal *vbi=(vorbis_block_internal*) | |||
| (vb->internal=(vorbis_block_internal*)_ogg_calloc(1,sizeof(vorbis_block_internal))); | |||
| vbi->ampmax=-9999; | |||
| for(i=0;i<PACKETBLOBS;i++){ | |||
| @@ -104,7 +94,7 @@ int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb){ | |||
| vbi->packetblob[i]=&vb->opb; | |||
| }else{ | |||
| vbi->packetblob[i]= | |||
| _ogg_calloc(1,sizeof(oggpack_buffer)); | |||
| (oggpack_buffer*) _ogg_calloc(1,sizeof(oggpack_buffer)); | |||
| } | |||
| oggpack_writeinit(vbi->packetblob[i]); | |||
| } | |||
| @@ -118,7 +108,7 @@ void *_vorbis_block_alloc(vorbis_block *vb,long bytes){ | |||
| if(bytes+vb->localtop>vb->localalloc){ | |||
| /* can't just _ogg_realloc... there are outstanding pointers */ | |||
| if(vb->localstore){ | |||
| struct alloc_chain *link=_ogg_malloc(sizeof(*link)); | |||
| struct alloc_chain *link=(struct alloc_chain*)_ogg_malloc(sizeof(*link)); | |||
| vb->totaluse+=vb->localtop; | |||
| link->next=vb->reap; | |||
| link->ptr=vb->localstore; | |||
| @@ -161,7 +151,7 @@ void _vorbis_block_ripcord(vorbis_block *vb){ | |||
| int vorbis_block_clear(vorbis_block *vb){ | |||
| int i; | |||
| vorbis_block_internal *vbi=vb->internal; | |||
| vorbis_block_internal *vbi=(vorbis_block_internal*)vb->internal; | |||
| _vorbis_block_ripcord(vb); | |||
| if(vb->localstore)_ogg_free(vb->localstore); | |||
| @@ -183,7 +173,7 @@ int vorbis_block_clear(vorbis_block *vb){ | |||
| static int _vds_shared_init(vorbis_dsp_state *v,vorbis_info *vi,int encp){ | |||
| int i; | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info*)vi->codec_setup; | |||
| private_state *b=NULL; | |||
| int hs; | |||
| @@ -191,20 +181,20 @@ static int _vds_shared_init(vorbis_dsp_state *v,vorbis_info *vi,int encp){ | |||
| hs=ci->halfrate_flag; | |||
| memset(v,0,sizeof(*v)); | |||
| b=v->backend_state=_ogg_calloc(1,sizeof(*b)); | |||
| b=(private_state*) (v->backend_state=(private_state*)_ogg_calloc(1,sizeof(*b))); | |||
| v->vi=vi; | |||
| b->modebits=ilog2(ci->modes); | |||
| b->transform[0]=_ogg_calloc(VI_TRANSFORMB,sizeof(*b->transform[0])); | |||
| b->transform[1]=_ogg_calloc(VI_TRANSFORMB,sizeof(*b->transform[1])); | |||
| b->transform[0]=(vorbis_look_transform**)_ogg_calloc(VI_TRANSFORMB,sizeof(*b->transform[0])); | |||
| b->transform[1]=(vorbis_look_transform**)_ogg_calloc(VI_TRANSFORMB,sizeof(*b->transform[1])); | |||
| /* MDCT is tranform 0 */ | |||
| b->transform[0][0]=_ogg_calloc(1,sizeof(mdct_lookup)); | |||
| b->transform[1][0]=_ogg_calloc(1,sizeof(mdct_lookup)); | |||
| mdct_init(b->transform[0][0],ci->blocksizes[0]>>hs); | |||
| mdct_init(b->transform[1][0],ci->blocksizes[1]>>hs); | |||
| mdct_init((mdct_lookup*)b->transform[0][0],ci->blocksizes[0]>>hs); | |||
| mdct_init((mdct_lookup*)b->transform[1][0],ci->blocksizes[1]>>hs); | |||
| /* Vorbis I uses only window type 0 */ | |||
| b->window[0]=ilog2(ci->blocksizes[0])-6; | |||
| @@ -218,12 +208,12 @@ static int _vds_shared_init(vorbis_dsp_state *v,vorbis_info *vi,int encp){ | |||
| /* finish the codebooks */ | |||
| if(!ci->fullbooks){ | |||
| ci->fullbooks=_ogg_calloc(ci->books,sizeof(*ci->fullbooks)); | |||
| ci->fullbooks=(codebook*) _ogg_calloc(ci->books,sizeof(*ci->fullbooks)); | |||
| for(i=0;i<ci->books;i++) | |||
| vorbis_book_init_encode(ci->fullbooks+i,ci->book_param[i]); | |||
| } | |||
| b->psy=_ogg_calloc(ci->psys,sizeof(*b->psy)); | |||
| b->psy=(vorbis_look_psy*)_ogg_calloc(ci->psys,sizeof(*b->psy)); | |||
| for(i=0;i<ci->psys;i++){ | |||
| _vp_psy_init(b->psy+i, | |||
| ci->psy_param[i], | |||
| @@ -236,7 +226,7 @@ static int _vds_shared_init(vorbis_dsp_state *v,vorbis_info *vi,int encp){ | |||
| }else{ | |||
| /* finish the codebooks */ | |||
| if(!ci->fullbooks){ | |||
| ci->fullbooks=_ogg_calloc(ci->books,sizeof(*ci->fullbooks)); | |||
| ci->fullbooks=(codebook*) _ogg_calloc(ci->books,sizeof(*ci->fullbooks)); | |||
| for(i=0;i<ci->books;i++){ | |||
| vorbis_book_init_decode(ci->fullbooks+i,ci->book_param[i]); | |||
| /* decode codebooks are now standalone after init */ | |||
| @@ -249,12 +239,12 @@ static int _vds_shared_init(vorbis_dsp_state *v,vorbis_info *vi,int encp){ | |||
| /* initialize the storage vectors. blocksize[1] is small for encode, | |||
| but the correct size for decode */ | |||
| v->pcm_storage=ci->blocksizes[1]; | |||
| v->pcm=_ogg_malloc(vi->channels*sizeof(*v->pcm)); | |||
| v->pcmret=_ogg_malloc(vi->channels*sizeof(*v->pcmret)); | |||
| v->pcm=(float**)_ogg_malloc(vi->channels*sizeof(*v->pcm)); | |||
| v->pcmret=(float**)_ogg_malloc(vi->channels*sizeof(*v->pcmret)); | |||
| { | |||
| int i; | |||
| for(i=0;i<vi->channels;i++) | |||
| v->pcm[i]=_ogg_calloc(v->pcm_storage,sizeof(*v->pcm[i])); | |||
| v->pcm[i]=(float*)_ogg_calloc(v->pcm_storage,sizeof(*v->pcm[i])); | |||
| } | |||
| /* all 1 (large block) or 0 (small block) */ | |||
| @@ -268,8 +258,8 @@ static int _vds_shared_init(vorbis_dsp_state *v,vorbis_info *vi,int encp){ | |||
| v->pcm_current=v->centerW; | |||
| /* initialize all the backend lookups */ | |||
| b->flr=_ogg_calloc(ci->floors,sizeof(*b->flr)); | |||
| b->residue=_ogg_calloc(ci->residues,sizeof(*b->residue)); | |||
| b->flr=(vorbis_look_floor**)_ogg_calloc(ci->floors,sizeof(*b->flr)); | |||
| b->residue=(vorbis_look_residue**)_ogg_calloc(ci->residues,sizeof(*b->residue)); | |||
| for(i=0;i<ci->floors;i++) | |||
| b->flr[i]=_floor_P[ci->floor_type[i]]-> | |||
| @@ -287,11 +277,11 @@ int vorbis_analysis_init(vorbis_dsp_state *v,vorbis_info *vi){ | |||
| private_state *b=NULL; | |||
| if(_vds_shared_init(v,vi,1))return 1; | |||
| b=v->backend_state; | |||
| b=(private_state*)v->backend_state; | |||
| b->psy_g_look=_vp_global_look(vi); | |||
| /* Initialize the envelope state storage */ | |||
| b->ve=_ogg_calloc(1,sizeof(*b->ve)); | |||
| b->ve=(envelope_lookup*)_ogg_calloc(1,sizeof(*b->ve)); | |||
| _ve_envelope_init(b->ve,vi); | |||
| vorbis_bitrate_init(vi,&b->bms); | |||
| @@ -307,8 +297,8 @@ void vorbis_dsp_clear(vorbis_dsp_state *v){ | |||
| int i; | |||
| if(v){ | |||
| vorbis_info *vi=v->vi; | |||
| codec_setup_info *ci=(vi?vi->codec_setup:NULL); | |||
| private_state *b=v->backend_state; | |||
| codec_setup_info *ci=(codec_setup_info*)(vi?vi->codec_setup:NULL); | |||
| private_state *b=(private_state*)v->backend_state; | |||
| if(b){ | |||
| @@ -318,12 +308,12 @@ void vorbis_dsp_clear(vorbis_dsp_state *v){ | |||
| } | |||
| if(b->transform[0]){ | |||
| mdct_clear(b->transform[0][0]); | |||
| mdct_clear((mdct_lookup*) b->transform[0][0]); | |||
| _ogg_free(b->transform[0][0]); | |||
| _ogg_free(b->transform[0]); | |||
| } | |||
| if(b->transform[1]){ | |||
| mdct_clear(b->transform[1][0]); | |||
| mdct_clear((mdct_lookup*) b->transform[1][0]); | |||
| _ogg_free(b->transform[1][0]); | |||
| _ogg_free(b->transform[1]); | |||
| } | |||
| @@ -376,7 +366,7 @@ void vorbis_dsp_clear(vorbis_dsp_state *v){ | |||
| float **vorbis_analysis_buffer(vorbis_dsp_state *v, int vals){ | |||
| int i; | |||
| vorbis_info *vi=v->vi; | |||
| private_state *b=v->backend_state; | |||
| private_state *b=(private_state*)v->backend_state; | |||
| /* free header, header1, header2 */ | |||
| if(b->header)_ogg_free(b->header);b->header=NULL; | |||
| @@ -390,7 +380,7 @@ float **vorbis_analysis_buffer(vorbis_dsp_state *v, int vals){ | |||
| v->pcm_storage=v->pcm_current+vals*2; | |||
| for(i=0;i<vi->channels;i++){ | |||
| v->pcm[i]=_ogg_realloc(v->pcm[i],v->pcm_storage*sizeof(*v->pcm[i])); | |||
| v->pcm[i]=(float*)_ogg_realloc(v->pcm[i],v->pcm_storage*sizeof(*v->pcm[i])); | |||
| } | |||
| } | |||
| @@ -403,8 +393,8 @@ float **vorbis_analysis_buffer(vorbis_dsp_state *v, int vals){ | |||
| static void _preextrapolate_helper(vorbis_dsp_state *v){ | |||
| int i; | |||
| int order=32; | |||
| float *lpc=alloca(order*sizeof(*lpc)); | |||
| float *work=alloca(v->pcm_current*sizeof(*work)); | |||
| float *lpc=(float*)alloca(order*sizeof(*lpc)); | |||
| float *work=(float*)alloca(v->pcm_current*sizeof(*work)); | |||
| long j; | |||
| v->preextrapolate=1; | |||
| @@ -435,12 +425,12 @@ static void _preextrapolate_helper(vorbis_dsp_state *v){ | |||
| int vorbis_analysis_wrote(vorbis_dsp_state *v, int vals){ | |||
| vorbis_info *vi=v->vi; | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info*)vi->codec_setup; | |||
| if(vals<=0){ | |||
| int order=32; | |||
| int i; | |||
| float *lpc=alloca(order*sizeof(*lpc)); | |||
| float *lpc=(float*) alloca(order*sizeof(*lpc)); | |||
| /* if it wasn't done earlier (very short sample) */ | |||
| if(!v->preextrapolate) | |||
| @@ -500,8 +490,8 @@ int vorbis_analysis_wrote(vorbis_dsp_state *v, int vals){ | |||
| int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb){ | |||
| int i; | |||
| vorbis_info *vi=v->vi; | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| private_state *b=v->backend_state; | |||
| codec_setup_info *ci=(codec_setup_info*)vi->codec_setup; | |||
| private_state *b=(private_state*)v->backend_state; | |||
| vorbis_look_psy_global *g=b->psy_g_look; | |||
| long beginW=v->centerW-ci->blocksizes[v->W]/2,centerNext; | |||
| vorbis_block_internal *vbi=(vorbis_block_internal *)vb->internal; | |||
| @@ -593,11 +583,11 @@ int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb){ | |||
| g->ampmax=_vp_ampmax_decay(g->ampmax,v); | |||
| vbi->ampmax=g->ampmax; | |||
| vb->pcm=_vorbis_block_alloc(vb,sizeof(*vb->pcm)*vi->channels); | |||
| vbi->pcmdelay=_vorbis_block_alloc(vb,sizeof(*vbi->pcmdelay)*vi->channels); | |||
| vb->pcm=(float**)_vorbis_block_alloc(vb,sizeof(*vb->pcm)*vi->channels); | |||
| vbi->pcmdelay=(float**)_vorbis_block_alloc(vb,sizeof(*vbi->pcmdelay)*vi->channels); | |||
| for(i=0;i<vi->channels;i++){ | |||
| vbi->pcmdelay[i]= | |||
| _vorbis_block_alloc(vb,(vb->pcmend+beginW)*sizeof(*vbi->pcmdelay[i])); | |||
| (float*) _vorbis_block_alloc(vb,(vb->pcmend+beginW)*sizeof(*vbi->pcmdelay[i])); | |||
| memcpy(vbi->pcmdelay[i],v->pcm[i],(vb->pcmend+beginW)*sizeof(*vbi->pcmdelay[i])); | |||
| vb->pcm[i]=vbi->pcmdelay[i]+beginW; | |||
| @@ -665,7 +655,7 @@ int vorbis_synthesis_restart(vorbis_dsp_state *v){ | |||
| if(!v->backend_state)return -1; | |||
| if(!vi)return -1; | |||
| ci=vi->codec_setup; | |||
| ci=(codec_setup_info*) vi->codec_setup; | |||
| if(!ci)return -1; | |||
| hs=ci->halfrate_flag; | |||
| @@ -694,8 +684,8 @@ int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi){ | |||
| int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){ | |||
| vorbis_info *vi=v->vi; | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| private_state *b=v->backend_state; | |||
| codec_setup_info *ci=(codec_setup_info*)vi->codec_setup; | |||
| private_state *b=(private_state*)v->backend_state; | |||
| int hs=ci->halfrate_flag; | |||
| int i,j; | |||
| @@ -907,7 +897,7 @@ int vorbis_synthesis_read(vorbis_dsp_state *v,int n){ | |||
| this implicit buffer data not normally decoded. */ | |||
| int vorbis_synthesis_lapout(vorbis_dsp_state *v,float ***pcm){ | |||
| vorbis_info *vi=v->vi; | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info *)vi->codec_setup; | |||
| int hs=ci->halfrate_flag; | |||
| int n=ci->blocksizes[v->W]>>(hs+1); | |||
| @@ -982,9 +972,9 @@ int vorbis_synthesis_lapout(vorbis_dsp_state *v,float ***pcm){ | |||
| float *vorbis_window(vorbis_dsp_state *v,int W){ | |||
| vorbis_info *vi=v->vi; | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info*) vi->codec_setup; | |||
| int hs=ci->halfrate_flag; | |||
| private_state *b=v->backend_state; | |||
| private_state *b=(private_state*)v->backend_state; | |||
| if(b->window[W]-1<0)return NULL; | |||
| return _vorbis_window_get(b->window[W]-hs); | |||
| @@ -57,10 +57,10 @@ int vorbis_staticbook_pack(const static_codebook *c,oggpack_buffer *opb){ | |||
| oggpack_write(opb,c->lengthlist[0]-1,5); /* 1 to 32 */ | |||
| for(i=1;i<c->entries;i++){ | |||
| long this=c->lengthlist[i]; | |||
| long thisx=c->lengthlist[i]; | |||
| long last=c->lengthlist[i-1]; | |||
| if(this>last){ | |||
| for(j=last;j<this;j++){ | |||
| if(thisx>last){ | |||
| for(j=last;j<thisx;j++){ | |||
| oggpack_write(opb,i-count,_ilog(c->entries-count)); | |||
| count=i; | |||
| } | |||
| @@ -167,7 +167,7 @@ int vorbis_staticbook_unpack(oggpack_buffer *opb,static_codebook *s){ | |||
| switch((int)oggpack_read(opb,1)){ | |||
| case 0: | |||
| /* unordered */ | |||
| s->lengthlist=_ogg_malloc(sizeof(*s->lengthlist)*s->entries); | |||
| s->lengthlist=(long*)_ogg_malloc(sizeof(*s->lengthlist)*s->entries); | |||
| /* allocated but unused entries? */ | |||
| if(oggpack_read(opb,1)){ | |||
| @@ -195,7 +195,7 @@ int vorbis_staticbook_unpack(oggpack_buffer *opb,static_codebook *s){ | |||
| /* ordered */ | |||
| { | |||
| long length=oggpack_read(opb,5)+1; | |||
| s->lengthlist=_ogg_malloc(sizeof(*s->lengthlist)*s->entries); | |||
| s->lengthlist=(long*)_ogg_malloc(sizeof(*s->lengthlist)*s->entries); | |||
| for(i=0;i<s->entries;){ | |||
| long num=oggpack_read(opb,_ilog(s->entries-i)); | |||
| @@ -237,7 +237,7 @@ int vorbis_staticbook_unpack(oggpack_buffer *opb,static_codebook *s){ | |||
| } | |||
| /* quantized values */ | |||
| s->quantlist=_ogg_malloc(sizeof(*s->quantlist)*quantvals); | |||
| s->quantlist=(long*)_ogg_malloc(sizeof(*s->quantlist)*quantvals); | |||
| for(i=0;i<quantvals;i++) | |||
| s->quantlist[i]=oggpack_read(opb,s->q_quant); | |||
| @@ -302,13 +302,6 @@ int vorbis_book_encodev(codebook *book,int best,float *a,oggpack_buffer *b){ | |||
| be. The first-stage decode table catches most words so that | |||
| bitreverse is not in the main execution path. */ | |||
| static ogg_uint32_t bitreverse(ogg_uint32_t x){ | |||
| x= ((x>>16)&0x0000ffff) | ((x<<16)&0xffff0000); | |||
| x= ((x>> 8)&0x00ff00ff) | ((x<< 8)&0xff00ff00); | |||
| x= ((x>> 4)&0x0f0f0f0f) | ((x<< 4)&0xf0f0f0f0); | |||
| x= ((x>> 2)&0x33333333) | ((x<< 2)&0xcccccccc); | |||
| return((x>> 1)&0x55555555) | ((x<< 1)&0xaaaaaaaa); | |||
| } | |||
| STIN long decode_packed_entry_number(codebook *book, oggpack_buffer *b){ | |||
| int read=book->dec_maxlength; | |||
| @@ -383,8 +376,8 @@ long vorbis_book_decode(codebook *book, oggpack_buffer *b){ | |||
| /* returns 0 on OK or -1 on eof *************************************/ | |||
| long vorbis_book_decodevs_add(codebook *book,float *a,oggpack_buffer *b,int n){ | |||
| int step=n/book->dim; | |||
| long *entry = alloca(sizeof(*entry)*step); | |||
| float **t = alloca(sizeof(*t)*step); | |||
| long *entry = (long*)alloca(sizeof(*entry)*step); | |||
| float **t = (float**)alloca(sizeof(*t)*step); | |||
| int i,j,o; | |||
| for (i = 0; i < step; i++) { | |||
| @@ -58,6 +58,26 @@ typedef void vorbis_info_mapping; | |||
| #include "psy.h" | |||
| #include "bitrate.h" | |||
| static int ilog(unsigned int v){ | |||
| int ret=0; | |||
| while(v){ | |||
| ret++; | |||
| v>>=1; | |||
| } | |||
| return(ret); | |||
| } | |||
| static int ilog2(unsigned int v){ | |||
| int ret=0; | |||
| if(v)--v; | |||
| while(v){ | |||
| ret++; | |||
| v>>=1; | |||
| } | |||
| return(ret); | |||
| } | |||
| typedef struct private_state { | |||
| /* local lookup storage */ | |||
| envelope_lookup *ve; /* envelope lookup */ | |||
| @@ -34,7 +34,7 @@ | |||
| #include "misc.h" | |||
| void _ve_envelope_init(envelope_lookup *e,vorbis_info *vi){ | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info*)vi->codec_setup; | |||
| vorbis_info_psy_global *gi=&ci->psy_g_param; | |||
| int ch=vi->channels; | |||
| int i,j; | |||
| @@ -45,7 +45,7 @@ void _ve_envelope_init(envelope_lookup *e,vorbis_info *vi){ | |||
| e->ch=ch; | |||
| e->storage=128; | |||
| e->cursor=ci->blocksizes[1]/2; | |||
| e->mdct_win=_ogg_calloc(n,sizeof(*e->mdct_win)); | |||
| e->mdct_win=(float*)_ogg_calloc(n,sizeof(*e->mdct_win)); | |||
| mdct_init(&e->mdct,n); | |||
| for(i=0;i<n;i++){ | |||
| @@ -64,7 +64,7 @@ void _ve_envelope_init(envelope_lookup *e,vorbis_info *vi){ | |||
| for(j=0;j<VE_BANDS;j++){ | |||
| n=e->band[j].end; | |||
| e->band[j].window=_ogg_malloc(n*sizeof(*e->band[0].window)); | |||
| e->band[j].window=(float*)_ogg_malloc(n*sizeof(*e->band[0].window)); | |||
| for(i=0;i<n;i++){ | |||
| e->band[j].window[i]=sin((i+.5)/n*M_PI); | |||
| e->band[j].total+=e->band[j].window[i]; | |||
| @@ -72,8 +72,8 @@ void _ve_envelope_init(envelope_lookup *e,vorbis_info *vi){ | |||
| e->band[j].total=1./e->band[j].total; | |||
| } | |||
| e->filter=_ogg_calloc(VE_BANDS*ch,sizeof(*e->filter)); | |||
| e->mark=_ogg_calloc(e->storage,sizeof(*e->mark)); | |||
| e->filter=(envelope_filter_state*)_ogg_calloc(VE_BANDS*ch,sizeof(*e->filter)); | |||
| e->mark=(int*)_ogg_calloc(e->storage,sizeof(*e->mark)); | |||
| } | |||
| @@ -107,7 +107,7 @@ static int _ve_amp(envelope_lookup *ve, | |||
| itself (for low power signals) */ | |||
| float minV=ve->minenergy; | |||
| float *vec=alloca(n*sizeof(*vec)); | |||
| float *vec=(float*) alloca(n*sizeof(*vec)); | |||
| /* stretch is used to gradually lengthen the number of windows | |||
| considered prevoius-to-potential-trigger */ | |||
| @@ -177,10 +177,10 @@ static int _ve_amp(envelope_lookup *ve, | |||
| /* convert amplitude to delta */ | |||
| { | |||
| int p,this=filters[j].ampptr; | |||
| int p,thisx=filters[j].ampptr; | |||
| float postmax,postmin,premax=-99999.f,premin=99999.f; | |||
| p=this; | |||
| p=thisx; | |||
| p--; | |||
| if(p<0)p+=VE_AMP; | |||
| postmax=max(acc,filters[j].ampbuf[p]); | |||
| @@ -197,7 +197,7 @@ static int _ve_amp(envelope_lookup *ve, | |||
| valmax=postmax-premax; | |||
| /*filters[j].markers[pos]=valmax;*/ | |||
| filters[j].ampbuf[this]=acc; | |||
| filters[j].ampbuf[thisx]=acc; | |||
| filters[j].ampptr++; | |||
| if(filters[j].ampptr>=VE_AMP)filters[j].ampptr=0; | |||
| } | |||
| @@ -220,7 +220,7 @@ static ogg_int64_t totalshift=-1024; | |||
| long _ve_envelope_search(vorbis_dsp_state *v){ | |||
| vorbis_info *vi=v->vi; | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info *)vi->codec_setup; | |||
| vorbis_info_psy_global *gi=&ci->psy_g_param; | |||
| envelope_lookup *ve=((private_state *)(v->backend_state))->ve; | |||
| long i,j; | |||
| @@ -232,7 +232,7 @@ long _ve_envelope_search(vorbis_dsp_state *v){ | |||
| /* make sure we have enough storage to match the PCM */ | |||
| if(last+VE_WIN+VE_POST>ve->storage){ | |||
| ve->storage=last+VE_WIN+VE_POST; /* be sure */ | |||
| ve->mark=_ogg_realloc(ve->mark,ve->storage*sizeof(*ve->mark)); | |||
| ve->mark=(int*)_ogg_realloc(ve->mark,ve->storage*sizeof(*ve->mark)); | |||
| } | |||
| for(j=first;j<last;j++){ | |||
| @@ -335,7 +335,7 @@ long _ve_envelope_search(vorbis_dsp_state *v){ | |||
| int _ve_envelope_mark(vorbis_dsp_state *v){ | |||
| envelope_lookup *ve=((private_state *)(v->backend_state))->ve; | |||
| vorbis_info *vi=v->vi; | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info*)vi->codec_setup; | |||
| long centerW=v->centerW; | |||
| long beginW=centerW-ci->blocksizes[v->W]/4; | |||
| long endW=centerW+ci->blocksizes[v->W]/4; | |||
| @@ -76,10 +76,10 @@ static void floor0_free_look(vorbis_look_floor *i){ | |||
| } | |||
| static vorbis_info_floor *floor0_unpack (vorbis_info *vi,oggpack_buffer *opb){ | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info*)vi->codec_setup; | |||
| int j; | |||
| vorbis_info_floor0 *info=_ogg_malloc(sizeof(*info)); | |||
| vorbis_info_floor0 *info=(vorbis_info_floor0*)_ogg_malloc(sizeof(*info)); | |||
| info->order=oggpack_read(opb,8); | |||
| info->rate=oggpack_read(opb,16); | |||
| info->barkmap=oggpack_read(opb,16); | |||
| @@ -117,7 +117,7 @@ static void floor0_map_lazy_init(vorbis_block *vb, | |||
| if(!look->linearmap[vb->W]){ | |||
| vorbis_dsp_state *vd=vb->vd; | |||
| vorbis_info *vi=vd->vi; | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info*)vi->codec_setup; | |||
| vorbis_info_floor0 *info=(vorbis_info_floor0 *)infoX; | |||
| int W=vb->W; | |||
| int n=ci->blocksizes[W]/2,j; | |||
| @@ -133,7 +133,7 @@ static void floor0_map_lazy_init(vorbis_block *vb, | |||
| the encoder may do what it wishes in filling them. They're | |||
| necessary in some mapping combinations to keep the scale spacing | |||
| accurate */ | |||
| look->linearmap[W]=_ogg_malloc((n+1)*sizeof(**look->linearmap)); | |||
| look->linearmap[W]=(int*)_ogg_malloc((n+1)*sizeof(**look->linearmap)); | |||
| for(j=0;j<n;j++){ | |||
| int val=floor( toBARK((info->rate/2.f)/n*j) | |||
| *scale); /* bark numbers represent band edges */ | |||
| @@ -147,13 +147,13 @@ static void floor0_map_lazy_init(vorbis_block *vb, | |||
| static vorbis_look_floor *floor0_look(vorbis_dsp_state *vd, | |||
| vorbis_info_floor *i){ | |||
| vorbis_info_floor0 *info=(vorbis_info_floor0 *)i; | |||
| vorbis_look_floor0 *look=_ogg_calloc(1,sizeof(*look)); | |||
| vorbis_info_floor0 *info=(vorbis_info_floor0*)i; | |||
| vorbis_look_floor0 *look=(vorbis_look_floor0*)_ogg_calloc(1,sizeof(*look)); | |||
| look->m=info->order; | |||
| look->ln=info->barkmap; | |||
| look->vi=info; | |||
| look->linearmap=_ogg_calloc(2,sizeof(*look->linearmap)); | |||
| look->linearmap=(int**)_ogg_calloc(2,sizeof(*look->linearmap)); | |||
| return look; | |||
| } | |||
| @@ -170,14 +170,14 @@ static void *floor0_inverse1(vorbis_block *vb,vorbis_look_floor *i){ | |||
| int booknum=oggpack_read(&vb->opb,_ilog(info->numbooks)); | |||
| if(booknum!=-1 && booknum<info->numbooks){ /* be paranoid */ | |||
| codec_setup_info *ci=vb->vd->vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info *)vb->vd->vi->codec_setup; | |||
| codebook *b=ci->fullbooks+info->books[booknum]; | |||
| float last=0.f; | |||
| /* the additional b->dim is a guard against any possible stack | |||
| smash; b->dim is provably more than we can overflow the | |||
| vector */ | |||
| float *lsp=_vorbis_block_alloc(vb,sizeof(*lsp)*(look->m+b->dim+1)); | |||
| float *lsp=(float*)_vorbis_block_alloc(vb,sizeof(*lsp)*(look->m+b->dim+1)); | |||
| for(j=0;j<look->m;j+=b->dim) | |||
| if(vorbis_book_decodev_set(b,lsp+j,&vb->opb,b->dim)==-1)goto eop; | |||
| @@ -87,25 +87,6 @@ static void floor1_free_look(vorbis_look_floor *i){ | |||
| } | |||
| } | |||
| static int ilog(unsigned int v){ | |||
| int ret=0; | |||
| while(v){ | |||
| ret++; | |||
| v>>=1; | |||
| } | |||
| return(ret); | |||
| } | |||
| static int ilog2(unsigned int v){ | |||
| int ret=0; | |||
| if(v)--v; | |||
| while(v){ | |||
| ret++; | |||
| v>>=1; | |||
| } | |||
| return(ret); | |||
| } | |||
| static void floor1_pack (vorbis_info_floor *i,oggpack_buffer *opb){ | |||
| vorbis_info_floor1 *info=(vorbis_info_floor1 *)i; | |||
| int j,k; | |||
| @@ -144,10 +125,10 @@ static void floor1_pack (vorbis_info_floor *i,oggpack_buffer *opb){ | |||
| static vorbis_info_floor *floor1_unpack (vorbis_info *vi,oggpack_buffer *opb){ | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info*)vi->codec_setup; | |||
| int j,k,count=0,maxclass=-1,rangebits; | |||
| vorbis_info_floor1 *info=_ogg_calloc(1,sizeof(*info)); | |||
| vorbis_info_floor1 *info=(vorbis_info_floor1*)_ogg_calloc(1,sizeof(*info)); | |||
| /* read partitions */ | |||
| info->partitions=oggpack_read(opb,5); /* only 0 to 31 legal */ | |||
| for(j=0;j<info->partitions;j++){ | |||
| @@ -201,8 +182,8 @@ static vorbis_look_floor *floor1_look(vorbis_dsp_state *vd, | |||
| vorbis_info_floor *in){ | |||
| int *sortpointer[VIF_POSIT+2]; | |||
| vorbis_info_floor1 *info=(vorbis_info_floor1 *)in; | |||
| vorbis_look_floor1 *look=_ogg_calloc(1,sizeof(*look)); | |||
| vorbis_info_floor1 *info=(vorbis_info_floor1*)in; | |||
| vorbis_look_floor1 *look=(vorbis_look_floor1*)_ogg_calloc(1,sizeof(*look)); | |||
| int i,j,n=0; | |||
| look->vi=info; | |||
| @@ -593,10 +574,11 @@ static int post_Y(int *A,int *B,int pos){ | |||
| return (A[pos]+B[pos])>>1; | |||
| } | |||
| int *floor1_fit(vorbis_block *vb,vorbis_look_floor1 *look, | |||
| int *floor1_fit(vorbis_block *vb,void *look_, | |||
| const float *logmdct, /* in */ | |||
| const float *logmask){ | |||
| long i,j; | |||
| vorbis_look_floor1 *look = (vorbis_look_floor1*) look_; | |||
| vorbis_info_floor1 *info=look->vi; | |||
| long n=look->n; | |||
| long posts=look->posts; | |||
| @@ -705,7 +687,7 @@ int *floor1_fit(vorbis_block *vb,vorbis_look_floor1 *look, | |||
| } | |||
| } | |||
| output=_vorbis_block_alloc(vb,sizeof(*output)*posts); | |||
| output=(int*)_vorbis_block_alloc(vb,sizeof(*output)*posts); | |||
| output[0]=post_Y(fit_valueA,fit_valueB,0); | |||
| output[1]=post_Y(fit_valueA,fit_valueB,1); | |||
| @@ -736,16 +718,17 @@ int *floor1_fit(vorbis_block *vb,vorbis_look_floor1 *look, | |||
| } | |||
| int *floor1_interpolate_fit(vorbis_block *vb,vorbis_look_floor1 *look, | |||
| int *floor1_interpolate_fit(vorbis_block *vb,void *look_, | |||
| int *A,int *B, | |||
| int del){ | |||
| long i; | |||
| vorbis_look_floor1* look = (vorbis_look_floor1*) look_; | |||
| long posts=look->posts; | |||
| int *output=NULL; | |||
| if(A && B){ | |||
| output=_vorbis_block_alloc(vb,sizeof(*output)*posts); | |||
| output=(int*)_vorbis_block_alloc(vb,sizeof(*output)*posts); | |||
| for(i=0;i<posts;i++){ | |||
| output[i]=((65536-del)*(A[i]&0x7fff)+del*(B[i]&0x7fff)+32768)>>16; | |||
| @@ -758,13 +741,14 @@ int *floor1_interpolate_fit(vorbis_block *vb,vorbis_look_floor1 *look, | |||
| int floor1_encode(oggpack_buffer *opb,vorbis_block *vb, | |||
| vorbis_look_floor1 *look, | |||
| void*look_, | |||
| int *post,int *ilogmask){ | |||
| long i,j; | |||
| vorbis_look_floor1 *look = (vorbis_look_floor1 *) look_; | |||
| vorbis_info_floor1 *info=look->vi; | |||
| long posts=look->posts; | |||
| codec_setup_info *ci=vb->vd->vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info*)vb->vd->vi->codec_setup; | |||
| int out[VIF_POSIT+2]; | |||
| static_codebook **sbooks=ci->book_param; | |||
| codebook *books=ci->fullbooks; | |||
| @@ -851,9 +835,9 @@ int floor1_encode(oggpack_buffer *opb,vorbis_block *vb, | |||
| /* partition by partition */ | |||
| for(i=0,j=2;i<info->partitions;i++){ | |||
| int class=info->partitionclass[i]; | |||
| int cdim=info->class_dim[class]; | |||
| int csubbits=info->class_subs[class]; | |||
| int classx=info->partitionclass[i]; | |||
| int cdim=info->class_dim[classx]; | |||
| int csubbits=info->class_subs[classx]; | |||
| int csub=1<<csubbits; | |||
| int bookas[8]={0,0,0,0,0,0,0,0}; | |||
| int cval=0; | |||
| @@ -864,11 +848,11 @@ int floor1_encode(oggpack_buffer *opb,vorbis_block *vb, | |||
| if(csubbits){ | |||
| int maxval[8]; | |||
| for(k=0;k<csub;k++){ | |||
| int booknum=info->class_subbook[class][k]; | |||
| int booknum=info->class_subbook[classx][k]; | |||
| if(booknum<0){ | |||
| maxval[k]=1; | |||
| }else{ | |||
| maxval[k]=sbooks[info->class_subbook[class][k]]->entries; | |||
| maxval[k]=sbooks[info->class_subbook[classx][k]]->entries; | |||
| } | |||
| } | |||
| for(k=0;k<cdim;k++){ | |||
| @@ -884,7 +868,7 @@ int floor1_encode(oggpack_buffer *opb,vorbis_block *vb, | |||
| } | |||
| /* write it */ | |||
| look->phrasebits+= | |||
| vorbis_book_encode(books+info->class_book[class],cval,opb); | |||
| vorbis_book_encode(books+info->class_book[classx],cval,opb); | |||
| #ifdef TRAIN_FLOOR1 | |||
| { | |||
| @@ -901,7 +885,7 @@ int floor1_encode(oggpack_buffer *opb,vorbis_block *vb, | |||
| /* write post values */ | |||
| for(k=0;k<cdim;k++){ | |||
| int book=info->class_subbook[class][bookas[k]]; | |||
| int book=info->class_subbook[classx][bookas[k]]; | |||
| if(book>=0){ | |||
| /* hack to allow training with 'bad' books */ | |||
| if(out[j+k]<(books+book)->entries) | |||
| @@ -961,35 +945,35 @@ int floor1_encode(oggpack_buffer *opb,vorbis_block *vb, | |||
| static void *floor1_inverse1(vorbis_block *vb,vorbis_look_floor *in){ | |||
| vorbis_look_floor1 *look=(vorbis_look_floor1 *)in; | |||
| vorbis_info_floor1 *info=look->vi; | |||
| codec_setup_info *ci=vb->vd->vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info*)vb->vd->vi->codec_setup; | |||
| int i,j,k; | |||
| codebook *books=ci->fullbooks; | |||
| /* unpack wrapped/predicted values from stream */ | |||
| if(oggpack_read(&vb->opb,1)==1){ | |||
| int *fit_value=_vorbis_block_alloc(vb,(look->posts)*sizeof(*fit_value)); | |||
| int *fit_value=(int*)_vorbis_block_alloc(vb,(look->posts)*sizeof(*fit_value)); | |||
| fit_value[0]=oggpack_read(&vb->opb,ilog(look->quant_q-1)); | |||
| fit_value[1]=oggpack_read(&vb->opb,ilog(look->quant_q-1)); | |||
| /* partition by partition */ | |||
| for(i=0,j=2;i<info->partitions;i++){ | |||
| int class=info->partitionclass[i]; | |||
| int cdim=info->class_dim[class]; | |||
| int csubbits=info->class_subs[class]; | |||
| int classx=info->partitionclass[i]; | |||
| int cdim=info->class_dim[classx]; | |||
| int csubbits=info->class_subs[classx]; | |||
| int csub=1<<csubbits; | |||
| int cval=0; | |||
| /* decode the partition's first stage cascade value */ | |||
| if(csubbits){ | |||
| cval=vorbis_book_decode(books+info->class_book[class],&vb->opb); | |||
| cval=vorbis_book_decode(books+info->class_book[classx],&vb->opb); | |||
| if(cval==-1)goto eop; | |||
| } | |||
| for(k=0;k<cdim;k++){ | |||
| int book=info->class_subbook[class][cval&(csub-1)]; | |||
| int book=info->class_subbook[classx][cval&(csub-1)]; | |||
| cval>>=csubbits; | |||
| if(book>=0){ | |||
| if((fit_value[j+k]=vorbis_book_decode(books+book,&vb->opb))==-1) | |||
| @@ -1049,7 +1033,7 @@ static int floor1_inverse2(vorbis_block *vb,vorbis_look_floor *in,void *memo, | |||
| vorbis_look_floor1 *look=(vorbis_look_floor1 *)in; | |||
| vorbis_info_floor1 *info=look->vi; | |||
| codec_setup_info *ci=vb->vd->vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info*)vb->vd->vi->codec_setup; | |||
| int n=ci->blocksizes[vb->W]/2; | |||
| int j; | |||
| @@ -34,16 +34,6 @@ | |||
| #include "misc.h" | |||
| #include "os.h" | |||
| /* helpers */ | |||
| static int ilog2(unsigned int v){ | |||
| int ret=0; | |||
| if(v)--v; | |||
| while(v){ | |||
| ret++; | |||
| v>>=1; | |||
| } | |||
| return(ret); | |||
| } | |||
| static void _v_writestring(oggpack_buffer *o,char *s, int bytes){ | |||
| @@ -63,19 +53,19 @@ void vorbis_comment_init(vorbis_comment *vc){ | |||
| } | |||
| void vorbis_comment_add(vorbis_comment *vc,char *comment){ | |||
| vc->user_comments=_ogg_realloc(vc->user_comments, | |||
| vc->user_comments=(char**)_ogg_realloc(vc->user_comments, | |||
| (vc->comments+2)*sizeof(*vc->user_comments)); | |||
| vc->comment_lengths=_ogg_realloc(vc->comment_lengths, | |||
| vc->comment_lengths=(int*)_ogg_realloc(vc->comment_lengths, | |||
| (vc->comments+2)*sizeof(*vc->comment_lengths)); | |||
| vc->comment_lengths[vc->comments]=strlen(comment); | |||
| vc->user_comments[vc->comments]=_ogg_malloc(vc->comment_lengths[vc->comments]+1); | |||
| vc->user_comments[vc->comments]=(char*)_ogg_malloc(vc->comment_lengths[vc->comments]+1); | |||
| strcpy(vc->user_comments[vc->comments], comment); | |||
| vc->comments++; | |||
| vc->user_comments[vc->comments]=NULL; | |||
| } | |||
| void vorbis_comment_add_tag(vorbis_comment *vc, char *tag, char *contents){ | |||
| char *comment=alloca(strlen(tag)+strlen(contents)+2); /* +2 for = and \0 */ | |||
| char *comment=(char*)alloca(strlen(tag)+strlen(contents)+2); /* +2 for = and \0 */ | |||
| strcpy(comment, tag); | |||
| strcat(comment, "="); | |||
| strcat(comment, contents); | |||
| @@ -98,7 +88,7 @@ char *vorbis_comment_query(vorbis_comment *vc, char *tag, int count){ | |||
| long i; | |||
| int found = 0; | |||
| int taglen = strlen(tag)+1; /* +1 for the = we append */ | |||
| char *fulltag = alloca(taglen+ 1); | |||
| char *fulltag = (char*)alloca(taglen+ 1); | |||
| strcpy(fulltag, tag); | |||
| strcat(fulltag, "="); | |||
| @@ -118,7 +108,7 @@ char *vorbis_comment_query(vorbis_comment *vc, char *tag, int count){ | |||
| int vorbis_comment_query_count(vorbis_comment *vc, char *tag){ | |||
| int i,count=0; | |||
| int taglen = strlen(tag)+1; /* +1 for the = we append */ | |||
| char *fulltag = alloca(taglen+1); | |||
| char *fulltag = (char*)alloca(taglen+1); | |||
| strcpy(fulltag,tag); | |||
| strcat(fulltag, "="); | |||
| @@ -145,7 +135,7 @@ void vorbis_comment_clear(vorbis_comment *vc){ | |||
| /* blocksize 0 is guaranteed to be short, 1 is guarantted to be long. | |||
| They may be equal, but short will never ge greater than long */ | |||
| int vorbis_info_blocksize(vorbis_info *vi,int zo){ | |||
| codec_setup_info *ci = vi->codec_setup; | |||
| codec_setup_info *ci = (codec_setup_info*)vi->codec_setup; | |||
| return ci ? ci->blocksizes[zo] : -1; | |||
| } | |||
| @@ -156,7 +146,7 @@ void vorbis_info_init(vorbis_info *vi){ | |||
| } | |||
| void vorbis_info_clear(vorbis_info *vi){ | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info*)vi->codec_setup; | |||
| int i; | |||
| if(ci){ | |||
| @@ -196,7 +186,7 @@ void vorbis_info_clear(vorbis_info *vi){ | |||
| /* Header packing/unpacking ********************************************/ | |||
| static int _vorbis_unpack_info(vorbis_info *vi,oggpack_buffer *opb){ | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info*)vi->codec_setup; | |||
| if(!ci)return(OV_EFAULT); | |||
| vi->version=oggpack_read(opb,32); | |||
| @@ -229,18 +219,18 @@ static int _vorbis_unpack_comment(vorbis_comment *vc,oggpack_buffer *opb){ | |||
| int i; | |||
| int vendorlen=oggpack_read(opb,32); | |||
| if(vendorlen<0)goto err_out; | |||
| vc->vendor=_ogg_calloc(vendorlen+1,1); | |||
| vc->vendor=(char*)_ogg_calloc(vendorlen+1,1); | |||
| _v_readstring(opb,vc->vendor,vendorlen); | |||
| vc->comments=oggpack_read(opb,32); | |||
| if(vc->comments<0)goto err_out; | |||
| vc->user_comments=_ogg_calloc(vc->comments+1,sizeof(*vc->user_comments)); | |||
| vc->comment_lengths=_ogg_calloc(vc->comments+1, sizeof(*vc->comment_lengths)); | |||
| vc->user_comments=(char**)_ogg_calloc(vc->comments+1,sizeof(*vc->user_comments)); | |||
| vc->comment_lengths=(int*)_ogg_calloc(vc->comments+1, sizeof(*vc->comment_lengths)); | |||
| for(i=0;i<vc->comments;i++){ | |||
| int len=oggpack_read(opb,32); | |||
| if(len<0)goto err_out; | |||
| vc->comment_lengths[i]=len; | |||
| vc->user_comments[i]=_ogg_calloc(len+1,1); | |||
| vc->user_comments[i]=(char*)_ogg_calloc(len+1,1); | |||
| _v_readstring(opb,vc->user_comments[i],len); | |||
| } | |||
| if(oggpack_read(opb,1)!=1)goto err_out; /* EOP check */ | |||
| @@ -254,7 +244,7 @@ static int _vorbis_unpack_comment(vorbis_comment *vc,oggpack_buffer *opb){ | |||
| /* all of the real encoding details are here. The modes, books, | |||
| everything */ | |||
| static int _vorbis_unpack_books(vorbis_info *vi,oggpack_buffer *opb){ | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info*)vi->codec_setup; | |||
| int i; | |||
| if(!ci)return(OV_EFAULT); | |||
| @@ -262,7 +252,7 @@ static int _vorbis_unpack_books(vorbis_info *vi,oggpack_buffer *opb){ | |||
| ci->books=oggpack_read(opb,8)+1; | |||
| /*ci->book_param=_ogg_calloc(ci->books,sizeof(*ci->book_param));*/ | |||
| for(i=0;i<ci->books;i++){ | |||
| ci->book_param[i]=_ogg_calloc(1,sizeof(*ci->book_param[i])); | |||
| ci->book_param[i]=(static_codebook*)_ogg_calloc(1,sizeof(*ci->book_param[i])); | |||
| if(vorbis_staticbook_unpack(opb,ci->book_param[i]))goto err_out; | |||
| } | |||
| @@ -312,7 +302,7 @@ static int _vorbis_unpack_books(vorbis_info *vi,oggpack_buffer *opb){ | |||
| ci->modes=oggpack_read(opb,6)+1; | |||
| /*vi->mode_param=_ogg_calloc(vi->modes,sizeof(void *));*/ | |||
| for(i=0;i<ci->modes;i++){ | |||
| ci->mode_param[i]=_ogg_calloc(1,sizeof(*ci->mode_param[i])); | |||
| ci->mode_param[i]=(vorbis_info_mode*)_ogg_calloc(1,sizeof(*ci->mode_param[i])); | |||
| ci->mode_param[i]->blockflag=oggpack_read(opb,1); | |||
| ci->mode_param[i]->windowtype=oggpack_read(opb,16); | |||
| ci->mode_param[i]->transformtype=oggpack_read(opb,16); | |||
| @@ -395,7 +385,7 @@ int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,ogg_packet *op) | |||
| /* pack side **********************************************************/ | |||
| static int _vorbis_pack_info(oggpack_buffer *opb,vorbis_info *vi){ | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info*)vi->codec_setup; | |||
| if(!ci)return(OV_EFAULT); | |||
| /* preamble */ | |||
| @@ -450,7 +440,7 @@ static int _vorbis_pack_comment(oggpack_buffer *opb,vorbis_comment *vc){ | |||
| } | |||
| static int _vorbis_pack_books(oggpack_buffer *opb,vorbis_info *vi){ | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info*)vi->codec_setup; | |||
| int i; | |||
| if(!ci)return(OV_EFAULT); | |||
| @@ -513,7 +503,7 @@ int vorbis_commentheader_out(vorbis_comment *vc, | |||
| oggpack_writeinit(&opb); | |||
| if(_vorbis_pack_comment(&opb,vc)) return OV_EIMPL; | |||
| op->packet = _ogg_malloc(oggpack_bytes(&opb)); | |||
| op->packet = (unsigned char*) _ogg_malloc(oggpack_bytes(&opb)); | |||
| memcpy(op->packet, opb.buffer, oggpack_bytes(&opb)); | |||
| op->bytes=oggpack_bytes(&opb); | |||
| @@ -533,7 +523,7 @@ int vorbis_analysis_headerout(vorbis_dsp_state *v, | |||
| int ret=OV_EIMPL; | |||
| vorbis_info *vi=v->vi; | |||
| oggpack_buffer opb; | |||
| private_state *b=v->backend_state; | |||
| private_state *b=(private_state*)v->backend_state; | |||
| if(!b){ | |||
| ret=OV_EFAULT; | |||
| @@ -547,7 +537,7 @@ int vorbis_analysis_headerout(vorbis_dsp_state *v, | |||
| /* build the packet */ | |||
| if(b->header)_ogg_free(b->header); | |||
| b->header=_ogg_malloc(oggpack_bytes(&opb)); | |||
| b->header=(unsigned char*) _ogg_malloc(oggpack_bytes(&opb)); | |||
| memcpy(b->header,opb.buffer,oggpack_bytes(&opb)); | |||
| op->packet=b->header; | |||
| op->bytes=oggpack_bytes(&opb); | |||
| @@ -562,7 +552,7 @@ int vorbis_analysis_headerout(vorbis_dsp_state *v, | |||
| if(_vorbis_pack_comment(&opb,vc))goto err_out; | |||
| if(b->header1)_ogg_free(b->header1); | |||
| b->header1=_ogg_malloc(oggpack_bytes(&opb)); | |||
| b->header1=(unsigned char*) _ogg_malloc(oggpack_bytes(&opb)); | |||
| memcpy(b->header1,opb.buffer,oggpack_bytes(&opb)); | |||
| op_comm->packet=b->header1; | |||
| op_comm->bytes=oggpack_bytes(&opb); | |||
| @@ -577,7 +567,7 @@ int vorbis_analysis_headerout(vorbis_dsp_state *v, | |||
| if(_vorbis_pack_books(&opb,vi))goto err_out; | |||
| if(b->header2)_ogg_free(b->header2); | |||
| b->header2=_ogg_malloc(oggpack_bytes(&opb)); | |||
| b->header2=(unsigned char*) _ogg_malloc(oggpack_bytes(&opb)); | |||
| memcpy(b->header2,opb.buffer,oggpack_bytes(&opb)); | |||
| op_code->packet=b->header2; | |||
| op_code->bytes=oggpack_bytes(&opb); | |||
| @@ -62,8 +62,8 @@ Carsten Bormann | |||
| Output: m lpc coefficients, excitation energy */ | |||
| float vorbis_lpc_from_data(float *data,float *lpci,int n,int m){ | |||
| double *aut=alloca(sizeof(*aut)*(m+1)); | |||
| double *lpc=alloca(sizeof(*lpc)*(m)); | |||
| double *aut=(double*)alloca(sizeof(*aut)*(m+1)); | |||
| double *lpc=(double*)alloca(sizeof(*lpc)*(m)); | |||
| double error; | |||
| int i,j; | |||
| @@ -126,7 +126,7 @@ void vorbis_lpc_predict(float *coeff,float *prime,int m, | |||
| long i,j,o,p; | |||
| float y; | |||
| float *work=alloca(sizeof(*work)*(m+n)); | |||
| float *work=(float*)alloca(sizeof(*work)*(m+n)); | |||
| if(!prime) | |||
| for(i=0;i<m;i++) | |||
| @@ -313,11 +313,11 @@ static int comp(const void *a,const void *b){ | |||
| static int Laguerre_With_Deflation(float *a,int ord,float *r){ | |||
| int i,m; | |||
| double lastdelta=0.f; | |||
| double *defl=alloca(sizeof(*defl)*(ord+1)); | |||
| double *defl=(double*)alloca(sizeof(*defl)*(ord+1)); | |||
| for(i=0;i<=ord;i++)defl[i]=a[i]; | |||
| for(m=ord;m>0;m--){ | |||
| double new=0.f,delta; | |||
| double newx=0.f,delta; | |||
| /* iterate a root */ | |||
| while(1){ | |||
| @@ -325,9 +325,9 @@ static int Laguerre_With_Deflation(float *a,int ord,float *r){ | |||
| /* eval the polynomial and its first two derivatives */ | |||
| for(i=m;i>0;i--){ | |||
| ppp = new*ppp + pp; | |||
| pp = new*pp + p; | |||
| p = new*p + defl[i-1]; | |||
| ppp = newx*ppp + pp; | |||
| pp = newx*pp + p; | |||
| p = newx*p + defl[i-1]; | |||
| } | |||
| /* Laguerre's method */ | |||
| @@ -344,20 +344,20 @@ static int Laguerre_With_Deflation(float *a,int ord,float *r){ | |||
| } | |||
| delta = m*p/denom; | |||
| new -= delta; | |||
| newx -= delta; | |||
| if(delta<0.f)delta*=-1; | |||
| if(fabs(delta/new)<10e-12)break; | |||
| if(fabs(delta/newx)<10e-12)break; | |||
| lastdelta=delta; | |||
| } | |||
| r[m-1]=new; | |||
| r[m-1]=newx; | |||
| /* forward deflation */ | |||
| for(i=m;i>0;i--) | |||
| defl[i-1]+=new*defl[i]; | |||
| defl[i-1]+=newx*defl[i]; | |||
| defl++; | |||
| } | |||
| @@ -369,7 +369,7 @@ static int Laguerre_With_Deflation(float *a,int ord,float *r){ | |||
| static int Newton_Raphson(float *a,int ord,float *r){ | |||
| int i, k, count=0; | |||
| double error=1.f; | |||
| double *root=alloca(ord*sizeof(*root)); | |||
| double *root=(double*)alloca(ord*sizeof(*root)); | |||
| for(i=0; i<ord;i++) root[i] = r[i]; | |||
| @@ -408,10 +408,10 @@ static int Newton_Raphson(float *a,int ord,float *r){ | |||
| int vorbis_lpc_to_lsp(float *lpc,float *lsp,int m){ | |||
| int order2=(m+1)>>1; | |||
| int g1_order,g2_order; | |||
| float *g1=alloca(sizeof(*g1)*(order2+1)); | |||
| float *g2=alloca(sizeof(*g2)*(order2+1)); | |||
| float *g1r=alloca(sizeof(*g1r)*(order2+1)); | |||
| float *g2r=alloca(sizeof(*g2r)*(order2+1)); | |||
| float *g1=(float*)alloca(sizeof(*g1)*(order2+1)); | |||
| float *g2=(float*)alloca(sizeof(*g2)*(order2+1)); | |||
| float *g1r=(float*)alloca(sizeof(*g1r)*(order2+1)); | |||
| float *g2r=(float*)alloca(sizeof(*g2r)*(order2+1)); | |||
| int i; | |||
| /* even and odd are slightly different base cases */ | |||
| @@ -48,16 +48,6 @@ static void mapping0_free_info(vorbis_info_mapping *i){ | |||
| } | |||
| } | |||
| static int ilog(unsigned int v){ | |||
| int ret=0; | |||
| if(v)--v; | |||
| while(v){ | |||
| ret++; | |||
| v>>=1; | |||
| } | |||
| return(ret); | |||
| } | |||
| static void mapping0_pack(vorbis_info *vi,vorbis_info_mapping *vm, | |||
| oggpack_buffer *opb){ | |||
| int i; | |||
| @@ -104,8 +94,8 @@ static void mapping0_pack(vorbis_info *vi,vorbis_info_mapping *vm, | |||
| /* also responsible for range checking */ | |||
| static vorbis_info_mapping *mapping0_unpack(vorbis_info *vi,oggpack_buffer *opb){ | |||
| int i; | |||
| vorbis_info_mapping0 *info=_ogg_calloc(1,sizeof(*info)); | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| vorbis_info_mapping0 *info=(vorbis_info_mapping0*)_ogg_calloc(1,sizeof(*info)); | |||
| codec_setup_info *ci=(codec_setup_info*)vi->codec_setup; | |||
| memset(info,0,sizeof(*info)); | |||
| if(oggpack_read(opb,1)) | |||
| @@ -232,37 +222,37 @@ static float FLOOR1_fromdB_LOOKUP[256]={ | |||
| #endif | |||
| extern int *floor1_fit(vorbis_block *vb,vorbis_look_floor *look, | |||
| extern int *floor1_fit(vorbis_block *vb,void *look, | |||
| const float *logmdct, /* in */ | |||
| const float *logmask); | |||
| extern int *floor1_interpolate_fit(vorbis_block *vb,vorbis_look_floor *look, | |||
| extern int *floor1_interpolate_fit(vorbis_block *vb,void *look, | |||
| int *A,int *B, | |||
| int del); | |||
| extern int floor1_encode(oggpack_buffer *opb,vorbis_block *vb, | |||
| vorbis_look_floor *look, | |||
| void*look, | |||
| int *post,int *ilogmask); | |||
| static int mapping0_forward(vorbis_block *vb){ | |||
| vorbis_dsp_state *vd=vb->vd; | |||
| vorbis_info *vi=vd->vi; | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| private_state *b=vb->vd->backend_state; | |||
| codec_setup_info *ci=(codec_setup_info*)vi->codec_setup; | |||
| private_state *b=(private_state*)vb->vd->backend_state; | |||
| vorbis_block_internal *vbi=(vorbis_block_internal *)vb->internal; | |||
| int n=vb->pcmend; | |||
| int i,j,k; | |||
| int *nonzero = alloca(sizeof(*nonzero)*vi->channels); | |||
| float **gmdct = _vorbis_block_alloc(vb,vi->channels*sizeof(*gmdct)); | |||
| int **ilogmaskch= _vorbis_block_alloc(vb,vi->channels*sizeof(*ilogmaskch)); | |||
| int ***floor_posts = _vorbis_block_alloc(vb,vi->channels*sizeof(*floor_posts)); | |||
| int *nonzero = (int*) alloca(sizeof(*nonzero)*vi->channels); | |||
| float **gmdct = (float**) _vorbis_block_alloc(vb,vi->channels*sizeof(*gmdct)); | |||
| int **ilogmaskch= (int**) _vorbis_block_alloc(vb,vi->channels*sizeof(*ilogmaskch)); | |||
| int ***floor_posts = (int***) _vorbis_block_alloc(vb,vi->channels*sizeof(*floor_posts)); | |||
| float global_ampmax=vbi->ampmax; | |||
| float *local_ampmax=alloca(sizeof(*local_ampmax)*vi->channels); | |||
| float *local_ampmax=(float*)alloca(sizeof(*local_ampmax)*vi->channels); | |||
| int blocktype=vbi->blocktype; | |||
| int modenumber=vb->W; | |||
| vorbis_info_mapping0 *info=ci->map_param[modenumber]; | |||
| vorbis_info_mapping0 *info=(vorbis_info_mapping0*)ci->map_param[modenumber]; | |||
| vorbis_look_psy *psy_look= | |||
| b->psy+blocktype+(vb->W?2:0); | |||
| @@ -275,7 +265,7 @@ static int mapping0_forward(vorbis_block *vb){ | |||
| float *pcm =vb->pcm[i]; | |||
| float *logfft =pcm; | |||
| gmdct[i]=_vorbis_block_alloc(vb,n/2*sizeof(**gmdct)); | |||
| gmdct[i]=(float*)_vorbis_block_alloc(vb,n/2*sizeof(**gmdct)); | |||
| scale_dB=todB(&scale) + .345; /* + .345 is a hack; the original | |||
| todB estimation used on IEEE 754 | |||
| @@ -313,7 +303,7 @@ static int mapping0_forward(vorbis_block *vb){ | |||
| /* transform the PCM data */ | |||
| /* only MDCT right now.... */ | |||
| mdct_forward(b->transform[vb->W][0],pcm,gmdct[i]); | |||
| mdct_forward((mdct_lookup*) b->transform[vb->W][0],pcm,gmdct[i]); | |||
| /* FFT yields more accurate tonal estimation (not phase sensitive) */ | |||
| drft_forward(&b->fft_look[vb->W],pcm); | |||
| @@ -368,8 +358,8 @@ static int mapping0_forward(vorbis_block *vb){ | |||
| } | |||
| { | |||
| float *noise = _vorbis_block_alloc(vb,n/2*sizeof(*noise)); | |||
| float *tone = _vorbis_block_alloc(vb,n/2*sizeof(*tone)); | |||
| float *noise = (float*) _vorbis_block_alloc(vb,n/2*sizeof(*noise)); | |||
| float *tone = (float*) _vorbis_block_alloc(vb,n/2*sizeof(*tone)); | |||
| for(i=0;i<vi->channels;i++){ | |||
| /* the encoder setup assumes that all the modes used by any | |||
| @@ -386,7 +376,7 @@ static int mapping0_forward(vorbis_block *vb){ | |||
| vb->mode=modenumber; | |||
| floor_posts[i]=_vorbis_block_alloc(vb,PACKETBLOBS*sizeof(**floor_posts)); | |||
| floor_posts[i]=(int**) _vorbis_block_alloc(vb,PACKETBLOBS*sizeof(**floor_posts)); | |||
| memset(floor_posts[i],0,sizeof(**floor_posts)*PACKETBLOBS); | |||
| for(j=0;j<n/2;j++) | |||
| @@ -585,10 +575,10 @@ static int mapping0_forward(vorbis_block *vb){ | |||
| /* iterate over the many masking curve fits we've created */ | |||
| { | |||
| float **res_bundle=alloca(sizeof(*res_bundle)*vi->channels); | |||
| float **couple_bundle=alloca(sizeof(*couple_bundle)*vi->channels); | |||
| int *zerobundle=alloca(sizeof(*zerobundle)*vi->channels); | |||
| int **sortindex=alloca(sizeof(*sortindex)*vi->channels); | |||
| float **res_bundle=(float**) alloca(sizeof(*res_bundle)*vi->channels); | |||
| float **couple_bundle=(float**) alloca(sizeof(*couple_bundle)*vi->channels); | |||
| int *zerobundle=(int*) alloca(sizeof(*zerobundle)*vi->channels); | |||
| int **sortindex=(int**) alloca(sizeof(*sortindex)*vi->channels); | |||
| float **mag_memo; | |||
| int **mag_sort; | |||
| @@ -614,7 +604,7 @@ static int mapping0_forward(vorbis_block *vb){ | |||
| if(psy_look->vi->normal_channel_p){ | |||
| for(i=0;i<vi->channels;i++){ | |||
| float *mdct =gmdct[i]; | |||
| sortindex[i]=alloca(sizeof(**sortindex)*n/2); | |||
| sortindex[i]=(int*) alloca(sizeof(**sortindex)*n/2); | |||
| _vp_noise_normalize_sort(psy_look,mdct,sortindex[i]); | |||
| } | |||
| } | |||
| @@ -641,7 +631,7 @@ static int mapping0_forward(vorbis_block *vb){ | |||
| float *mdct =gmdct[i]; | |||
| float *res =vb->pcm[i]; | |||
| int *ilogmask=ilogmaskch[i]= | |||
| _vorbis_block_alloc(vb,n/2*sizeof(**gmdct)); | |||
| (int*) _vorbis_block_alloc(vb,n/2*sizeof(**gmdct)); | |||
| nonzero[i]=floor1_encode(opb,vb,b->flr[info->floorsubmap[submap]], | |||
| floor_posts[i][k], | |||
| @@ -713,7 +703,7 @@ static int mapping0_forward(vorbis_block *vb){ | |||
| } | |||
| classifications=_residue_P[ci->residue_type[resnum]]-> | |||
| class(vb,b->residue[resnum],couple_bundle,zerobundle,ch_in_bundle); | |||
| classx(vb,b->residue[resnum],couple_bundle,zerobundle,ch_in_bundle); | |||
| _residue_P[ci->residue_type[resnum]]-> | |||
| forward(opb,vb,b->residue[resnum], | |||
| @@ -735,18 +725,18 @@ static int mapping0_forward(vorbis_block *vb){ | |||
| static int mapping0_inverse(vorbis_block *vb,vorbis_info_mapping *l){ | |||
| vorbis_dsp_state *vd=vb->vd; | |||
| vorbis_info *vi=vd->vi; | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| private_state *b=vd->backend_state; | |||
| codec_setup_info *ci=(codec_setup_info*) vi->codec_setup; | |||
| private_state *b=(private_state*)vd->backend_state; | |||
| vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)l; | |||
| int i,j; | |||
| long n=vb->pcmend=ci->blocksizes[vb->W]; | |||
| float **pcmbundle=alloca(sizeof(*pcmbundle)*vi->channels); | |||
| int *zerobundle=alloca(sizeof(*zerobundle)*vi->channels); | |||
| float **pcmbundle=(float**) alloca(sizeof(*pcmbundle)*vi->channels); | |||
| int *zerobundle=(int*) alloca(sizeof(*zerobundle)*vi->channels); | |||
| int *nonzero =alloca(sizeof(*nonzero)*vi->channels); | |||
| void **floormemo=alloca(sizeof(*floormemo)*vi->channels); | |||
| int *nonzero =(int*) alloca(sizeof(*nonzero)*vi->channels); | |||
| void **floormemo=(void**) alloca(sizeof(*floormemo)*vi->channels); | |||
| /* recover the spectral envelope; store it in the PCM vector for now */ | |||
| for(i=0;i<vi->channels;i++){ | |||
| @@ -828,7 +818,7 @@ static int mapping0_inverse(vorbis_block *vb,vorbis_info_mapping *l){ | |||
| /* only MDCT right now.... */ | |||
| for(i=0;i<vi->channels;i++){ | |||
| float *pcm=vb->pcm[i]; | |||
| mdct_backward(b->transform[vb->W][0],pcm,pcm); | |||
| mdct_backward((mdct_lookup*) b->transform[vb->W][0],pcm,pcm); | |||
| } | |||
| /* all done! */ | |||
| @@ -53,8 +53,8 @@ | |||
| some window function algebra. */ | |||
| void mdct_init(mdct_lookup *lookup,int n){ | |||
| int *bitrev=_ogg_malloc(sizeof(*bitrev)*(n/4)); | |||
| DATA_TYPE *T=_ogg_malloc(sizeof(*T)*(n+n/4)); | |||
| int *bitrev=(int*) _ogg_malloc(sizeof(*bitrev)*(n/4)); | |||
| DATA_TYPE *T=(DATA_TYPE*) _ogg_malloc(sizeof(*T)*(n+n/4)); | |||
| int i; | |||
| int n2=n>>1; | |||
| @@ -498,7 +498,7 @@ void mdct_forward(mdct_lookup *init, DATA_TYPE *in, DATA_TYPE *out){ | |||
| int n2=n>>1; | |||
| int n4=n>>2; | |||
| int n8=n>>3; | |||
| DATA_TYPE *w=alloca(n*sizeof(*w)); /* forward needs working space */ | |||
| DATA_TYPE *w=(DATA_TYPE*) alloca(n*sizeof(*w)); /* forward needs working space */ | |||
| DATA_TYPE *w2=w+n2; | |||
| /* rotate */ | |||
| @@ -37,9 +37,9 @@ static double stereo_threshholds[]={0.0, .5, 1.0, 1.5, 2.5, 4.5, 8.5, 16.5, 9e10 | |||
| static double stereo_threshholds_limited[]={0.0, .5, 1.0, 1.5, 2.0, 2.5, 4.5, 8.5, 9e10}; | |||
| vorbis_look_psy_global *_vp_global_look(vorbis_info *vi){ | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info*)vi->codec_setup; | |||
| vorbis_info_psy_global *gi=&ci->psy_g_param; | |||
| vorbis_look_psy_global *look=_ogg_calloc(1,sizeof(*look)); | |||
| vorbis_look_psy_global *look=(vorbis_look_psy_global*)_ogg_calloc(1,sizeof(*look)); | |||
| look->channels=vi->channels; | |||
| @@ -92,9 +92,9 @@ static float ***setup_tone_curves(float curveatt_dB[P_BANDS],float binHz,int n, | |||
| float ath[EHMER_MAX]; | |||
| float workc[P_BANDS][P_LEVELS][EHMER_MAX]; | |||
| float athc[P_LEVELS][EHMER_MAX]; | |||
| float *brute_buffer=alloca(n*sizeof(*brute_buffer)); | |||
| float *brute_buffer=(float*) alloca(n*sizeof(*brute_buffer)); | |||
| float ***ret=_ogg_malloc(sizeof(*ret)*P_BANDS); | |||
| float ***ret=(float***) _ogg_malloc(sizeof(*ret)*P_BANDS); | |||
| memset(workc,0,sizeof(workc)); | |||
| @@ -161,7 +161,7 @@ static float ***setup_tone_curves(float curveatt_dB[P_BANDS],float binHz,int n, | |||
| for(i=0;i<P_BANDS;i++){ | |||
| int hi_curve,lo_curve,bin; | |||
| ret[i]=_ogg_malloc(sizeof(**ret)*P_LEVELS); | |||
| ret[i]=(float**)_ogg_malloc(sizeof(**ret)*P_LEVELS); | |||
| /* low frequency curves are measured with greater resolution than | |||
| the MDCT/FFT will actually give us; we want the curve applied | |||
| @@ -181,7 +181,7 @@ static float ***setup_tone_curves(float curveatt_dB[P_BANDS],float binHz,int n, | |||
| if(hi_curve>=P_BANDS)hi_curve=P_BANDS-1; | |||
| for(m=0;m<P_LEVELS;m++){ | |||
| ret[i][m]=_ogg_malloc(sizeof(***ret)*(EHMER_MAX+2)); | |||
| ret[i][m]=(float*)_ogg_malloc(sizeof(***ret)*(EHMER_MAX+2)); | |||
| for(j=0;j<n;j++)brute_buffer[j]=999.; | |||
| @@ -279,10 +279,10 @@ void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi, | |||
| p->firstoc=toOC(.25f*rate*.5/n)*(1<<(p->shiftoc+1))-gi->eighth_octave_lines; | |||
| maxoc=toOC((n+.25f)*rate*.5/n)*(1<<(p->shiftoc+1))+.5f; | |||
| p->total_octave_lines=maxoc-p->firstoc+1; | |||
| p->ath=_ogg_malloc(n*sizeof(*p->ath)); | |||
| p->ath=(float*)_ogg_malloc(n*sizeof(*p->ath)); | |||
| p->octave=_ogg_malloc(n*sizeof(*p->octave)); | |||
| p->bark=_ogg_malloc(n*sizeof(*p->bark)); | |||
| p->octave=(long*)_ogg_malloc(n*sizeof(*p->octave)); | |||
| p->bark=(long*)_ogg_malloc(n*sizeof(*p->bark)); | |||
| p->vi=vi; | |||
| p->n=n; | |||
| p->rate=rate; | |||
| @@ -327,9 +327,9 @@ void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi, | |||
| vi->tone_centerboost,vi->tone_decay); | |||
| /* set up rolling noise median */ | |||
| p->noiseoffset=_ogg_malloc(P_NOISECURVES*sizeof(*p->noiseoffset)); | |||
| p->noiseoffset=(float**)_ogg_malloc(P_NOISECURVES*sizeof(*p->noiseoffset)); | |||
| for(i=0;i<P_NOISECURVES;i++) | |||
| p->noiseoffset[i]=_ogg_malloc(n*sizeof(**p->noiseoffset)); | |||
| p->noiseoffset[i]=(float*)_ogg_malloc(n*sizeof(**p->noiseoffset)); | |||
| for(i=0;i<n;i++){ | |||
| float halfoc=toOC((i+.5)*rate/(2.*n))*2.; | |||
| @@ -448,8 +448,8 @@ static void seed_loop(vorbis_look_psy *p, | |||
| } | |||
| static void seed_chase(float *seeds, int linesper, long n){ | |||
| long *posstack=alloca(n*sizeof(*posstack)); | |||
| float *ampstack=alloca(n*sizeof(*ampstack)); | |||
| long *posstack=(long*)alloca(n*sizeof(*posstack)); | |||
| float *ampstack=(float*)alloca(n*sizeof(*ampstack)); | |||
| long stack=0; | |||
| long pos=0; | |||
| long i; | |||
| @@ -546,11 +546,11 @@ static void bark_noise_hybridmp(int n,const long *b, | |||
| const float offset, | |||
| const int fixed){ | |||
| float *N=alloca(n*sizeof(*N)); | |||
| float *X=alloca(n*sizeof(*N)); | |||
| float *XX=alloca(n*sizeof(*N)); | |||
| float *Y=alloca(n*sizeof(*N)); | |||
| float *XY=alloca(n*sizeof(*N)); | |||
| float *N=(float*) alloca(n*sizeof(*N)); | |||
| float *X=(float*) alloca(n*sizeof(*N)); | |||
| float *XX=(float*) alloca(n*sizeof(*N)); | |||
| float *Y=(float*) alloca(n*sizeof(*N)); | |||
| float *XY=(float*) alloca(n*sizeof(*N)); | |||
| float tN, tX, tXX, tY, tXY; | |||
| int i; | |||
| @@ -783,7 +783,7 @@ void _vp_noisemask(vorbis_look_psy *p, | |||
| float *logmask){ | |||
| int i,n=p->n; | |||
| float *work=alloca(n*sizeof(*work)); | |||
| float *work=(float*) alloca(n*sizeof(*work)); | |||
| bark_noise_hybridmp(n,p->bark,logmdct,logmask, | |||
| 140.,-1); | |||
| @@ -834,7 +834,7 @@ void _vp_tonemask(vorbis_look_psy *p, | |||
| int i,n=p->n; | |||
| float *seed=alloca(sizeof(*seed)*p->total_octave_lines); | |||
| float *seed=(float*) alloca(sizeof(*seed)*p->total_octave_lines); | |||
| float att=local_specmax+p->vi->ath_adjatt; | |||
| for(i=0;i<p->total_octave_lines;i++)seed[i]=NEGINF; | |||
| @@ -911,7 +911,7 @@ void _vp_offset_and_mix(vorbis_look_psy *p, | |||
| float _vp_ampmax_decay(float amp,vorbis_dsp_state *vd){ | |||
| vorbis_info *vi=vd->vi; | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info*)vi->codec_setup; | |||
| vorbis_info_psy_global *gi=&ci->psy_g_param; | |||
| int n=ci->blocksizes[vd->W]/2; | |||
| @@ -1001,13 +1001,13 @@ float **_vp_quantize_couple_memo(vorbis_block *vb, | |||
| float **mdct){ | |||
| int i,j,n=p->n; | |||
| float **ret=_vorbis_block_alloc(vb,vi->coupling_steps*sizeof(*ret)); | |||
| float **ret=(float**) _vorbis_block_alloc(vb,vi->coupling_steps*sizeof(*ret)); | |||
| int limit=g->coupling_pointlimit[p->vi->blockflag][PACKETBLOBS/2]; | |||
| for(i=0;i<vi->coupling_steps;i++){ | |||
| float *mdctM=mdct[vi->coupling_mag[i]]; | |||
| float *mdctA=mdct[vi->coupling_ang[i]]; | |||
| ret[i]=_vorbis_block_alloc(vb,n*sizeof(**ret)); | |||
| ret[i]=(float*) _vorbis_block_alloc(vb,n*sizeof(**ret)); | |||
| for(j=0;j<limit;j++) | |||
| ret[i][j]=dipole_hypot(mdctM[j],mdctA[j]); | |||
| for(;j<n;j++) | |||
| @@ -1032,12 +1032,12 @@ int **_vp_quantize_couple_sort(vorbis_block *vb, | |||
| if(p->vi->normal_point_p){ | |||
| int i,j,k,n=p->n; | |||
| int **ret=_vorbis_block_alloc(vb,vi->coupling_steps*sizeof(*ret)); | |||
| int **ret=(int**) _vorbis_block_alloc(vb,vi->coupling_steps*sizeof(*ret)); | |||
| int partition=p->vi->normal_partition; | |||
| float **work=alloca(sizeof(*work)*partition); | |||
| float **work=(float**) alloca(sizeof(*work)*partition); | |||
| for(i=0;i<vi->coupling_steps;i++){ | |||
| ret[i]=_vorbis_block_alloc(vb,n*sizeof(**ret)); | |||
| ret[i]=(int*) _vorbis_block_alloc(vb,n*sizeof(**ret)); | |||
| for(j=0;j<n;j+=partition){ | |||
| for(k=0;k<partition;k++)work[k]=mags[i]+k+j; | |||
| @@ -1055,7 +1055,7 @@ void _vp_noise_normalize_sort(vorbis_look_psy *p, | |||
| int i,j,n=p->n; | |||
| vorbis_info_psy *vi=p->vi; | |||
| int partition=vi->normal_partition; | |||
| float **work=alloca(sizeof(*work)*partition); | |||
| float **work=(float**) alloca(sizeof(*work)*partition); | |||
| int start=vi->normal_start; | |||
| for(j=start;j<n;j+=partition){ | |||
| @@ -151,15 +151,6 @@ void res0_free_look(vorbis_look_residue *i){ | |||
| } | |||
| } | |||
| static int ilog(unsigned int v){ | |||
| int ret=0; | |||
| while(v){ | |||
| ret++; | |||
| v>>=1; | |||
| } | |||
| return(ret); | |||
| } | |||
| static int icount(unsigned int v){ | |||
| int ret=0; | |||
| while(v){ | |||
| @@ -202,8 +193,8 @@ void res0_pack(vorbis_info_residue *vr,oggpack_buffer *opb){ | |||
| /* vorbis_info is for range checking */ | |||
| vorbis_info_residue *res0_unpack(vorbis_info *vi,oggpack_buffer *opb){ | |||
| int j,acc=0; | |||
| vorbis_info_residue0 *info=_ogg_calloc(1,sizeof(*info)); | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| vorbis_info_residue0 *info=(vorbis_info_residue0*) _ogg_calloc(1,sizeof(*info)); | |||
| codec_setup_info *ci=(codec_setup_info*) vi->codec_setup; | |||
| info->begin=oggpack_read(opb,24); | |||
| info->end=oggpack_read(opb,24); | |||
| @@ -235,8 +226,8 @@ vorbis_info_residue *res0_unpack(vorbis_info *vi,oggpack_buffer *opb){ | |||
| vorbis_look_residue *res0_look(vorbis_dsp_state *vd, | |||
| vorbis_info_residue *vr){ | |||
| vorbis_info_residue0 *info=(vorbis_info_residue0 *)vr; | |||
| vorbis_look_residue0 *look=_ogg_calloc(1,sizeof(*look)); | |||
| codec_setup_info *ci=vd->vi->codec_setup; | |||
| vorbis_look_residue0 *look=(vorbis_look_residue0 *)_ogg_calloc(1,sizeof(*look)); | |||
| codec_setup_info *ci=(codec_setup_info*)vd->vi->codec_setup; | |||
| int j,k,acc=0; | |||
| int dim; | |||
| @@ -248,13 +239,13 @@ vorbis_look_residue *res0_look(vorbis_dsp_state *vd, | |||
| look->phrasebook=ci->fullbooks+info->groupbook; | |||
| dim=look->phrasebook->dim; | |||
| look->partbooks=_ogg_calloc(look->parts,sizeof(*look->partbooks)); | |||
| look->partbooks=(codebook***)_ogg_calloc(look->parts,sizeof(*look->partbooks)); | |||
| for(j=0;j<look->parts;j++){ | |||
| int stages=ilog(info->secondstages[j]); | |||
| if(stages){ | |||
| if(stages>maxstage)maxstage=stages; | |||
| look->partbooks[j]=_ogg_calloc(stages,sizeof(*look->partbooks[j])); | |||
| look->partbooks[j]=(codebook**) _ogg_calloc(stages,sizeof(*look->partbooks[j])); | |||
| for(k=0;k<stages;k++) | |||
| if(info->secondstages[j]&(1<<k)){ | |||
| look->partbooks[j][k]=ci->fullbooks+info->booklist[acc++]; | |||
| @@ -268,11 +259,11 @@ vorbis_look_residue *res0_look(vorbis_dsp_state *vd, | |||
| look->partvals=rint(pow((float)look->parts,(float)dim)); | |||
| look->stages=maxstage; | |||
| look->decodemap=_ogg_malloc(look->partvals*sizeof(*look->decodemap)); | |||
| look->decodemap=(int**)_ogg_malloc(look->partvals*sizeof(*look->decodemap)); | |||
| for(j=0;j<look->partvals;j++){ | |||
| long val=j; | |||
| long mult=look->partvals/look->parts; | |||
| look->decodemap[j]=_ogg_malloc(dim*sizeof(*look->decodemap[j])); | |||
| look->decodemap[j]=(int*)_ogg_malloc(dim*sizeof(*look->decodemap[j])); | |||
| for(k=0;k<dim;k++){ | |||
| long deco=val/mult; | |||
| val-=deco*mult; | |||
| @@ -325,13 +316,13 @@ static int local_book_besterror(codebook *book,float *a){ | |||
| best=-1; | |||
| for(i=0;i<book->entries;i++){ | |||
| if(c->lengthlist[i]>0){ | |||
| float this=0.f; | |||
| float thisx=0.f; | |||
| for(j=0;j<dim;j++){ | |||
| float val=(e[j]-a[j]); | |||
| this+=val*val; | |||
| thisx+=val*val; | |||
| } | |||
| if(best==-1 || this<bestf){ | |||
| bestf=this; | |||
| if(best==-1 || thisx<bestf){ | |||
| bestf=thisx; | |||
| best=i; | |||
| } | |||
| } | |||
| @@ -379,7 +370,7 @@ static long **_01class(vorbis_block *vb,vorbis_look_residue *vl, | |||
| int n=info->end-info->begin; | |||
| int partvals=n/samples_per_partition; | |||
| long **partword=_vorbis_block_alloc(vb,ch*sizeof(*partword)); | |||
| long **partword=(long**)_vorbis_block_alloc(vb,ch*sizeof(*partword)); | |||
| float scale=100./samples_per_partition; | |||
| /* we find the partition type for each partition of each | |||
| @@ -387,7 +378,7 @@ static long **_01class(vorbis_block *vb,vorbis_look_residue *vl, | |||
| bit. For now, clarity */ | |||
| for(i=0;i<ch;i++){ | |||
| partword[i]=_vorbis_block_alloc(vb,n/samples_per_partition*sizeof(*partword[i])); | |||
| partword[i]=(long*)_vorbis_block_alloc(vb,n/samples_per_partition*sizeof(*partword[i])); | |||
| memset(partword[i],0,n/samples_per_partition*sizeof(*partword[i])); | |||
| } | |||
| @@ -446,14 +437,14 @@ static long **_2class(vorbis_block *vb,vorbis_look_residue *vl,float **in, | |||
| int n=info->end-info->begin; | |||
| int partvals=n/samples_per_partition; | |||
| long **partword=_vorbis_block_alloc(vb,sizeof(*partword)); | |||
| long **partword=(long**)_vorbis_block_alloc(vb,sizeof(*partword)); | |||
| #if defined(TRAIN_RES) || defined (TRAIN_RESAUX) | |||
| FILE *of; | |||
| char buffer[80]; | |||
| #endif | |||
| partword[0]=_vorbis_block_alloc(vb,n*ch/samples_per_partition*sizeof(*partword[0])); | |||
| partword[0]=(long*)_vorbis_block_alloc(vb,n*ch/samples_per_partition*sizeof(*partword[0])); | |||
| memset(partword[0],0,n*ch/samples_per_partition*sizeof(*partword[0])); | |||
| for(i=0,l=info->begin/ch;i<partvals;i++){ | |||
| @@ -620,10 +611,10 @@ static int _01inverse(vorbis_block *vb,vorbis_look_residue *vl, | |||
| int partvals=n/samples_per_partition; | |||
| int partwords=(partvals+partitions_per_word-1)/partitions_per_word; | |||
| int ***partword=alloca(ch*sizeof(*partword)); | |||
| int ***partword=(int***)alloca(ch*sizeof(*partword)); | |||
| for(j=0;j<ch;j++) | |||
| partword[j]=_vorbis_block_alloc(vb,partwords*sizeof(*partword[j])); | |||
| partword[j]=(int**)_vorbis_block_alloc(vb,partwords*sizeof(*partword[j])); | |||
| for(s=0;s<look->stages;s++){ | |||
| @@ -796,7 +787,7 @@ int res2_forward(oggpack_buffer *opb, | |||
| /* don't duplicate the code; use a working vector hack for now and | |||
| reshape ourselves into a single channel res1 */ | |||
| /* ugly; reallocs for each coupling pass :-( */ | |||
| float *work=_vorbis_block_alloc(vb,ch*n*sizeof(*work)); | |||
| float *work=(float*)_vorbis_block_alloc(vb,ch*n*sizeof(*work)); | |||
| for(i=0;i<ch;i++){ | |||
| float *pcm=in[i]; | |||
| if(nonzero[i])used++; | |||
| @@ -836,7 +827,7 @@ int res2_inverse(vorbis_block *vb,vorbis_look_residue *vl, | |||
| int partvals=n/samples_per_partition; | |||
| int partwords=(partvals+partitions_per_word-1)/partitions_per_word; | |||
| int **partword=_vorbis_block_alloc(vb,partwords*sizeof(*partword)); | |||
| int **partword=(int**)_vorbis_block_alloc(vb,partwords*sizeof(*partword)); | |||
| for(i=0;i<ch;i++)if(nonzero[i])break; | |||
| if(i==ch)return(0); /* no nonzero vectors */ | |||
| @@ -76,7 +76,7 @@ float _float32_unpack(long val){ | |||
| ogg_uint32_t *_make_words(long *l,long n,long sparsecount){ | |||
| long i,j,count=0; | |||
| ogg_uint32_t marker[33]; | |||
| ogg_uint32_t *r=_ogg_malloc((sparsecount?sparsecount:n)*sizeof(*r)); | |||
| ogg_uint32_t *r=(ogg_uint32_t*)_ogg_malloc((sparsecount?sparsecount:n)*sizeof(*r)); | |||
| memset(marker,0,sizeof(marker)); | |||
| for(i=0;i<n;i++){ | |||
| @@ -189,7 +189,7 @@ float *_book_unquantize(const static_codebook *b,int n,int *sparsemap){ | |||
| int quantvals; | |||
| float mindel=_float32_unpack(b->q_min); | |||
| float delta=_float32_unpack(b->q_delta); | |||
| float *r=_ogg_calloc(n*b->dim,sizeof(*r)); | |||
| float *r=(float*)_ogg_calloc(n*b->dim,sizeof(*r)); | |||
| /* maptype 1 and 2 both use a quantized value vector, but | |||
| different sizes */ | |||
| @@ -304,14 +304,6 @@ int vorbis_book_init_encode(codebook *c,const static_codebook *s){ | |||
| return(0); | |||
| } | |||
| static ogg_uint32_t bitreverse(ogg_uint32_t x){ | |||
| x= ((x>>16)&0x0000ffffUL) | ((x<<16)&0xffff0000UL); | |||
| x= ((x>> 8)&0x00ff00ffUL) | ((x<< 8)&0xff00ff00UL); | |||
| x= ((x>> 4)&0x0f0f0f0fUL) | ((x<< 4)&0xf0f0f0f0UL); | |||
| x= ((x>> 2)&0x33333333UL) | ((x<< 2)&0xccccccccUL); | |||
| return((x>> 1)&0x55555555UL) | ((x<< 1)&0xaaaaaaaaUL); | |||
| } | |||
| static int sort32a(const void *a,const void *b){ | |||
| return ( **(ogg_uint32_t **)a>**(ogg_uint32_t **)b)- | |||
| ( **(ogg_uint32_t **)a<**(ogg_uint32_t **)b); | |||
| @@ -345,7 +337,7 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){ | |||
| { | |||
| /* perform sort */ | |||
| ogg_uint32_t *codes=_make_words(s->lengthlist,s->entries,c->used_entries); | |||
| ogg_uint32_t **codep=alloca(sizeof(*codep)*n); | |||
| ogg_uint32_t **codep=(ogg_uint32_t**)alloca(sizeof(*codep)*n); | |||
| if(codes==NULL)goto err_out; | |||
| @@ -356,8 +348,8 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){ | |||
| qsort(codep,n,sizeof(*codep),sort32a); | |||
| sortindex=alloca(n*sizeof(*sortindex)); | |||
| c->codelist=_ogg_malloc(n*sizeof(*c->codelist)); | |||
| sortindex=(int*)alloca(n*sizeof(*sortindex)); | |||
| c->codelist=(ogg_uint32_t*)_ogg_malloc(n*sizeof(*c->codelist)); | |||
| /* the index is a reverse index */ | |||
| for(i=0;i<n;i++){ | |||
| int position=codep[i]-codes; | |||
| @@ -370,13 +362,13 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){ | |||
| } | |||
| c->valuelist=_book_unquantize(s,n,sortindex); | |||
| c->dec_index=_ogg_malloc(n*sizeof(*c->dec_index)); | |||
| c->dec_index=(int*)_ogg_malloc(n*sizeof(*c->dec_index)); | |||
| for(n=0,i=0;i<s->entries;i++) | |||
| if(s->lengthlist[i]>0) | |||
| c->dec_index[sortindex[n++]]=i; | |||
| c->dec_codelengths=_ogg_malloc(n*sizeof(*c->dec_codelengths)); | |||
| c->dec_codelengths=(char*)_ogg_malloc(n*sizeof(*c->dec_codelengths)); | |||
| for(n=0,i=0;i<s->entries;i++) | |||
| if(s->lengthlist[i]>0) | |||
| c->dec_codelengths[sortindex[n++]]=s->lengthlist[i]; | |||
| @@ -386,7 +378,7 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){ | |||
| if(c->dec_firsttablen>8)c->dec_firsttablen=8; | |||
| tabn=1<<c->dec_firsttablen; | |||
| c->dec_firsttable=_ogg_calloc(tabn,sizeof(*c->dec_firsttable)); | |||
| c->dec_firsttable=(ogg_uint32_t*)_ogg_calloc(tabn,sizeof(*c->dec_firsttable)); | |||
| c->dec_maxlength=0; | |||
| for(i=0;i<n;i++){ | |||
| @@ -558,9 +550,9 @@ int _best(codebook *book, float *a, int step){ | |||
| float *e=book->valuelist; | |||
| for(i=0;i<book->entries;i++){ | |||
| if(c->lengthlist[i]>0){ | |||
| float this=_dist(dim,e,a,step); | |||
| if(besti==-1 || this<best){ | |||
| best=this; | |||
| float thisx=_dist(dim,e,a,step); | |||
| if(besti==-1 || thisx<best){ | |||
| best=thisx; | |||
| besti=i; | |||
| } | |||
| } | |||
| @@ -1244,8 +1244,8 @@ void drft_backward(drft_lookup *l,float *data){ | |||
| void drft_init(drft_lookup *l,int n){ | |||
| l->n=n; | |||
| l->trigcache=_ogg_calloc(3*n,sizeof(*l->trigcache)); | |||
| l->splitcache=_ogg_calloc(32,sizeof(*l->splitcache)); | |||
| l->trigcache=(float*)_ogg_calloc(3*n,sizeof(*l->trigcache)); | |||
| l->splitcache=(int*)_ogg_calloc(32,sizeof(*l->splitcache)); | |||
| fdrffti(n, l->trigcache, l->splitcache); | |||
| } | |||
| @@ -28,9 +28,9 @@ | |||
| int vorbis_synthesis(vorbis_block *vb,ogg_packet *op){ | |||
| vorbis_dsp_state *vd=vb->vd; | |||
| private_state *b=vd->backend_state; | |||
| private_state *b=(private_state*)vd->backend_state; | |||
| vorbis_info *vi=vd->vi; | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info*) vi->codec_setup; | |||
| oggpack_buffer *opb=&vb->opb; | |||
| int type,mode,i; | |||
| @@ -69,9 +69,9 @@ int vorbis_synthesis(vorbis_block *vb,ogg_packet *op){ | |||
| /* alloc pcm passback storage */ | |||
| vb->pcmend=ci->blocksizes[vb->W]; | |||
| vb->pcm=_vorbis_block_alloc(vb,sizeof(*vb->pcm)*vi->channels); | |||
| vb->pcm=(float**)_vorbis_block_alloc(vb,sizeof(*vb->pcm)*vi->channels); | |||
| for(i=0;i<vi->channels;i++) | |||
| vb->pcm[i]=_vorbis_block_alloc(vb,vb->pcmend*sizeof(*vb->pcm[i])); | |||
| vb->pcm[i]=(float*)_vorbis_block_alloc(vb,vb->pcmend*sizeof(*vb->pcm[i])); | |||
| /* unpack_header enforces range checking */ | |||
| type=ci->map_type[ci->mode_param[mode]->mapping]; | |||
| @@ -84,9 +84,9 @@ int vorbis_synthesis(vorbis_block *vb,ogg_packet *op){ | |||
| Useful for sequential 'fast forward' */ | |||
| int vorbis_synthesis_trackonly(vorbis_block *vb,ogg_packet *op){ | |||
| vorbis_dsp_state *vd=vb->vd; | |||
| private_state *b=vd->backend_state; | |||
| private_state *b=(private_state*)vd->backend_state; | |||
| vorbis_info *vi=vd->vi; | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info*)vi->codec_setup; | |||
| oggpack_buffer *opb=&vb->opb; | |||
| int mode; | |||
| @@ -128,7 +128,7 @@ int vorbis_synthesis_trackonly(vorbis_block *vb,ogg_packet *op){ | |||
| } | |||
| long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op){ | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info*)vi->codec_setup; | |||
| oggpack_buffer opb; | |||
| int mode; | |||
| @@ -157,7 +157,7 @@ long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op){ | |||
| int vorbis_synthesis_halfrate(vorbis_info *vi,int flag){ | |||
| /* set / clear half-sample-rate mode */ | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info*)vi->codec_setup; | |||
| /* right now, our MDCT can't handle < 64 sample windows. */ | |||
| if(ci->blocksizes[0]<=64 && flag)return -1; | |||
| @@ -166,7 +166,7 @@ int vorbis_synthesis_halfrate(vorbis_info *vi,int flag){ | |||
| } | |||
| int vorbis_synthesis_halfrate_p(vorbis_info *vi){ | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info*)vi->codec_setup; | |||
| return ci->halfrate_flag; | |||
| } | |||
| @@ -204,8 +204,8 @@ static void vorbis_encode_floor_setup(vorbis_info *vi,double s,int block, | |||
| vorbis_info_floor1 *in, | |||
| int *x){ | |||
| int i,k,is=s; | |||
| vorbis_info_floor1 *f=_ogg_calloc(1,sizeof(*f)); | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| vorbis_info_floor1 *f=(vorbis_info_floor1*) _ogg_calloc(1,sizeof(*f)); | |||
| codec_setup_info *ci=(codec_setup_info*)vi->codec_setup; | |||
| memcpy(f,in+x[is],sizeof(*f)); | |||
| /* fill in the lowpass field, even if it's temporary */ | |||
| @@ -244,7 +244,7 @@ static void vorbis_encode_global_psych_setup(vorbis_info *vi,double s, | |||
| double *x){ | |||
| int i,is=s; | |||
| double ds=s-is; | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info*)vi->codec_setup; | |||
| vorbis_info_psy_global *g=&ci->psy_g_param; | |||
| memcpy(g,in+(int)x[is],sizeof(*g)); | |||
| @@ -272,7 +272,7 @@ static void vorbis_encode_global_stereo(vorbis_info *vi, | |||
| float s=hi->stereo_point_setting; | |||
| int i,is=s; | |||
| double ds=s-is; | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info*)vi->codec_setup; | |||
| vorbis_info_psy_global *g=&ci->psy_g_param; | |||
| if(p){ | |||
| @@ -320,7 +320,7 @@ static void vorbis_encode_psyset_setup(vorbis_info *vi,double s, | |||
| int *nn_partition, | |||
| double *nn_thresh, | |||
| int block){ | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info*) vi->codec_setup; | |||
| vorbis_info_psy *p=ci->psy_param[block]; | |||
| highlevel_encode_setup *hi=&ci->hi; | |||
| int is=s; | |||
| @@ -328,7 +328,7 @@ static void vorbis_encode_psyset_setup(vorbis_info *vi,double s, | |||
| if(block>=ci->psys) | |||
| ci->psys=block+1; | |||
| if(!p){ | |||
| p=_ogg_calloc(1,sizeof(*p)); | |||
| p=(vorbis_info_psy*)_ogg_calloc(1,sizeof(*p)); | |||
| ci->psy_param[block]=p; | |||
| } | |||
| @@ -352,7 +352,7 @@ static void vorbis_encode_tonemask_setup(vorbis_info *vi,double s,int block, | |||
| vp_adjblock *in){ | |||
| int i,is=s; | |||
| double ds=s-is; | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info*) vi->codec_setup; | |||
| vorbis_info_psy *p=ci->psy_param[block]; | |||
| /* 0 and 2 are only used by bitmanagement, but there's no harm to always | |||
| @@ -375,7 +375,7 @@ static void vorbis_encode_compand_setup(vorbis_info *vi,double s,int block, | |||
| compandblock *in, double *x){ | |||
| int i,is=s; | |||
| double ds=s-is; | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info*)vi->codec_setup; | |||
| vorbis_info_psy *p=ci->psy_param[block]; | |||
| ds=x[is]*(1.-ds)+x[is+1]*ds; | |||
| @@ -396,7 +396,7 @@ static void vorbis_encode_peak_setup(vorbis_info *vi,double s,int block, | |||
| int *suppress){ | |||
| int is=s; | |||
| double ds=s-is; | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info*)vi->codec_setup; | |||
| vorbis_info_psy *p=ci->psy_param[block]; | |||
| p->tone_abs_limit=suppress[is]*(1.-ds)+suppress[is+1]*ds; | |||
| @@ -411,7 +411,7 @@ static void vorbis_encode_noisebias_setup(vorbis_info *vi,double s,int block, | |||
| double userbias){ | |||
| int i,is=s,j; | |||
| double ds=s-is; | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info*)vi->codec_setup; | |||
| vorbis_info_psy *p=ci->psy_param[block]; | |||
| p->noisemaxsupp=suppress[is]*(1.-ds)+suppress[is+1]*ds; | |||
| @@ -437,7 +437,7 @@ static void vorbis_encode_noisebias_setup(vorbis_info *vi,double s,int block, | |||
| } | |||
| static void vorbis_encode_ath_setup(vorbis_info *vi,int block){ | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info*)vi->codec_setup; | |||
| vorbis_info_psy *p=ci->psy_param[block]; | |||
| p->ath_adjatt=ci->hi.ath_floating_dB; | |||
| @@ -457,7 +457,7 @@ static int book_dup_or_new(codec_setup_info *ci,static_codebook *book){ | |||
| static void vorbis_encode_blocksize_setup(vorbis_info *vi,double s, | |||
| int *shortb,int *longb){ | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info*)vi->codec_setup; | |||
| int is=s; | |||
| int blockshort=shortb[is]; | |||
| @@ -471,11 +471,11 @@ static void vorbis_encode_residue_setup(vorbis_info *vi, | |||
| int number, int block, | |||
| vorbis_residue_template *res){ | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info*)vi->codec_setup; | |||
| int i,n; | |||
| vorbis_info_residue0 *r=ci->residue_param[number]= | |||
| _ogg_malloc(sizeof(*r)); | |||
| vorbis_info_residue0 *r=(vorbis_info_residue0*)(ci->residue_param[number]= | |||
| (vorbis_info_residue0*)_ogg_malloc(sizeof(*r))); | |||
| memcpy(r,res->res,sizeof(*r)); | |||
| if(ci->residues<=number)ci->residues=number+1; | |||
| @@ -543,7 +543,7 @@ static void vorbis_encode_residue_setup(vorbis_info *vi, | |||
| /* lowpass setup/pointlimit */ | |||
| { | |||
| double freq=ci->hi.lowpass_kHz*1000.; | |||
| vorbis_info_floor1 *f=ci->floor_param[block]; /* by convention */ | |||
| vorbis_info_floor1 *f=(vorbis_info_floor1*)ci->floor_param[block]; /* by convention */ | |||
| double nyq=vi->rate/2.; | |||
| long blocksize=ci->blocksizes[block]>>1; | |||
| @@ -581,7 +581,7 @@ static void vorbis_encode_residue_setup(vorbis_info *vi, | |||
| static void vorbis_encode_map_n_res_setup(vorbis_info *vi,double s, | |||
| vorbis_mapping_template *maps){ | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info*)vi->codec_setup; | |||
| int i,j,is=s,modes=2; | |||
| vorbis_info_mapping0 *map=maps[is].map; | |||
| vorbis_info_mode *mode=_mode_template; | |||
| @@ -592,7 +592,7 @@ static void vorbis_encode_map_n_res_setup(vorbis_info *vi,double s, | |||
| for(i=0;i<modes;i++){ | |||
| ci->map_param[i]=_ogg_calloc(1,sizeof(*map)); | |||
| ci->mode_param[i]=_ogg_calloc(1,sizeof(*mode)); | |||
| ci->mode_param[i]=(vorbis_info_mode*)_ogg_calloc(1,sizeof(*mode)); | |||
| memcpy(ci->mode_param[i],mode+i,sizeof(*_mode_template)); | |||
| if(i>=ci->modes)ci->modes=i+1; | |||
| @@ -608,7 +608,7 @@ static void vorbis_encode_map_n_res_setup(vorbis_info *vi,double s, | |||
| } | |||
| static double setting_to_approx_bitrate(vorbis_info *vi){ | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info*)vi->codec_setup; | |||
| highlevel_encode_setup *hi=&ci->hi; | |||
| ve_setup_data_template *setup=(ve_setup_data_template *)hi->setup; | |||
| int is=hi->base_setting; | |||
| @@ -626,7 +626,7 @@ static void get_setup_template(vorbis_info *vi, | |||
| long ch,long srate, | |||
| double req,int q_or_bitrate){ | |||
| int i=0,j; | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info*) vi->codec_setup; | |||
| highlevel_encode_setup *hi=&ci->hi; | |||
| if(q_or_bitrate)req/=ch; | |||
| @@ -675,7 +675,7 @@ static void get_setup_template(vorbis_info *vi, | |||
| /* the final setup call */ | |||
| int vorbis_encode_setup_init(vorbis_info *vi){ | |||
| int i0=0,singleblock=0; | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info*) vi->codec_setup; | |||
| ve_setup_data_template *setup=NULL; | |||
| highlevel_encode_setup *hi=&ci->hi; | |||
| @@ -861,9 +861,9 @@ static int vorbis_encode_setup_setting(vorbis_info *vi, | |||
| long channels, | |||
| long rate){ | |||
| int ret=0,i,is; | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info*)vi->codec_setup; | |||
| highlevel_encode_setup *hi=&ci->hi; | |||
| ve_setup_data_template *setup=hi->setup; | |||
| ve_setup_data_template *setup=(ve_setup_data_template*) hi->setup; | |||
| double ds; | |||
| ret=vorbis_encode_toplevel_setup(vi,channels,rate); | |||
| @@ -906,7 +906,7 @@ int vorbis_encode_setup_vbr(vorbis_info *vi, | |||
| long channels, | |||
| long rate, | |||
| float quality){ | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info*) vi->codec_setup; | |||
| highlevel_encode_setup *hi=&ci->hi; | |||
| quality+=.0000001; | |||
| @@ -946,7 +946,7 @@ int vorbis_encode_setup_managed(vorbis_info *vi, | |||
| long nominal_bitrate, | |||
| long min_bitrate){ | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info*)vi->codec_setup; | |||
| highlevel_encode_setup *hi=&ci->hi; | |||
| double tnominal=nominal_bitrate; | |||
| int ret=0; | |||
| @@ -1013,7 +1013,7 @@ int vorbis_encode_init(vorbis_info *vi, | |||
| int vorbis_encode_ctl(vorbis_info *vi,int number,void *arg){ | |||
| if(vi){ | |||
| codec_setup_info *ci=vi->codec_setup; | |||
| codec_setup_info *ci=(codec_setup_info*)vi->codec_setup; | |||
| highlevel_encode_setup *hi=&ci->hi; | |||
| int setp=(number&0xf); /* a read request has a low nibble of 0 */ | |||
| @@ -213,8 +213,8 @@ static int _bisect_forward_serialno(OggVorbis_File *vf, | |||
| if(searched>=end || ret<0){ | |||
| vf->links=m+1; | |||
| vf->offsets=_ogg_malloc((vf->links+1)*sizeof(*vf->offsets)); | |||
| vf->serialnos=_ogg_malloc(vf->links*sizeof(*vf->serialnos)); | |||
| vf->offsets=(ogg_int64_t*)_ogg_malloc((vf->links+1)*sizeof(*vf->offsets)); | |||
| vf->serialnos=(long*)_ogg_malloc(vf->links*sizeof(*vf->serialnos)); | |||
| vf->offsets[m+1]=searched; | |||
| }else{ | |||
| ret=_bisect_forward_serialno(vf,next,vf->offset, | |||
| @@ -297,10 +297,10 @@ static void _prefetch_all_headers(OggVorbis_File *vf, ogg_int64_t dataoffset){ | |||
| int i; | |||
| ogg_int64_t ret; | |||
| vf->vi=_ogg_realloc(vf->vi,vf->links*sizeof(*vf->vi)); | |||
| vf->vc=_ogg_realloc(vf->vc,vf->links*sizeof(*vf->vc)); | |||
| vf->dataoffsets=_ogg_malloc(vf->links*sizeof(*vf->dataoffsets)); | |||
| vf->pcmlengths=_ogg_malloc(vf->links*2*sizeof(*vf->pcmlengths)); | |||
| vf->vi=(vorbis_info*) _ogg_realloc(vf->vi,vf->links*sizeof(*vf->vi)); | |||
| vf->vc=(vorbis_comment*) _ogg_realloc(vf->vc,vf->links*sizeof(*vf->vc)); | |||
| vf->dataoffsets=(ogg_int64_t*) _ogg_malloc(vf->links*sizeof(*vf->dataoffsets)); | |||
| vf->pcmlengths=(ogg_int64_t*) _ogg_malloc(vf->links*2*sizeof(*vf->pcmlengths)); | |||
| for(i=0;i<vf->links;i++){ | |||
| if(i==0){ | |||
| @@ -661,8 +661,8 @@ static int _ov_open1(void *f,OggVorbis_File *vf,char *initial, | |||
| /* No seeking yet; Set up a 'single' (current) logical bitstream | |||
| entry for partial open */ | |||
| vf->links=1; | |||
| vf->vi=_ogg_calloc(vf->links,sizeof(*vf->vi)); | |||
| vf->vc=_ogg_calloc(vf->links,sizeof(*vf->vc)); | |||
| vf->vi=(vorbis_info*) _ogg_calloc(vf->links,sizeof(*vf->vi)); | |||
| vf->vc=(vorbis_comment*) _ogg_calloc(vf->links,sizeof(*vf->vc)); | |||
| ogg_stream_init(&vf->os,-1); /* fill in the serialno later */ | |||
| /* Try to fetch the headers, maintaining all the storage */ | |||
| @@ -1841,14 +1841,14 @@ int ov_crosslap(OggVorbis_File *vf1, OggVorbis_File *vf2){ | |||
| hs1=ov_halfrate_p(vf1); | |||
| hs2=ov_halfrate_p(vf2); | |||
| lappcm=alloca(sizeof(*lappcm)*vi1->channels); | |||
| lappcm=(float**) alloca(sizeof(*lappcm)*vi1->channels); | |||
| n1=vorbis_info_blocksize(vi1,0)>>(1+hs1); | |||
| n2=vorbis_info_blocksize(vi2,0)>>(1+hs2); | |||
| w1=vorbis_window(&vf1->vd,0); | |||
| w2=vorbis_window(&vf2->vd,0); | |||
| for(i=0;i<vi1->channels;i++) | |||
| lappcm[i]=alloca(sizeof(**lappcm)*n1); | |||
| lappcm[i]=(float*) alloca(sizeof(**lappcm)*n1); | |||
| _ov_getlap(vf1,vi1,&vf1->vd,lappcm,n1); | |||
| @@ -1888,9 +1888,9 @@ static int _ov_64_seek_lap(OggVorbis_File *vf,ogg_int64_t pos, | |||
| from this link gets dumped, this | |||
| window array continues to exist */ | |||
| lappcm=alloca(sizeof(*lappcm)*ch1); | |||
| lappcm=(float**) alloca(sizeof(*lappcm)*ch1); | |||
| for(i=0;i<ch1;i++) | |||
| lappcm[i]=alloca(sizeof(**lappcm)*n1); | |||
| lappcm[i]=(float*) alloca(sizeof(**lappcm)*n1); | |||
| _ov_getlap(vf,vi,&vf->vd,lappcm,n1); | |||
| /* have lapping data; seek and prime the buffer */ | |||
| @@ -1949,9 +1949,9 @@ static int _ov_d_seek_lap(OggVorbis_File *vf,double pos, | |||
| from this link gets dumped, this | |||
| window array continues to exist */ | |||
| lappcm=alloca(sizeof(*lappcm)*ch1); | |||
| lappcm=(float**) alloca(sizeof(*lappcm)*ch1); | |||
| for(i=0;i<ch1;i++) | |||
| lappcm[i]=alloca(sizeof(**lappcm)*n1); | |||
| lappcm[i]=(float*) alloca(sizeof(**lappcm)*n1); | |||
| _ov_getlap(vf,vi,&vf->vd,lappcm,n1); | |||
| /* have lapping data; seek and prime the buffer */ | |||
| @@ -41,6 +41,16 @@ typedef struct { | |||
| long body_len; | |||
| } ogg_page; | |||
| static ogg_uint32_t bitreverse(ogg_uint32_t x){ | |||
| x= ((x>>16)&0x0000ffffUL) | ((x<<16)&0xffff0000UL); | |||
| x= ((x>> 8)&0x00ff00ffUL) | ((x<< 8)&0xff00ff00UL); | |||
| x= ((x>> 4)&0x0f0f0f0fUL) | ((x<< 4)&0xf0f0f0f0UL); | |||
| x= ((x>> 2)&0x33333333UL) | ((x<< 2)&0xccccccccUL); | |||
| return((x>> 1)&0x55555555UL) | ((x<< 1)&0xaaaaaaaaUL); | |||
| } | |||
| /* ogg_stream_state contains the current encode/decode state of a logical | |||
| Ogg bitstream **********************************************************/ | |||
| @@ -1287,4 +1287,6 @@ const FileSearchPath AudioUnitPluginFormat::getDefaultLocationsToSearch() | |||
| END_JUCE_NAMESPACE | |||
| #undef log | |||
| #endif | |||
| @@ -3011,4 +3011,6 @@ const FileSearchPath VSTPluginFormat::getDefaultLocationsToSearch() | |||
| END_JUCE_NAMESPACE | |||
| #undef log | |||
| #endif | |||
| @@ -42,8 +42,8 @@ BEGIN_JUCE_NAMESPACE | |||
| class InternalMultiTimerCallback : public Timer | |||
| { | |||
| public: | |||
| InternalMultiTimerCallback (const int id_, MultiTimer& owner_) | |||
| : id (id_), | |||
| InternalMultiTimerCallback (const int timerId_, MultiTimer& owner_) | |||
| : timerId (timerId_), | |||
| owner (owner_) | |||
| { | |||
| } | |||
| @@ -54,10 +54,10 @@ public: | |||
| void timerCallback() | |||
| { | |||
| owner.timerCallback (id); | |||
| owner.timerCallback (timerId); | |||
| } | |||
| const int id; | |||
| const int timerId; | |||
| private: | |||
| MultiTimer& owner; | |||
| @@ -91,7 +91,7 @@ void MultiTimer::startTimer (const int timerId, const int intervalInMilliseconds | |||
| { | |||
| InternalMultiTimerCallback* const t = (InternalMultiTimerCallback*) timers.getUnchecked(i); | |||
| if (t->id == timerId) | |||
| if (t->timerId == timerId) | |||
| { | |||
| t->startTimer (intervalInMilliseconds); | |||
| return; | |||
| @@ -111,7 +111,7 @@ void MultiTimer::stopTimer (const int timerId) throw() | |||
| { | |||
| InternalMultiTimerCallback* const t = (InternalMultiTimerCallback*) timers.getUnchecked(i); | |||
| if (t->id == timerId) | |||
| if (t->timerId == timerId) | |||
| t->stopTimer(); | |||
| } | |||
| } | |||
| @@ -123,7 +123,7 @@ bool MultiTimer::isTimerRunning (const int timerId) const throw() | |||
| for (int i = timers.size(); --i >= 0;) | |||
| { | |||
| const InternalMultiTimerCallback* const t = (InternalMultiTimerCallback*) timers.getUnchecked(i); | |||
| if (t->id == timerId) | |||
| if (t->timerId == timerId) | |||
| return t->isTimerRunning(); | |||
| } | |||
| @@ -137,7 +137,7 @@ int MultiTimer::getTimerInterval (const int timerId) const throw() | |||
| for (int i = timers.size(); --i >= 0;) | |||
| { | |||
| const InternalMultiTimerCallback* const t = (InternalMultiTimerCallback*) timers.getUnchecked(i); | |||
| if (t->id == timerId) | |||
| if (t->timerId == timerId) | |||
| return t->getTimerInterval(); | |||
| } | |||
| @@ -114,7 +114,7 @@ void ComboBox::addItem (const String& newItemText, | |||
| separatorPending = false; | |||
| ItemInfo* const item = new ItemInfo(); | |||
| item->id = 0; | |||
| item->itemId = 0; | |||
| item->isEnabled = false; | |||
| item->isHeading = false; | |||
| items.add (item); | |||
| @@ -122,7 +122,7 @@ void ComboBox::addItem (const String& newItemText, | |||
| ItemInfo* const item = new ItemInfo(); | |||
| item->name = newItemText; | |||
| item->id = newItemId; | |||
| item->itemId = newItemId; | |||
| item->isEnabled = true; | |||
| item->isHeading = false; | |||
| items.add (item); | |||
| @@ -146,7 +146,7 @@ void ComboBox::addSectionHeading (const String& headingName) throw() | |||
| separatorPending = false; | |||
| ItemInfo* const item = new ItemInfo(); | |||
| item->id = 0; | |||
| item->itemId = 0; | |||
| item->isEnabled = false; | |||
| item->isHeading = false; | |||
| items.add (item); | |||
| @@ -154,7 +154,7 @@ void ComboBox::addSectionHeading (const String& headingName) throw() | |||
| ItemInfo* const item = new ItemInfo(); | |||
| item->name = headingName; | |||
| item->id = 0; | |||
| item->itemId = 0; | |||
| item->isEnabled = true; | |||
| item->isHeading = true; | |||
| items.add (item); | |||
| @@ -191,14 +191,14 @@ void ComboBox::clear (const bool dontSendChangeMessage) | |||
| } | |||
| //============================================================================== | |||
| ComboBox::ItemInfo* ComboBox::getItemForId (const int id) const throw() | |||
| ComboBox::ItemInfo* ComboBox::getItemForId (const int itemId) const throw() | |||
| { | |||
| jassert (id != 0); | |||
| jassert (itemId != 0); | |||
| if (id != 0) | |||
| if (itemId != 0) | |||
| { | |||
| for (int i = items.size(); --i >= 0;) | |||
| if (items.getUnchecked(i)->id == id) | |||
| if (items.getUnchecked(i)->itemId == itemId) | |||
| return items.getUnchecked(i); | |||
| } | |||
| @@ -252,7 +252,7 @@ int ComboBox::getItemId (const int index) const throw() | |||
| { | |||
| ItemInfo* const item = getItemForIndex (index); | |||
| return (item != 0) ? item->id : 0; | |||
| return (item != 0) ? item->itemId : 0; | |||
| } | |||
| @@ -310,7 +310,7 @@ int ComboBox::getSelectedId() const throw() | |||
| const ItemInfo* const item = getItemForIndex (currentIndex); | |||
| return (item != 0 && getText() == item->name) | |||
| ? item->id | |||
| ? item->itemId | |||
| : 0; | |||
| } | |||
| @@ -352,7 +352,7 @@ void ComboBox::setText (const String& newText, | |||
| if (item->isRealItem() | |||
| && item->name == newText) | |||
| { | |||
| setSelectedId (item->id, dontSendChangeMessage); | |||
| setSelectedId (item->itemId, dontSendChangeMessage); | |||
| return; | |||
| } | |||
| } | |||
| @@ -555,7 +555,8 @@ void ComboBox::showPopup() | |||
| else if (item->isHeading) | |||
| menu.addSectionHeader (item->name); | |||
| else | |||
| menu.addItem (item->id, item->name, item->isEnabled, item->id == currentId); | |||
| menu.addItem (item->itemId, item->name, | |||
| item->isEnabled, item->itemId == currentId); | |||
| } | |||
| if (items.size() == 0) | |||
| @@ -371,7 +371,7 @@ private: | |||
| struct ItemInfo | |||
| { | |||
| String name; | |||
| int id; | |||
| int itemId; | |||
| bool isEnabled : 1, isHeading : 1; | |||
| bool isSeparator() const throw(); | |||
| @@ -389,7 +389,7 @@ private: | |||
| void showPopup(); | |||
| ItemInfo* getItemForId (const int id) const throw(); | |||
| ItemInfo* getItemForId (const int itemId) const throw(); | |||
| ItemInfo* getItemForIndex (const int index) const throw(); | |||
| ComboBox (const ComboBox&); | |||
| @@ -230,7 +230,7 @@ void TableHeaderComponent::setColumnWidth (const int columnId, const int newWidt | |||
| } | |||
| //============================================================================== | |||
| int TableHeaderComponent::getIndexOfColumnId (const int id, const bool onlyCountVisibleColumns) const throw() | |||
| int TableHeaderComponent::getIndexOfColumnId (const int columnId, const bool onlyCountVisibleColumns) const throw() | |||
| { | |||
| int n = 0; | |||
| @@ -238,7 +238,7 @@ int TableHeaderComponent::getIndexOfColumnId (const int id, const bool onlyCount | |||
| { | |||
| if ((! onlyCountVisibleColumns) || columns.getUnchecked(i)->isVisible()) | |||
| { | |||
| if (columns.getUnchecked(i)->id == id) | |||
| if (columns.getUnchecked(i)->id == columnId) | |||
| return n; | |||
| ++n; | |||
| @@ -474,15 +474,15 @@ void TableHeaderComponent::restoreFromString (const String& storedVersion) | |||
| { | |||
| forEachXmlChildElement (*storedXml, col) | |||
| { | |||
| const int id = col->getIntAttribute (T("id")); | |||
| const int tabId = col->getIntAttribute (T("id")); | |||
| ColumnInfo* const ci = getInfoForId (id); | |||
| ColumnInfo* const ci = getInfoForId (tabId); | |||
| if (ci != 0) | |||
| { | |||
| columns.move (columns.indexOf (ci), index); | |||
| ci->width = col->getIntAttribute (T("width")); | |||
| setColumnVisible (id, col->getBoolAttribute (T("visible"))); | |||
| setColumnVisible (tabId, col->getBoolAttribute (T("visible"))); | |||
| } | |||
| ++index; | |||
| @@ -261,7 +261,7 @@ public: | |||
| If onlyCountVisibleColumns is true, this will return the index amoungst the visible columns; | |||
| otherwise it'll return the index amongst all the columns, including any hidden ones. | |||
| */ | |||
| int getIndexOfColumnId (const int id, const bool onlyCountVisibleColumns) const throw(); | |||
| int getIndexOfColumnId (const int columnId, const bool onlyCountVisibleColumns) const throw(); | |||
| /** Returns the ID of the column at a given index. | |||
| @@ -418,7 +418,7 @@ private: | |||
| int columnIdBeingResized, columnIdBeingDragged, initialColumnWidth; | |||
| int columnIdUnderMouse, draggingColumnOffset, draggingColumnOriginalIndex, lastDeliberateWidth; | |||
| ColumnInfo* getInfoForId (const int id) const throw(); | |||
| ColumnInfo* getInfoForId (const int columnId) const throw(); | |||
| int visibleIndexToTotalIndex (const int visibleIndex) const throw(); | |||
| void sendColumnsChanged(); | |||
| void handleAsyncUpdate(); | |||
| @@ -45,7 +45,7 @@ BEGIN_JUCE_NAMESPACE | |||
| #include "juce_ComboBox.h" | |||
| #include "../buttons/juce_TextButton.h" | |||
| const tchar* const toolbarDragDescriptor = T("_toolbarItem_"); // also in ToolbarItemComponent.cpp | |||
| const tchar* const Toolbar::toolbarDragDescriptor = T("_toolbarItem_"); | |||
| //============================================================================== | |||
| @@ -305,6 +305,9 @@ private: | |||
| ToolbarItemStyle toolbarStyle; | |||
| ComponentAnimator animator; | |||
| friend class ItemDragAndDropOverlayComponent; | |||
| static const tchar* const toolbarDragDescriptor; | |||
| void addItemInternal (ToolbarItemFactory& factory, const int itemId, const int insertIndex); | |||
| ToolbarItemComponent* getNextActiveComponent (int index, const int delta) const; | |||
| @@ -40,8 +40,6 @@ BEGIN_JUCE_NAMESPACE | |||
| #include "../lookandfeel/juce_LookAndFeel.h" | |||
| #include "../layout/juce_StretchableObjectResizer.h" | |||
| const tchar* const toolbarDragDescriptor = T("_toolbarItem_"); // also in Toolbar.cpp | |||
| //============================================================================== | |||
| ToolbarItemFactory::ToolbarItemFactory() | |||
| @@ -104,7 +102,7 @@ public: | |||
| if (dnd != 0) | |||
| { | |||
| dnd->startDragging (toolbarDragDescriptor, getParentComponent(), 0, true); | |||
| dnd->startDragging (Toolbar::toolbarDragDescriptor, getParentComponent(), 0, true); | |||
| ToolbarItemComponent* const tc = dynamic_cast <ToolbarItemComponent*> (getParentComponent()); | |||
| @@ -37,10 +37,12 @@ BEGIN_JUCE_NAMESPACE | |||
| #include "../../graphics/imaging/juce_ImageCache.h" | |||
| void* juce_findFileStart (const String& directory, const String& wildCard, String& firstResultFile, | |||
| bool* isDirectory, bool* isHidden, int64* fileSize, Time* modTime, Time* creationTime, bool* isReadOnly); | |||
| bool* isDirectory, bool* isHidden, int64* fileSize, Time* modTime, | |||
| Time* creationTime, bool* isReadOnly) throw(); | |||
| bool juce_findFileNext (void* handle, String& resultFile, | |||
| bool* isDirectory, bool* isHidden, int64* fileSize, Time* modTime, Time* creationTime, bool* isReadOnly); | |||
| void juce_findFileClose (void* handle); | |||
| bool* isDirectory, bool* isHidden, int64* fileSize, | |||
| Time* modTime, Time* creationTime, bool* isReadOnly) throw(); | |||
| void juce_findFileClose (void* handle) throw(); | |||
| //============================================================================== | |||
| @@ -104,8 +104,6 @@ static bool isUnboundedMouseModeOn = false; | |||
| static bool isCursorVisibleUntilOffscreen; | |||
| //============================================================================== | |||
| const int juce_windowIsSemiTransparentFlag = (1 << 31); // duplicated in native windowing code | |||
| #define checkMessageManagerIsLocked jassert (MessageManager::getInstance()->currentThreadHasLockedMessageManager()); | |||
| static uint32 nextComponentUID = 0; | |||
| @@ -439,7 +437,7 @@ void Component::addToDesktop (int styleWanted, void* nativeWindowToAttachTo) | |||
| checkMessageManagerIsLocked | |||
| if (! isOpaque()) | |||
| styleWanted |= juce_windowIsSemiTransparentFlag; | |||
| styleWanted |= ComponentPeer::windowIsSemiTransparent; | |||
| int currentStyleFlags = 0; | |||
| @@ -43,7 +43,7 @@ extern void juce_updateMultiMonitorInfo (Array <Rectangle>& monitorCoords, | |||
| //============================================================================== | |||
| static Desktop* instance = 0; | |||
| static Desktop* juce_desktopInstance = 0; | |||
| Desktop::Desktop() throw() | |||
| : mouseListeners (2), | |||
| @@ -58,8 +58,8 @@ Desktop::Desktop() throw() | |||
| Desktop::~Desktop() throw() | |||
| { | |||
| jassert (instance == this); | |||
| instance = 0; | |||
| jassert (juce_desktopInstance == this); | |||
| juce_desktopInstance = 0; | |||
| // doh! If you don't delete all your windows before exiting, you're going to | |||
| // be leaking memory! | |||
| @@ -68,10 +68,10 @@ Desktop::~Desktop() throw() | |||
| Desktop& JUCE_CALLTYPE Desktop::getInstance() throw() | |||
| { | |||
| if (instance == 0) | |||
| instance = new Desktop(); | |||
| if (juce_desktopInstance == 0) | |||
| juce_desktopInstance = new Desktop(); | |||
| return *instance; | |||
| return *juce_desktopInstance; | |||
| } | |||
| //============================================================================== | |||
| @@ -438,8 +438,8 @@ QuickTimeMovieComponent::~QuickTimeMovieComponent() | |||
| activeQTWindows.removeValue ((void*) this); | |||
| QTMovieCompInternal* const id = (QTMovieCompInternal*) internal; | |||
| delete id; | |||
| QTMovieCompInternal* const i = (QTMovieCompInternal*) internal; | |||
| delete i; | |||
| if (activeQTWindows.size() == 0 && isQTAvailable) | |||
| { | |||
| @@ -480,15 +480,15 @@ bool QuickTimeMovieComponent::loadMovie (InputStream* movieStream, | |||
| controllerVisible = controllerVisible_; | |||
| QTMovieCompInternal* const id = (QTMovieCompInternal*) internal; | |||
| QTMovieCompInternal* const qmci = (QTMovieCompInternal*) internal; | |||
| GrafPtr savedPort; | |||
| GetPort (&savedPort); | |||
| bool result = false; | |||
| if (juce_OpenQuickTimeMovieFromStream (movieStream, id->movie, id->dataHandle)) | |||
| if (juce_OpenQuickTimeMovieFromStream (movieStream, qmci->movie, qmci->dataHandle)) | |||
| { | |||
| id->controller = 0; | |||
| qmci->controller = 0; | |||
| void* window = getWindowHandle(); | |||
| @@ -497,8 +497,8 @@ bool QuickTimeMovieComponent::loadMovie (InputStream* movieStream, | |||
| assignMovieToWindow(); | |||
| SetMovieActive (id->movie, true); | |||
| SetMovieProgressProc (id->movie, (MovieProgressUPP) -1, 0); | |||
| SetMovieActive (qmci->movie, true); | |||
| SetMovieProgressProc (qmci->movie, (MovieProgressUPP) -1, 0); | |||
| startTimer (1000 / 50); // this needs to be quite a high frequency for smooth playback | |||
| result = true; | |||
| @@ -515,21 +515,21 @@ void QuickTimeMovieComponent::closeMovie() | |||
| { | |||
| stop(); | |||
| QTMovieCompInternal* const id = (QTMovieCompInternal*) internal; | |||
| QTMovieCompInternal* const qmci = (QTMovieCompInternal*) internal; | |||
| if (id->controller != 0) | |||
| if (qmci->controller != 0) | |||
| { | |||
| DisposeMovieController (id->controller); | |||
| id->controller = 0; | |||
| DisposeMovieController (qmci->controller); | |||
| qmci->controller = 0; | |||
| } | |||
| if (id->movie != 0) | |||
| if (qmci->movie != 0) | |||
| { | |||
| DisposeMovie (id->movie); | |||
| id->movie = 0; | |||
| DisposeMovie (qmci->movie); | |||
| qmci->movie = 0; | |||
| } | |||
| id->clearHandle(); | |||
| qmci->clearHandle(); | |||
| stopTimer(); | |||
| movieFile = File::nonexistent; | |||
| @@ -537,8 +537,8 @@ void QuickTimeMovieComponent::closeMovie() | |||
| bool QuickTimeMovieComponent::isMovieOpen() const | |||
| { | |||
| QTMovieCompInternal* const id = (QTMovieCompInternal*) internal; | |||
| return id->movie != 0 && id->controller != 0; | |||
| QTMovieCompInternal* const qmci = (QTMovieCompInternal*) internal; | |||
| return qmci->movie != 0 && qmci->controller != 0; | |||
| } | |||
| const File QuickTimeMovieComponent::getCurrentMovieFile() const | |||
| @@ -561,11 +561,11 @@ void QuickTimeMovieComponent::assignMovieToWindow() | |||
| reentrant = true; | |||
| QTMovieCompInternal* const id = (QTMovieCompInternal*) internal; | |||
| if (id->controller != 0) | |||
| QTMovieCompInternal* const qmci = (QTMovieCompInternal*) internal; | |||
| if (qmci->controller != 0) | |||
| { | |||
| DisposeMovieController (id->controller); | |||
| id->controller = 0; | |||
| DisposeMovieController (qmci->controller); | |||
| qmci->controller = 0; | |||
| } | |||
| controllerAssignedToWindow = false; | |||
| @@ -578,7 +578,7 @@ void QuickTimeMovieComponent::assignMovieToWindow() | |||
| GrafPtr savedPort; | |||
| GetPort (&savedPort); | |||
| SetMovieGWorld (id->movie, (CGrafPtr) port, 0); | |||
| SetMovieGWorld (qmci->movie, (CGrafPtr) port, 0); | |||
| MacSetPort (port); | |||
| Rect r; | |||
| @@ -586,25 +586,25 @@ void QuickTimeMovieComponent::assignMovieToWindow() | |||
| r.left = 0; | |||
| r.right = (short) jmax (1, getWidth()); | |||
| r.bottom = (short) jmax (1, getHeight()); | |||
| SetMovieBox (id->movie, &r); | |||
| SetMovieBox (qmci->movie, &r); | |||
| // create the movie controller | |||
| id->controller = NewMovieController (id->movie, &r, | |||
| controllerVisible ? mcTopLeftMovie | |||
| : mcNotVisible); | |||
| qmci->controller = NewMovieController (qmci->movie, &r, | |||
| controllerVisible ? mcTopLeftMovie | |||
| : mcNotVisible); | |||
| if (id->controller != 0) | |||
| if (qmci->controller != 0) | |||
| { | |||
| MCEnableEditing (id->controller, true); | |||
| MCEnableEditing (qmci->controller, true); | |||
| MCDoAction (id->controller, mcActionSetUseBadge, (void*) false); | |||
| MCDoAction (id->controller, mcActionSetLoopIsPalindrome, (void*) false); | |||
| MCDoAction (qmci->controller, mcActionSetUseBadge, (void*) false); | |||
| MCDoAction (qmci->controller, mcActionSetLoopIsPalindrome, (void*) false); | |||
| setLooping (looping); | |||
| MCDoAction (id->controller, mcActionSetFlags, | |||
| MCDoAction (qmci->controller, mcActionSetFlags, | |||
| (void*) (pointer_sized_int) (mcFlagSuppressMovieFrame | (controllerVisible ? 0 : (mcFlagSuppressStepButtons | mcFlagSuppressSpeakerButton)))); | |||
| MCSetControllerBoundsRect (id->controller, &r); | |||
| MCSetControllerBoundsRect (qmci->controller, &r); | |||
| controllerAssignedToWindow = true; | |||
| @@ -615,7 +615,7 @@ void QuickTimeMovieComponent::assignMovieToWindow() | |||
| } | |||
| else | |||
| { | |||
| SetMovieGWorld (id->movie, 0, 0); | |||
| SetMovieGWorld (qmci->movie, 0, 0); | |||
| } | |||
| reentrant = false; | |||
| @@ -623,41 +623,41 @@ void QuickTimeMovieComponent::assignMovieToWindow() | |||
| void QuickTimeMovieComponent::play() | |||
| { | |||
| QTMovieCompInternal* const id = (QTMovieCompInternal*) internal; | |||
| QTMovieCompInternal* const qmci = (QTMovieCompInternal*) internal; | |||
| if (id->movie != 0) | |||
| StartMovie (id->movie); | |||
| if (qmci->movie != 0) | |||
| StartMovie (qmci->movie); | |||
| } | |||
| void QuickTimeMovieComponent::stop() | |||
| { | |||
| QTMovieCompInternal* const id = (QTMovieCompInternal*) internal; | |||
| QTMovieCompInternal* const qmci = (QTMovieCompInternal*) internal; | |||
| if (id->movie != 0) | |||
| StopMovie (id->movie); | |||
| if (qmci->movie != 0) | |||
| StopMovie (qmci->movie); | |||
| } | |||
| bool QuickTimeMovieComponent::isPlaying() const | |||
| { | |||
| QTMovieCompInternal* const id = (QTMovieCompInternal*) internal; | |||
| QTMovieCompInternal* const qmci = (QTMovieCompInternal*) internal; | |||
| return id->movie != 0 && GetMovieRate (id->movie) != 0; | |||
| return qmci->movie != 0 && GetMovieRate (qmci->movie) != 0; | |||
| } | |||
| void QuickTimeMovieComponent::setPosition (const double seconds) | |||
| { | |||
| QTMovieCompInternal* const id = (QTMovieCompInternal*) internal; | |||
| QTMovieCompInternal* const qmci = (QTMovieCompInternal*) internal; | |||
| if (id->controller != 0) | |||
| if (qmci->controller != 0) | |||
| { | |||
| TimeRecord time; | |||
| time.base = GetMovieTimeBase (id->movie); | |||
| time.base = GetMovieTimeBase (qmci->movie); | |||
| time.scale = 100000; | |||
| const uint64 t = (uint64) (100000.0 * seconds); | |||
| time.value.lo = (UInt32) (t & 0xffffffff); | |||
| time.value.hi = (UInt32) (t >> 32); | |||
| SetMovieTime (id->movie, &time); | |||
| SetMovieTime (qmci->movie, &time); | |||
| timerCallback(); // to call MCIdle | |||
| } | |||
| else | |||
| @@ -668,12 +668,12 @@ void QuickTimeMovieComponent::setPosition (const double seconds) | |||
| double QuickTimeMovieComponent::getPosition() const | |||
| { | |||
| QTMovieCompInternal* const id = (QTMovieCompInternal*) internal; | |||
| QTMovieCompInternal* const qmci = (QTMovieCompInternal*) internal; | |||
| if (id->movie != 0) | |||
| if (qmci->movie != 0) | |||
| { | |||
| TimeRecord time; | |||
| GetMovieTime (id->movie, &time); | |||
| GetMovieTime (qmci->movie, &time); | |||
| return ((int64) (((uint64) time.value.hi << 32) | (uint64) time.value.lo)) | |||
| / (double) time.scale; | |||
| @@ -684,29 +684,29 @@ double QuickTimeMovieComponent::getPosition() const | |||
| void QuickTimeMovieComponent::setSpeed (const float newSpeed) | |||
| { | |||
| QTMovieCompInternal* const id = (QTMovieCompInternal*) internal; | |||
| QTMovieCompInternal* const qmci = (QTMovieCompInternal*) internal; | |||
| if (id->movie != 0) | |||
| SetMovieRate (id->movie, (Fixed) (newSpeed * (Fixed) 0x00010000L)); | |||
| if (qmci->movie != 0) | |||
| SetMovieRate (qmci->movie, (Fixed) (newSpeed * (Fixed) 0x00010000L)); | |||
| } | |||
| double QuickTimeMovieComponent::getMovieDuration() const | |||
| { | |||
| QTMovieCompInternal* const id = (QTMovieCompInternal*) internal; | |||
| QTMovieCompInternal* const qmci = (QTMovieCompInternal*) internal; | |||
| if (id->movie != 0) | |||
| return GetMovieDuration (id->movie) / (double) GetMovieTimeScale (id->movie); | |||
| if (qmci->movie != 0) | |||
| return GetMovieDuration (qmci->movie) / (double) GetMovieTimeScale (qmci->movie); | |||
| return 0.0; | |||
| } | |||
| void QuickTimeMovieComponent::setLooping (const bool shouldLoop) | |||
| { | |||
| QTMovieCompInternal* const id = (QTMovieCompInternal*) internal; | |||
| QTMovieCompInternal* const qmci = (QTMovieCompInternal*) internal; | |||
| looping = shouldLoop; | |||
| if (id->controller != 0) | |||
| MCDoAction (id->controller, mcActionSetLooping, (void*) shouldLoop); | |||
| if (qmci->controller != 0) | |||
| MCDoAction (qmci->controller, mcActionSetLooping, (void*) shouldLoop); | |||
| } | |||
| bool QuickTimeMovieComponent::isLooping() const | |||
| @@ -716,18 +716,18 @@ bool QuickTimeMovieComponent::isLooping() const | |||
| void QuickTimeMovieComponent::setMovieVolume (const float newVolume) | |||
| { | |||
| QTMovieCompInternal* const id = (QTMovieCompInternal*) internal; | |||
| QTMovieCompInternal* const qmci = (QTMovieCompInternal*) internal; | |||
| if (id->movie != 0) | |||
| SetMovieVolume (id->movie, jlimit ((short) 0, (short) 0x100, (short) (newVolume * 0x0100))); | |||
| if (qmci->movie != 0) | |||
| SetMovieVolume (qmci->movie, jlimit ((short) 0, (short) 0x100, (short) (newVolume * 0x0100))); | |||
| } | |||
| float QuickTimeMovieComponent::getMovieVolume() const | |||
| { | |||
| QTMovieCompInternal* const id = (QTMovieCompInternal*) internal; | |||
| QTMovieCompInternal* const qmci = (QTMovieCompInternal*) internal; | |||
| if (id->movie != 0) | |||
| return jmax (0.0f, GetMovieVolume (id->movie) / (float) 0x0100); | |||
| if (qmci->movie != 0) | |||
| return jmax (0.0f, GetMovieVolume (qmci->movie) / (float) 0x0100); | |||
| return 0.0f; | |||
| } | |||
| @@ -737,12 +737,12 @@ void QuickTimeMovieComponent::getMovieNormalSize (int& width, int& height) const | |||
| width = 0; | |||
| height = 0; | |||
| QTMovieCompInternal* const id = (QTMovieCompInternal*) internal; | |||
| QTMovieCompInternal* const qmci = (QTMovieCompInternal*) internal; | |||
| if (id->movie != 0) | |||
| if (qmci->movie != 0) | |||
| { | |||
| Rect r; | |||
| GetMovieNaturalBoundsRect (id->movie, &r); | |||
| GetMovieNaturalBoundsRect (qmci->movie, &r); | |||
| width = r.right - r.left; | |||
| height = r.bottom - r.top; | |||
| } | |||
| @@ -750,9 +750,9 @@ void QuickTimeMovieComponent::getMovieNormalSize (int& width, int& height) const | |||
| void QuickTimeMovieComponent::paint (Graphics& g) | |||
| { | |||
| QTMovieCompInternal* const id = (QTMovieCompInternal*) internal; | |||
| QTMovieCompInternal* const qmci = (QTMovieCompInternal*) internal; | |||
| if (id->movie == 0 || id->controller == 0) | |||
| if (qmci->movie == 0 || qmci->controller == 0) | |||
| { | |||
| g.fillAll (Colours::black); | |||
| return; | |||
| @@ -762,7 +762,7 @@ void QuickTimeMovieComponent::paint (Graphics& g) | |||
| GetPort (&savedPort); | |||
| MacSetPort (getPortForWindow (getWindowHandle())); | |||
| MCDraw (id->controller, (WindowRef) getWindowHandle()); | |||
| MCDraw (qmci->controller, (WindowRef) getWindowHandle()); | |||
| MacSetPort (savedPort); | |||
| @@ -793,9 +793,9 @@ void QuickTimeMovieComponent::moved() | |||
| void QuickTimeMovieComponent::resized() | |||
| { | |||
| QTMovieCompInternal* const id = (QTMovieCompInternal*) internal; | |||
| QTMovieCompInternal* const qmci = (QTMovieCompInternal*) internal; | |||
| if (id->controller != 0 && isShowing()) | |||
| if (qmci->controller != 0 && isShowing()) | |||
| { | |||
| checkWindowAssociation(); | |||
| @@ -806,7 +806,7 @@ void QuickTimeMovieComponent::resized() | |||
| GrafPtr savedPort; | |||
| GetPort (&savedPort); | |||
| SetMovieGWorld (id->movie, (CGrafPtr) port, 0); | |||
| SetMovieGWorld (qmci->movie, (CGrafPtr) port, 0); | |||
| MacSetPort (port); | |||
| lastPositionApplied = getMoviePos (this); | |||
| @@ -817,10 +817,10 @@ void QuickTimeMovieComponent::resized() | |||
| r.right = (short) lastPositionApplied.getRight(); | |||
| r.bottom = (short) lastPositionApplied.getBottom(); | |||
| if (MCGetVisible (id->controller)) | |||
| MCSetControllerBoundsRect (id->controller, &r); | |||
| if (MCGetVisible (qmci->controller)) | |||
| MCSetControllerBoundsRect (qmci->controller, &r); | |||
| else | |||
| SetMovieBox (id->movie, &r); | |||
| SetMovieBox (qmci->movie, &r); | |||
| if (! isPlaying()) | |||
| timerCallback(); | |||
| @@ -840,14 +840,14 @@ void QuickTimeMovieComponent::visibilityChanged() | |||
| void QuickTimeMovieComponent::timerCallback() | |||
| { | |||
| QTMovieCompInternal* const id = (QTMovieCompInternal*) internal; | |||
| QTMovieCompInternal* const qmci = (QTMovieCompInternal*) internal; | |||
| if (id->controller != 0) | |||
| if (qmci->controller != 0) | |||
| { | |||
| if (isTimerRunning()) | |||
| startTimer (getTimerInterval()); | |||
| MCIdle (id->controller); | |||
| MCIdle (qmci->controller); | |||
| if (lastPositionApplied != getMoviePos (this)) | |||
| resized(); | |||
| @@ -873,9 +873,9 @@ void QuickTimeMovieComponent::parentHierarchyChanged() | |||
| void QuickTimeMovieComponent::handleMCEvent (void* ev) | |||
| { | |||
| QTMovieCompInternal* const id = (QTMovieCompInternal*) internal; | |||
| QTMovieCompInternal* const qmci = (QTMovieCompInternal*) internal; | |||
| if (id->controller != 0 && isShowing()) | |||
| if (qmci->controller != 0 && isShowing()) | |||
| { | |||
| MacClickEventData* data = (MacClickEventData*) ev; | |||
| @@ -883,14 +883,14 @@ void QuickTimeMovieComponent::handleMCEvent (void* ev) | |||
| data->where.v -= getTopLevelComponent()->getScreenY(); | |||
| Boolean b = false; | |||
| MCPtInController (id->controller, data->where, &b); | |||
| MCPtInController (qmci->controller, data->where, &b); | |||
| if (b) | |||
| { | |||
| const int oldTimeBeforeWaitCursor = MessageManager::getInstance()->getTimeBeforeShowingWaitCursor(); | |||
| MessageManager::getInstance()->setTimeBeforeShowingWaitCursor (0); | |||
| MCClick (id->controller, | |||
| MCClick (qmci->controller, | |||
| (WindowRef) getWindowHandle(), | |||
| data->where, | |||
| data->when, | |||
| @@ -78,9 +78,11 @@ public: | |||
| close button on it. */ | |||
| windowHasDropShadow = (1 << 8), /**< Indicates that the window should have a drop-shadow (this may | |||
| not be possible on all platforms). */ | |||
| windowRepaintedExplictly = (1 << 9) /**< Not intended for public use - this tells a window not to | |||
| windowRepaintedExplictly = (1 << 9), /**< Not intended for public use - this tells a window not to | |||
| do its own repainting, but only to repaint when the | |||
| performAnyPendingRepaintsNow() method is called. */ | |||
| windowIsSemiTransparent = (1 << 31) /**< Not intended for public use - makes a window transparent. */ | |||
| }; | |||
| //============================================================================== | |||
| @@ -266,8 +266,6 @@ void TopLevelWindow::recreateDesktopWindow() | |||
| } | |||
| } | |||
| const int juce_windowIsSemiTransparentFlag = (1 << 31); // duplicated in native windowing code | |||
| void TopLevelWindow::addToDesktop (int windowStyleFlags, void* nativeWindowToAttachTo) | |||
| { | |||
| /* It's not recommended to change the desktop window flags directly for a TopLevelWindow, | |||
| @@ -279,8 +277,8 @@ void TopLevelWindow::addToDesktop (int windowStyleFlags, void* nativeWindowToAtt | |||
| method, then add or remove whatever flags are necessary from this value before returning it. | |||
| */ | |||
| jassert ((windowStyleFlags & ~juce_windowIsSemiTransparentFlag) | |||
| == (getDesktopWindowStyleFlags() & ~juce_windowIsSemiTransparentFlag)); | |||
| jassert ((windowStyleFlags & ~ComponentPeer::windowIsSemiTransparent) | |||
| == (getDesktopWindowStyleFlags() & ~ComponentPeer::windowIsSemiTransparent)); | |||
| Component::addToDesktop (windowStyleFlags, nativeWindowToAttachTo); | |||
| @@ -46,6 +46,7 @@ static const Graphics::ResamplingQuality defaultQuality = Graphics::mediumResamp | |||
| #define MINIMUM_COORD -0x3fffffff | |||
| #define MAXIMUM_COORD 0x3fffffff | |||
| #undef ASSERT_COORDS_ARE_SENSIBLE_NUMBERS | |||
| #define ASSERT_COORDS_ARE_SENSIBLE_NUMBERS(x, y, w, h) \ | |||
| jassert ((int) x >= MINIMUM_COORD \ | |||
| && (int) x <= MAXIMUM_COORD \ | |||
| @@ -52,6 +52,7 @@ BEGIN_JUCE_NAMESPACE | |||
| #define MINIMUM_COORD -0x3fffffff | |||
| #define MAXIMUM_COORD 0x3fffffff | |||
| #undef ASSERT_COORDS_ARE_SENSIBLE_NUMBERS | |||
| #define ASSERT_COORDS_ARE_SENSIBLE_NUMBERS(x, y, w, h) \ | |||
| jassert ((int) x >= MINIMUM_COORD \ | |||
| && (int) x <= MAXIMUM_COORD \ | |||
| @@ -43,11 +43,11 @@ BEGIN_JUCE_NAMESPACE | |||
| jassert (x == x && y == y); | |||
| //============================================================================== | |||
| static const float lineMarker = 100001.0f; | |||
| static const float moveMarker = 100002.0f; | |||
| static const float quadMarker = 100003.0f; | |||
| static const float cubicMarker = 100004.0f; | |||
| static const float closeSubPathMarker = 100005.0f; | |||
| const float Path::lineMarker = 100001.0f; | |||
| const float Path::moveMarker = 100002.0f; | |||
| const float Path::quadMarker = 100003.0f; | |||
| const float Path::cubicMarker = 100004.0f; | |||
| const float Path::closeSubPathMarker = 100005.0f; | |||
| static const int defaultGranularity = 32; | |||
| @@ -619,6 +619,12 @@ private: | |||
| int numElements; | |||
| float pathXMin, pathXMax, pathYMin, pathYMax; | |||
| bool useNonZeroWinding; | |||
| static const float lineMarker; | |||
| static const float moveMarker; | |||
| static const float quadMarker; | |||
| static const float cubicMarker; | |||
| static const float closeSubPathMarker; | |||
| }; | |||
| #endif // __JUCE_PATH_JUCEHEADER__ | |||
| @@ -40,14 +40,6 @@ BEGIN_JUCE_NAMESPACE | |||
| #pragma optimize ("t", on) | |||
| #endif | |||
| //============================================================================== | |||
| static const float lineMarker = 100001.0f; | |||
| static const float moveMarker = 100002.0f; | |||
| static const float quadMarker = 100003.0f; | |||
| static const float cubicMarker = 100004.0f; | |||
| static const float closePathMarker = 100005.0f; | |||
| //============================================================================== | |||
| PathFlatteningIterator::PathFlatteningIterator (const Path& path_, | |||
| const AffineTransform& transform_, | |||
| @@ -98,7 +90,7 @@ bool PathFlatteningIterator::next() throw() | |||
| { | |||
| type = points [index++]; | |||
| if (type != closePathMarker) | |||
| if (type != Path::closeSubPathMarker) | |||
| { | |||
| x2 = points [index++]; | |||
| y2 = points [index++]; | |||
| @@ -106,7 +98,7 @@ bool PathFlatteningIterator::next() throw() | |||
| if (! isIdentityTransform) | |||
| transform.transformPoint (x2, y2); | |||
| if (type == quadMarker) | |||
| if (type == Path::quadMarker) | |||
| { | |||
| x3 = points [index++]; | |||
| y3 = points [index++]; | |||
| @@ -114,7 +106,7 @@ bool PathFlatteningIterator::next() throw() | |||
| if (! isIdentityTransform) | |||
| transform.transformPoint (x3, y3); | |||
| } | |||
| else if (type == cubicMarker) | |||
| else if (type == Path::cubicMarker) | |||
| { | |||
| x3 = points [index++]; | |||
| y3 = points [index++]; | |||
| @@ -134,17 +126,17 @@ bool PathFlatteningIterator::next() throw() | |||
| { | |||
| type = *--stackPos; | |||
| if (type != closePathMarker) | |||
| if (type != Path::closeSubPathMarker) | |||
| { | |||
| x2 = *--stackPos; | |||
| y2 = *--stackPos; | |||
| if (type == quadMarker) | |||
| if (type == Path::quadMarker) | |||
| { | |||
| x3 = *--stackPos; | |||
| y3 = *--stackPos; | |||
| } | |||
| else if (type == cubicMarker) | |||
| else if (type == Path::cubicMarker) | |||
| { | |||
| x3 = *--stackPos; | |||
| y3 = *--stackPos; | |||
| @@ -154,19 +146,19 @@ bool PathFlatteningIterator::next() throw() | |||
| } | |||
| } | |||
| if (type == lineMarker) | |||
| if (type == Path::lineMarker) | |||
| { | |||
| ++subPathIndex; | |||
| closesSubPath = (stackPos == stackBase) | |||
| && (index < path.numElements) | |||
| && (points [index] == closePathMarker) | |||
| && (points [index] == Path::closeSubPathMarker) | |||
| && x2 == subPathCloseX | |||
| && y2 == subPathCloseY; | |||
| return true; | |||
| } | |||
| else if (type == quadMarker) | |||
| else if (type == Path::quadMarker) | |||
| { | |||
| const int offset = (int) (stackPos - stackBase); | |||
| @@ -195,28 +187,28 @@ bool PathFlatteningIterator::next() throw() | |||
| *stackPos++ = x3; | |||
| *stackPos++ = m2y; | |||
| *stackPos++ = m2x; | |||
| *stackPos++ = quadMarker; | |||
| *stackPos++ = Path::quadMarker; | |||
| *stackPos++ = m3y; | |||
| *stackPos++ = m3x; | |||
| *stackPos++ = m1y; | |||
| *stackPos++ = m1x; | |||
| *stackPos++ = quadMarker; | |||
| *stackPos++ = Path::quadMarker; | |||
| } | |||
| else | |||
| { | |||
| *stackPos++ = y3; | |||
| *stackPos++ = x3; | |||
| *stackPos++ = lineMarker; | |||
| *stackPos++ = Path::lineMarker; | |||
| *stackPos++ = m3y; | |||
| *stackPos++ = m3x; | |||
| *stackPos++ = lineMarker; | |||
| *stackPos++ = Path::lineMarker; | |||
| } | |||
| jassert (stackPos < stackBase + stackSize); | |||
| } | |||
| else if (type == cubicMarker) | |||
| else if (type == Path::cubicMarker) | |||
| { | |||
| const int offset = (int) (stackPos - stackBase); | |||
| @@ -254,7 +246,7 @@ bool PathFlatteningIterator::next() throw() | |||
| *stackPos++ = m3x; | |||
| *stackPos++ = m5y; | |||
| *stackPos++ = m5x; | |||
| *stackPos++ = cubicMarker; | |||
| *stackPos++ = Path::cubicMarker; | |||
| *stackPos++ = (m4y + m5y) * 0.5f; | |||
| *stackPos++ = (m4x + m5x) * 0.5f; | |||
| @@ -262,24 +254,24 @@ bool PathFlatteningIterator::next() throw() | |||
| *stackPos++ = m4x; | |||
| *stackPos++ = m1y; | |||
| *stackPos++ = m1x; | |||
| *stackPos++ = cubicMarker; | |||
| *stackPos++ = Path::cubicMarker; | |||
| } | |||
| else | |||
| { | |||
| *stackPos++ = y4; | |||
| *stackPos++ = x4; | |||
| *stackPos++ = lineMarker; | |||
| *stackPos++ = Path::lineMarker; | |||
| *stackPos++ = m5y; | |||
| *stackPos++ = m5x; | |||
| *stackPos++ = lineMarker; | |||
| *stackPos++ = Path::lineMarker; | |||
| *stackPos++ = m4y; | |||
| *stackPos++ = m4x; | |||
| *stackPos++ = lineMarker; | |||
| *stackPos++ = Path::lineMarker; | |||
| } | |||
| } | |||
| else if (type == closePathMarker) | |||
| else if (type == Path::closeSubPathMarker) | |||
| { | |||
| if (x2 != subPathCloseX || y2 != subPathCloseY) | |||
| { | |||
| @@ -16,6 +16,9 @@ | |||
| * Hence the magnitude should always fit in 10 or 14 bits respectively. | |||
| */ | |||
| #ifndef _jchuff_h_ | |||
| #define _jchuff_h_ | |||
| #if BITS_IN_JSAMPLE == 8 | |||
| #define MAX_COEF_BITS 10 | |||
| #else | |||
| @@ -45,3 +48,5 @@ EXTERN(void) jpeg_make_c_derived_tbl | |||
| /* Generate an optimal table definition given the specified counts */ | |||
| EXTERN(void) jpeg_gen_optimal_table | |||
| JPP((j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[])); | |||
| #endif | |||
| @@ -13,73 +13,6 @@ | |||
| #include "jpeglib.h" | |||
| typedef enum { /* JPEG marker codes */ | |||
| M_SOF0 = 0xc0, | |||
| M_SOF1 = 0xc1, | |||
| M_SOF2 = 0xc2, | |||
| M_SOF3 = 0xc3, | |||
| M_SOF5 = 0xc5, | |||
| M_SOF6 = 0xc6, | |||
| M_SOF7 = 0xc7, | |||
| M_JPG = 0xc8, | |||
| M_SOF9 = 0xc9, | |||
| M_SOF10 = 0xca, | |||
| M_SOF11 = 0xcb, | |||
| M_SOF13 = 0xcd, | |||
| M_SOF14 = 0xce, | |||
| M_SOF15 = 0xcf, | |||
| M_DHT = 0xc4, | |||
| M_DAC = 0xcc, | |||
| M_RST0 = 0xd0, | |||
| M_RST1 = 0xd1, | |||
| M_RST2 = 0xd2, | |||
| M_RST3 = 0xd3, | |||
| M_RST4 = 0xd4, | |||
| M_RST5 = 0xd5, | |||
| M_RST6 = 0xd6, | |||
| M_RST7 = 0xd7, | |||
| M_SOI = 0xd8, | |||
| M_EOI = 0xd9, | |||
| M_SOS = 0xda, | |||
| M_DQT = 0xdb, | |||
| M_DNL = 0xdc, | |||
| M_DRI = 0xdd, | |||
| M_DHP = 0xde, | |||
| M_EXP = 0xdf, | |||
| M_APP0 = 0xe0, | |||
| M_APP1 = 0xe1, | |||
| M_APP2 = 0xe2, | |||
| M_APP3 = 0xe3, | |||
| M_APP4 = 0xe4, | |||
| M_APP5 = 0xe5, | |||
| M_APP6 = 0xe6, | |||
| M_APP7 = 0xe7, | |||
| M_APP8 = 0xe8, | |||
| M_APP9 = 0xe9, | |||
| M_APP10 = 0xea, | |||
| M_APP11 = 0xeb, | |||
| M_APP12 = 0xec, | |||
| M_APP13 = 0xed, | |||
| M_APP14 = 0xee, | |||
| M_APP15 = 0xef, | |||
| M_JPG0 = 0xf0, | |||
| M_JPG13 = 0xfd, | |||
| M_COM = 0xfe, | |||
| M_TEM = 0x01, | |||
| M_ERROR = 0x100 | |||
| } JPEG_MARKER; | |||
| /* Private state */ | |||
| @@ -198,11 +198,11 @@ start_pass_phuff (j_compress_ptr cinfo, boolean gather_statistics) | |||
| #define emit_byte(entropy,val) \ | |||
| { *(entropy)->next_output_byte++ = (JOCTET) (val); \ | |||
| if (--(entropy)->free_in_buffer == 0) \ | |||
| dump_buffer(entropy); } | |||
| dump_buffer_p(entropy); } | |||
| LOCAL(void) | |||
| dump_buffer (phuff_entropy_ptr entropy) | |||
| dump_buffer_p (phuff_entropy_ptr entropy) | |||
| /* Empty the output buffer; we do not support suspension in this module. */ | |||
| { | |||
| struct jpeg_destination_mgr * dest = entropy->cinfo->dest; | |||
| @@ -225,7 +225,7 @@ dump_buffer (phuff_entropy_ptr entropy) | |||
| INLINE | |||
| LOCAL(void) | |||
| emit_bits (phuff_entropy_ptr entropy, unsigned int code, int size) | |||
| emit_bits_p (phuff_entropy_ptr entropy, unsigned int code, int size) | |||
| /* Emit some bits, unless we are in gather mode */ | |||
| { | |||
| /* This routine is heavily used, so it's worth coding tightly. */ | |||
| @@ -264,9 +264,9 @@ emit_bits (phuff_entropy_ptr entropy, unsigned int code, int size) | |||
| LOCAL(void) | |||
| flush_bits (phuff_entropy_ptr entropy) | |||
| flush_bits_p (phuff_entropy_ptr entropy) | |||
| { | |||
| emit_bits(entropy, 0x7F, 7); /* fill any partial byte with ones */ | |||
| emit_bits_p(entropy, 0x7F, 7); /* fill any partial byte with ones */ | |||
| entropy->put_buffer = 0; /* and reset bit-buffer to empty */ | |||
| entropy->put_bits = 0; | |||
| } | |||
| @@ -284,7 +284,7 @@ emit_symbol (phuff_entropy_ptr entropy, int tbl_no, int symbol) | |||
| entropy->count_ptrs[tbl_no][symbol]++; | |||
| else { | |||
| c_derived_tbl * tbl = entropy->derived_tbls[tbl_no]; | |||
| emit_bits(entropy, tbl->ehufco[symbol], tbl->ehufsi[symbol]); | |||
| emit_bits_p(entropy, tbl->ehufco[symbol], tbl->ehufsi[symbol]); | |||
| } | |||
| } | |||
| @@ -301,7 +301,7 @@ emit_buffered_bits (phuff_entropy_ptr entropy, char * bufstart, | |||
| return; /* no real work */ | |||
| while (nbits > 0) { | |||
| emit_bits(entropy, (unsigned int) (*bufstart), 1); | |||
| emit_bits_p(entropy, (unsigned int) (*bufstart), 1); | |||
| bufstart++; | |||
| nbits--; | |||
| } | |||
| @@ -328,7 +328,7 @@ emit_eobrun (phuff_entropy_ptr entropy) | |||
| emit_symbol(entropy, entropy->ac_tbl_no, nbits << 4); | |||
| if (nbits) | |||
| emit_bits(entropy, entropy->EOBRUN, nbits); | |||
| emit_bits_p(entropy, entropy->EOBRUN, nbits); | |||
| entropy->EOBRUN = 0; | |||
| @@ -344,14 +344,14 @@ emit_eobrun (phuff_entropy_ptr entropy) | |||
| */ | |||
| LOCAL(void) | |||
| emit_restart (phuff_entropy_ptr entropy, int restart_num) | |||
| emit_restart_p (phuff_entropy_ptr entropy, int restart_num) | |||
| { | |||
| int ci; | |||
| emit_eobrun(entropy); | |||
| if (! entropy->gather_statistics) { | |||
| flush_bits(entropy); | |||
| flush_bits_p(entropy); | |||
| emit_byte(entropy, 0xFF); | |||
| emit_byte(entropy, JPEG_RST0 + restart_num); | |||
| } | |||
| @@ -391,7 +391,7 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data) | |||
| /* Emit restart marker if needed */ | |||
| if (cinfo->restart_interval) | |||
| if (entropy->restarts_to_go == 0) | |||
| emit_restart(entropy, entropy->next_restart_num); | |||
| emit_restart_p(entropy, entropy->next_restart_num); | |||
| /* Encode the MCU data blocks */ | |||
| for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { | |||
| @@ -435,7 +435,7 @@ encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *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(entropy, (unsigned int) temp2, nbits); | |||
| emit_bits_p(entropy, (unsigned int) temp2, nbits); | |||
| } | |||
| cinfo->dest->next_output_byte = entropy->next_output_byte; | |||
| @@ -477,7 +477,7 @@ encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data) | |||
| /* Emit restart marker if needed */ | |||
| if (cinfo->restart_interval) | |||
| if (entropy->restarts_to_go == 0) | |||
| emit_restart(entropy, entropy->next_restart_num); | |||
| emit_restart_p(entropy, entropy->next_restart_num); | |||
| /* Encode the MCU data block */ | |||
| block = MCU_data[0]; | |||
| @@ -533,7 +533,7 @@ encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data) | |||
| /* Emit that number of bits of the value, if positive, */ | |||
| /* or the complement of its magnitude, if negative. */ | |||
| emit_bits(entropy, (unsigned int) temp2, nbits); | |||
| emit_bits_p(entropy, (unsigned int) temp2, nbits); | |||
| r = 0; /* reset zero run length */ | |||
| } | |||
| @@ -582,7 +582,7 @@ encode_mcu_DC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data) | |||
| /* Emit restart marker if needed */ | |||
| if (cinfo->restart_interval) | |||
| if (entropy->restarts_to_go == 0) | |||
| emit_restart(entropy, entropy->next_restart_num); | |||
| emit_restart_p(entropy, entropy->next_restart_num); | |||
| /* Encode the MCU data blocks */ | |||
| for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) { | |||
| @@ -590,7 +590,7 @@ encode_mcu_DC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data) | |||
| /* We simply emit the Al'th bit of the DC coefficient value. */ | |||
| temp = (*block)[0]; | |||
| emit_bits(entropy, (unsigned int) (temp >> Al), 1); | |||
| emit_bits_p(entropy, (unsigned int) (temp >> Al), 1); | |||
| } | |||
| cinfo->dest->next_output_byte = entropy->next_output_byte; | |||
| @@ -634,7 +634,7 @@ encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data) | |||
| /* Emit restart marker if needed */ | |||
| if (cinfo->restart_interval) | |||
| if (entropy->restarts_to_go == 0) | |||
| emit_restart(entropy, entropy->next_restart_num); | |||
| emit_restart_p(entropy, entropy->next_restart_num); | |||
| /* Encode the MCU data block */ | |||
| block = MCU_data[0]; | |||
| @@ -701,7 +701,7 @@ encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data) | |||
| /* Emit output bit for newly-nonzero coef */ | |||
| temp = ((*block)[jpeg_natural_order[k]] < 0) ? 0 : 1; | |||
| emit_bits(entropy, (unsigned int) temp, 1); | |||
| emit_bits_p(entropy, (unsigned int) temp, 1); | |||
| /* Emit buffered correction bits that must be associated with this code */ | |||
| emit_buffered_bits(entropy, BR_buffer, BR); | |||
| @@ -752,7 +752,7 @@ finish_pass_phuff (j_compress_ptr cinfo) | |||
| /* Flush out any buffered data */ | |||
| emit_eobrun(entropy); | |||
| flush_bits(entropy); | |||
| flush_bits_p(entropy); | |||
| cinfo->dest->next_output_byte = entropy->next_output_byte; | |||
| cinfo->dest->free_in_buffer = entropy->free_in_buffer; | |||
| @@ -218,16 +218,16 @@ typedef struct { | |||
| /* Workspace for constructing dummy blocks at right/bottom edges. */ | |||
| JBLOCKROW dummy_buffer[C_MAX_BLOCKS_IN_MCU]; | |||
| } my_coef_controller; | |||
| } my_coef_controller2; | |||
| typedef my_coef_controller * my_coef_ptr; | |||
| typedef my_coef_controller2 * my_coef_ptr2; | |||
| LOCAL(void) | |||
| start_iMCU_row (j_compress_ptr cinfo) | |||
| start_iMCU_row2 (j_compress_ptr cinfo) | |||
| /* Reset within-iMCU-row counters for a new row */ | |||
| { | |||
| my_coef_ptr coef = (my_coef_ptr) cinfo->coef; | |||
| my_coef_ptr2 coef = (my_coef_ptr2) cinfo->coef; | |||
| /* In an interleaved scan, an MCU row is the same as an iMCU row. | |||
| * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows. | |||
| @@ -252,15 +252,15 @@ start_iMCU_row (j_compress_ptr cinfo) | |||
| */ | |||
| METHODDEF(void) | |||
| start_pass_coef (j_compress_ptr cinfo, J_BUF_MODE pass_mode) | |||
| start_pass_coef2 (j_compress_ptr cinfo, J_BUF_MODE pass_mode) | |||
| { | |||
| my_coef_ptr coef = (my_coef_ptr) cinfo->coef; | |||
| my_coef_ptr2 coef = (my_coef_ptr2) cinfo->coef; | |||
| if (pass_mode != JBUF_CRANK_DEST) | |||
| ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); | |||
| coef->iMCU_row_num = 0; | |||
| start_iMCU_row(cinfo); | |||
| start_iMCU_row2(cinfo); | |||
| } | |||
| @@ -275,9 +275,9 @@ start_pass_coef (j_compress_ptr cinfo, J_BUF_MODE pass_mode) | |||
| */ | |||
| METHODDEF(boolean) | |||
| compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf) | |||
| compress_output2 (j_compress_ptr cinfo, JSAMPIMAGE input_buf) | |||
| { | |||
| my_coef_ptr coef = (my_coef_ptr) cinfo->coef; | |||
| my_coef_ptr2 coef = (my_coef_ptr2) cinfo->coef; | |||
| JDIMENSION MCU_col_num; /* index of current MCU within row */ | |||
| JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1; | |||
| JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1; | |||
| @@ -346,7 +346,7 @@ compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf) | |||
| } | |||
| /* Completed the iMCU row, advance counters for next one */ | |||
| coef->iMCU_row_num++; | |||
| start_iMCU_row(cinfo); | |||
| start_iMCU_row2(cinfo); | |||
| return TRUE; | |||
| } | |||
| @@ -363,16 +363,16 @@ LOCAL(void) | |||
| transencode_coef_controller (j_compress_ptr cinfo, | |||
| jvirt_barray_ptr * coef_arrays) | |||
| { | |||
| my_coef_ptr coef; | |||
| my_coef_ptr2 coef; | |||
| JBLOCKROW buffer; | |||
| int i; | |||
| coef = (my_coef_ptr) | |||
| coef = (my_coef_ptr2) | |||
| (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, | |||
| SIZEOF(my_coef_controller)); | |||
| SIZEOF(my_coef_controller2)); | |||
| cinfo->coef = (struct jpeg_c_coef_controller *) coef; | |||
| coef->pub.start_pass = start_pass_coef; | |||
| coef->pub.compress_data = compress_output; | |||
| coef->pub.start_pass = start_pass_coef2; | |||
| coef->pub.compress_data = compress_output2; | |||
| /* Save pointer to virtual arrays */ | |||
| coef->whole_image = coef_arrays; | |||
| @@ -57,9 +57,9 @@ typedef struct { | |||
| int * coef_bits_latch; | |||
| #define SAVED_COEFS 6 /* we save coef_bits[0..5] */ | |||
| #endif | |||
| } my_coef_controller; | |||
| } my_coef_controller3; | |||
| typedef my_coef_controller * my_coef_ptr; | |||
| typedef my_coef_controller3 * my_coef_ptr3; | |||
| /* Forward declarations */ | |||
| METHODDEF(int) decompress_onepass | |||
| @@ -76,10 +76,10 @@ METHODDEF(int) decompress_smooth_data | |||
| LOCAL(void) | |||
| start_iMCU_row (j_decompress_ptr cinfo) | |||
| start_iMCU_row3 (j_decompress_ptr cinfo) | |||
| /* Reset within-iMCU-row counters for a new row (input side) */ | |||
| { | |||
| my_coef_ptr coef = (my_coef_ptr) cinfo->coef; | |||
| my_coef_ptr3 coef = (my_coef_ptr3) cinfo->coef; | |||
| /* In an interleaved scan, an MCU row is the same as an iMCU row. | |||
| * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows. | |||
| @@ -107,7 +107,7 @@ METHODDEF(void) | |||
| start_input_pass (j_decompress_ptr cinfo) | |||
| { | |||
| cinfo->input_iMCU_row = 0; | |||
| start_iMCU_row(cinfo); | |||
| start_iMCU_row3(cinfo); | |||
| } | |||
| @@ -119,7 +119,7 @@ METHODDEF(void) | |||
| start_output_pass (j_decompress_ptr cinfo) | |||
| { | |||
| #ifdef BLOCK_SMOOTHING_SUPPORTED | |||
| my_coef_ptr coef = (my_coef_ptr) cinfo->coef; | |||
| my_coef_ptr3 coef = (my_coef_ptr3) cinfo->coef; | |||
| /* If multipass, check to see whether to use block smoothing on this pass */ | |||
| if (coef->pub.coef_arrays != NULL) { | |||
| @@ -146,7 +146,7 @@ start_output_pass (j_decompress_ptr cinfo) | |||
| METHODDEF(int) | |||
| decompress_onepass (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) | |||
| { | |||
| my_coef_ptr coef = (my_coef_ptr) cinfo->coef; | |||
| my_coef_ptr3 coef = (my_coef_ptr3) cinfo->coef; | |||
| JDIMENSION MCU_col_num; /* index of current MCU within row */ | |||
| JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1; | |||
| JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1; | |||
| @@ -211,7 +211,7 @@ decompress_onepass (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) | |||
| /* Completed the iMCU row, advance counters for next one */ | |||
| cinfo->output_iMCU_row++; | |||
| if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) { | |||
| start_iMCU_row(cinfo); | |||
| start_iMCU_row3(cinfo); | |||
| return JPEG_ROW_COMPLETED; | |||
| } | |||
| /* Completed the scan */ | |||
| @@ -243,7 +243,7 @@ dummy_consume_data (j_decompress_ptr cinfo) | |||
| METHODDEF(int) | |||
| consume_data (j_decompress_ptr cinfo) | |||
| { | |||
| my_coef_ptr coef = (my_coef_ptr) cinfo->coef; | |||
| my_coef_ptr3 coef = (my_coef_ptr3) cinfo->coef; | |||
| JDIMENSION MCU_col_num; /* index of current MCU within row */ | |||
| int blkn, ci, xindex, yindex, yoffset; | |||
| JDIMENSION start_col; | |||
| @@ -294,7 +294,7 @@ consume_data (j_decompress_ptr cinfo) | |||
| } | |||
| /* Completed the iMCU row, advance counters for next one */ | |||
| if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) { | |||
| start_iMCU_row(cinfo); | |||
| start_iMCU_row3(cinfo); | |||
| return JPEG_ROW_COMPLETED; | |||
| } | |||
| /* Completed the scan */ | |||
| @@ -314,7 +314,7 @@ consume_data (j_decompress_ptr cinfo) | |||
| METHODDEF(int) | |||
| decompress_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) | |||
| { | |||
| my_coef_ptr coef = (my_coef_ptr) cinfo->coef; | |||
| my_coef_ptr3 coef = (my_coef_ptr3) cinfo->coef; | |||
| JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1; | |||
| JDIMENSION block_num; | |||
| int ci, block_row, block_rows; | |||
| @@ -404,7 +404,7 @@ decompress_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) | |||
| LOCAL(boolean) | |||
| smoothing_ok (j_decompress_ptr cinfo) | |||
| { | |||
| my_coef_ptr coef = (my_coef_ptr) cinfo->coef; | |||
| my_coef_ptr3 coef = (my_coef_ptr3) cinfo->coef; | |||
| boolean smoothing_useful = FALSE; | |||
| int ci, coefi; | |||
| jpeg_component_info *compptr; | |||
| @@ -460,7 +460,7 @@ smoothing_ok (j_decompress_ptr cinfo) | |||
| METHODDEF(int) | |||
| decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) | |||
| { | |||
| my_coef_ptr coef = (my_coef_ptr) cinfo->coef; | |||
| my_coef_ptr3 coef = (my_coef_ptr3) cinfo->coef; | |||
| JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1; | |||
| JDIMENSION block_num, last_block_column; | |||
| int ci, block_row, block_rows, access_rows; | |||
| @@ -675,11 +675,11 @@ decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf) | |||
| GLOBAL(void) | |||
| jinit_d_coef_controller (j_decompress_ptr cinfo, boolean need_full_buffer) | |||
| { | |||
| my_coef_ptr coef; | |||
| my_coef_ptr3 coef; | |||
| coef = (my_coef_ptr) | |||
| coef = (my_coef_ptr3) | |||
| (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, | |||
| SIZEOF(my_coef_controller)); | |||
| SIZEOF(my_coef_controller3)); | |||
| cinfo->coef = (struct jpeg_d_coef_controller *) coef; | |||
| coef->pub.start_input_pass = start_input_pass; | |||
| coef->pub.start_output_pass = start_output_pass; | |||
| @@ -23,9 +23,9 @@ typedef struct { | |||
| int * Cb_b_tab; /* => table for Cb to B conversion */ | |||
| INT32 * Cr_g_tab; /* => table for Cr to G conversion */ | |||
| INT32 * Cb_g_tab; /* => table for Cb to G conversion */ | |||
| } my_color_deconverter; | |||
| } my_color_deconverter2; | |||
| typedef my_color_deconverter * my_cconvert_ptr; | |||
| typedef my_color_deconverter2 * my_cconvert_ptr2; | |||
| /**************** YCbCr -> RGB conversion: most common case **************/ | |||
| @@ -69,7 +69,7 @@ typedef my_color_deconverter * my_cconvert_ptr; | |||
| LOCAL(void) | |||
| build_ycc_rgb_table (j_decompress_ptr cinfo) | |||
| { | |||
| my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; | |||
| my_cconvert_ptr2 cconvert = (my_cconvert_ptr2) cinfo->cconvert; | |||
| int i; | |||
| INT32 x; | |||
| SHIFT_TEMPS | |||
| @@ -121,7 +121,7 @@ ycc_rgb_convert (j_decompress_ptr cinfo, | |||
| JSAMPIMAGE input_buf, JDIMENSION input_row, | |||
| JSAMPARRAY output_buf, int num_rows) | |||
| { | |||
| my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; | |||
| my_cconvert_ptr2 cconvert = (my_cconvert_ptr2) cinfo->cconvert; | |||
| register int y, cb, cr; | |||
| register JSAMPROW outptr; | |||
| register JSAMPROW inptr0, inptr1, inptr2; | |||
| @@ -166,7 +166,7 @@ ycc_rgb_convert (j_decompress_ptr cinfo, | |||
| */ | |||
| METHODDEF(void) | |||
| null_convert (j_decompress_ptr cinfo, | |||
| null_convert2 (j_decompress_ptr cinfo, | |||
| JSAMPIMAGE input_buf, JDIMENSION input_row, | |||
| JSAMPARRAY output_buf, int num_rows) | |||
| { | |||
| @@ -198,7 +198,7 @@ null_convert (j_decompress_ptr cinfo, | |||
| */ | |||
| METHODDEF(void) | |||
| grayscale_convert (j_decompress_ptr cinfo, | |||
| grayscale_convert2 (j_decompress_ptr cinfo, | |||
| JSAMPIMAGE input_buf, JDIMENSION input_row, | |||
| JSAMPARRAY output_buf, int num_rows) | |||
| { | |||
| @@ -246,7 +246,7 @@ ycck_cmyk_convert (j_decompress_ptr cinfo, | |||
| JSAMPIMAGE input_buf, JDIMENSION input_row, | |||
| JSAMPARRAY output_buf, int num_rows) | |||
| { | |||
| my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert; | |||
| my_cconvert_ptr2 cconvert = (my_cconvert_ptr2) cinfo->cconvert; | |||
| register int y, cb, cr; | |||
| register JSAMPROW outptr; | |||
| register JSAMPROW inptr0, inptr1, inptr2, inptr3; | |||
| @@ -303,12 +303,12 @@ start_pass_dcolor (j_decompress_ptr cinfo) | |||
| GLOBAL(void) | |||
| jinit_color_deconverter (j_decompress_ptr cinfo) | |||
| { | |||
| my_cconvert_ptr cconvert; | |||
| my_cconvert_ptr2 cconvert; | |||
| int ci; | |||
| cconvert = (my_cconvert_ptr) | |||
| cconvert = (my_cconvert_ptr2) | |||
| (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, | |||
| SIZEOF(my_color_deconverter)); | |||
| SIZEOF(my_color_deconverter2)); | |||
| cinfo->cconvert = (struct jpeg_color_deconverter *) cconvert; | |||
| cconvert->pub.start_pass = start_pass_dcolor; | |||
| @@ -347,7 +347,7 @@ jinit_color_deconverter (j_decompress_ptr cinfo) | |||
| cinfo->out_color_components = 1; | |||
| if (cinfo->jpeg_color_space == JCS_GRAYSCALE || | |||
| cinfo->jpeg_color_space == JCS_YCbCr) { | |||
| cconvert->pub.color_convert = grayscale_convert; | |||
| cconvert->pub.color_convert = grayscale_convert2; | |||
| /* For color->grayscale conversion, only the Y (0) component is needed */ | |||
| for (ci = 1; ci < cinfo->num_components; ci++) | |||
| cinfo->comp_info[ci].component_needed = FALSE; | |||
| @@ -363,7 +363,7 @@ jinit_color_deconverter (j_decompress_ptr cinfo) | |||
| } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) { | |||
| cconvert->pub.color_convert = gray_rgb_convert; | |||
| } else if (cinfo->jpeg_color_space == JCS_RGB && RGB_PIXELSIZE == 3) { | |||
| cconvert->pub.color_convert = null_convert; | |||
| cconvert->pub.color_convert = null_convert2; | |||
| } else | |||
| ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); | |||
| break; | |||
| @@ -374,7 +374,7 @@ jinit_color_deconverter (j_decompress_ptr cinfo) | |||
| cconvert->pub.color_convert = ycck_cmyk_convert; | |||
| build_ycc_rgb_table(cinfo); | |||
| } else if (cinfo->jpeg_color_space == JCS_CMYK) { | |||
| cconvert->pub.color_convert = null_convert; | |||
| cconvert->pub.color_convert = null_convert2; | |||
| } else | |||
| ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); | |||
| break; | |||
| @@ -383,7 +383,7 @@ jinit_color_deconverter (j_decompress_ptr cinfo) | |||
| /* Permit null conversion to same output space */ | |||
| if (cinfo->out_color_space == cinfo->jpeg_color_space) { | |||
| cinfo->out_color_components = cinfo->num_components; | |||
| cconvert->pub.color_convert = null_convert; | |||
| cconvert->pub.color_convert = null_convert2; | |||
| } else /* unsupported non-null conversion */ | |||
| ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL); | |||
| break; | |||
| @@ -26,6 +26,9 @@ | |||
| * Quantization of the output coefficients is done by jcdctmgr.c. | |||
| */ | |||
| #ifndef __jdct_h__ | |||
| #define __jdct_h__ | |||
| #if BITS_IN_JSAMPLE == 8 | |||
| typedef int DCTELEM; /* 16 or 32 bits is fine */ | |||
| #else | |||
| @@ -174,3 +177,6 @@ EXTERN(void) jpeg_idct_1x1 | |||
| #ifndef MULTIPLY16V16 /* default definition */ | |||
| #define MULTIPLY16V16(var1,var2) ((var1) * (var2)) | |||
| #endif | |||
| #endif | |||
| @@ -29,7 +29,7 @@ | |||
| typedef struct { | |||
| int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */ | |||
| } savable_state; | |||
| } savable_state2; | |||
| /* This macro is to work around compilers with missing or broken | |||
| * structure assignment. You'll need to fix this code if you have | |||
| @@ -56,7 +56,7 @@ typedef struct { | |||
| * In case of suspension, we exit WITHOUT updating them. | |||
| */ | |||
| bitread_perm_state bitstate; /* Bit buffer at start of MCU */ | |||
| savable_state saved; /* Other state at start of MCU */ | |||
| savable_state2 saved; /* Other state at start of MCU */ | |||
| /* These fields are NOT loaded into local working state. */ | |||
| unsigned int restarts_to_go; /* MCUs left in this restart interval */ | |||
| @@ -73,9 +73,9 @@ typedef struct { | |||
| /* Whether we care about the DC and AC coefficient values for each block */ | |||
| boolean dc_needed[D_MAX_BLOCKS_IN_MCU]; | |||
| boolean ac_needed[D_MAX_BLOCKS_IN_MCU]; | |||
| } huff_entropy_decoder; | |||
| } huff_entropy_decoder2; | |||
| typedef huff_entropy_decoder * huff_entropy_ptr; | |||
| typedef huff_entropy_decoder2 * huff_entropy_ptr2; | |||
| /* | |||
| @@ -85,7 +85,7 @@ typedef huff_entropy_decoder * huff_entropy_ptr; | |||
| METHODDEF(void) | |||
| start_pass_huff_decoder (j_decompress_ptr cinfo) | |||
| { | |||
| huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; | |||
| huff_entropy_ptr2 entropy = (huff_entropy_ptr2) cinfo->entropy; | |||
| int ci, blkn, dctbl, actbl; | |||
| jpeg_component_info * compptr; | |||
| @@ -433,32 +433,6 @@ jpeg_huff_decode (bitread_working_state * state, | |||
| } | |||
| /* | |||
| * Figure F.12: extend sign bit. | |||
| * On some machines, a shift and add will be faster than a table lookup. | |||
| */ | |||
| #ifdef AVOID_TABLES | |||
| #define HUFF_EXTEND(x,s) ((x) < (1<<((s)-1)) ? (x) + (((-1)<<(s)) + 1) : (x)) | |||
| #else | |||
| #define HUFF_EXTEND(x,s) ((x) < extend_test[s] ? (x) + extend_offset[s] : (x)) | |||
| static const int extend_test[16] = /* entry n is 2**(n-1) */ | |||
| { 0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, | |||
| 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000 }; | |||
| static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */ | |||
| { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, | |||
| ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1, | |||
| ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1, | |||
| ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 }; | |||
| #endif /* AVOID_TABLES */ | |||
| /* | |||
| * Check for a restart marker & resynchronize decoder. | |||
| * Returns FALSE if must suspend. | |||
| @@ -467,7 +441,7 @@ static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */ | |||
| LOCAL(boolean) | |||
| process_restart (j_decompress_ptr cinfo) | |||
| { | |||
| huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; | |||
| huff_entropy_ptr2 entropy = (huff_entropy_ptr2) cinfo->entropy; | |||
| int ci; | |||
| /* Throw away any unused bits remaining in bit buffer; */ | |||
| @@ -516,10 +490,10 @@ process_restart (j_decompress_ptr cinfo) | |||
| METHODDEF(boolean) | |||
| decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) | |||
| { | |||
| huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; | |||
| huff_entropy_ptr2 entropy = (huff_entropy_ptr2) cinfo->entropy; | |||
| int blkn; | |||
| BITREAD_STATE_VARS; | |||
| savable_state state; | |||
| savable_state2 state; | |||
| /* Process restart marker if needed; may have to suspend */ | |||
| if (cinfo->restart_interval) { | |||
| @@ -634,12 +608,12 @@ decode_mcu (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) | |||
| GLOBAL(void) | |||
| jinit_huff_decoder (j_decompress_ptr cinfo) | |||
| { | |||
| huff_entropy_ptr entropy; | |||
| huff_entropy_ptr2 entropy; | |||
| int i; | |||
| entropy = (huff_entropy_ptr) | |||
| entropy = (huff_entropy_ptr2) | |||
| (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, | |||
| SIZEOF(huff_entropy_decoder)); | |||
| SIZEOF(huff_entropy_decoder2)); | |||
| cinfo->entropy = (struct jpeg_entropy_decoder *) entropy; | |||
| entropy->pub.start_pass = start_pass_huff_decoder; | |||
| entropy->pub.decode_mcu = decode_mcu; | |||
| @@ -12,6 +12,9 @@ | |||
| /* Short forms of external names for systems with brain-damaged linkers. */ | |||
| #ifndef __jdhuff_h__ | |||
| #define __jdhuff_h__ | |||
| #ifdef NEED_SHORT_EXTERNAL_NAMES | |||
| #define jpeg_make_d_derived_tbl jMkDDerived | |||
| #define jpeg_fill_bit_buffer jFilBitBuf | |||
| @@ -199,3 +202,5 @@ slowlabel: \ | |||
| EXTERN(int) jpeg_huff_decode | |||
| JPP((bitread_working_state * state, register bit_buf_type get_buffer, | |||
| register int bits_left, d_derived_tbl * htbl, int min_bits)); | |||
| #endif | |||
| @@ -36,7 +36,7 @@ METHODDEF(int) consume_markers JPP((j_decompress_ptr cinfo)); | |||
| */ | |||
| LOCAL(void) | |||
| initial_setup (j_decompress_ptr cinfo) | |||
| initial_setup2 (j_decompress_ptr cinfo) | |||
| /* Called once, when first SOS marker is reached */ | |||
| { | |||
| int ci; | |||
| @@ -118,7 +118,7 @@ initial_setup (j_decompress_ptr cinfo) | |||
| LOCAL(void) | |||
| per_scan_setup (j_decompress_ptr cinfo) | |||
| per_scan_setup2 (j_decompress_ptr cinfo) | |||
| /* Do computations that are needed before processing a JPEG scan */ | |||
| /* cinfo->comps_in_scan and cinfo->cur_comp_info[] were set from SOS marker */ | |||
| { | |||
| @@ -251,9 +251,9 @@ latch_quant_tables (j_decompress_ptr cinfo) | |||
| */ | |||
| METHODDEF(void) | |||
| start_input_pass (j_decompress_ptr cinfo) | |||
| start_input_pass2 (j_decompress_ptr cinfo) | |||
| { | |||
| per_scan_setup(cinfo); | |||
| per_scan_setup2(cinfo); | |||
| latch_quant_tables(cinfo); | |||
| (*cinfo->entropy->start_pass) (cinfo); | |||
| (*cinfo->coef->start_input_pass) (cinfo); | |||
| @@ -298,7 +298,7 @@ consume_markers (j_decompress_ptr cinfo) | |||
| switch (val) { | |||
| case JPEG_REACHED_SOS: /* Found SOS */ | |||
| if (inputctl->inheaders) { /* 1st SOS */ | |||
| initial_setup(cinfo); | |||
| initial_setup2(cinfo); | |||
| inputctl->inheaders = FALSE; | |||
| /* Note: start_input_pass must be called by jdmaster.c | |||
| * before any more input can be consumed. jdapimin.c is | |||
| @@ -307,7 +307,7 @@ consume_markers (j_decompress_ptr cinfo) | |||
| } else { /* 2nd or later SOS marker */ | |||
| if (! inputctl->pub.has_multiple_scans) | |||
| ERREXIT(cinfo, JERR_EOI_EXPECTED); /* Oops, I wasn't expecting this! */ | |||
| start_input_pass(cinfo); | |||
| start_input_pass2(cinfo); | |||
| } | |||
| break; | |||
| case JPEG_REACHED_EOI: /* Found EOI */ | |||
| @@ -370,7 +370,7 @@ jinit_input_controller (j_decompress_ptr cinfo) | |||
| /* Initialize method pointers */ | |||
| inputctl->pub.consume_input = consume_markers; | |||
| inputctl->pub.reset_input_controller = reset_input_controller; | |||
| inputctl->pub.start_input_pass = start_input_pass; | |||
| inputctl->pub.start_input_pass = start_input_pass2; | |||
| inputctl->pub.finish_input_pass = finish_input_pass; | |||
| /* Initialize state: can't use reset_input_controller since we don't | |||
| * want to try to reset other modules yet. | |||
| @@ -129,9 +129,9 @@ typedef struct { | |||
| int context_state; /* process_data state machine status */ | |||
| JDIMENSION rowgroups_avail; /* row groups available to postprocessor */ | |||
| JDIMENSION iMCU_row_ctr; /* counts iMCU rows to detect image top/bot */ | |||
| } my_main_controller; | |||
| } my_main_controller4; | |||
| typedef my_main_controller * my_main_ptr; | |||
| typedef my_main_controller4 * my_main_ptr4; | |||
| /* context_state values: */ | |||
| #define CTX_PREPARE_FOR_IMCU 0 /* need to prepare for MCU row */ | |||
| @@ -140,7 +140,7 @@ typedef my_main_controller * my_main_ptr; | |||
| /* Forward declarations */ | |||
| METHODDEF(void) process_data_simple_main | |||
| METHODDEF(void) process_data_simple_main2 | |||
| JPP((j_decompress_ptr cinfo, JSAMPARRAY output_buf, | |||
| JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)); | |||
| METHODDEF(void) process_data_context_main | |||
| @@ -159,7 +159,7 @@ alloc_funny_pointers (j_decompress_ptr cinfo) | |||
| * This is done only once, not once per pass. | |||
| */ | |||
| { | |||
| my_main_ptr main_ = (my_main_ptr) cinfo->main; | |||
| my_main_ptr4 main_ = (my_main_ptr4) cinfo->main; | |||
| int ci, rgroup; | |||
| int M = cinfo->min_DCT_scaled_size; | |||
| jpeg_component_info *compptr; | |||
| @@ -200,7 +200,7 @@ make_funny_pointers (j_decompress_ptr cinfo) | |||
| * This will be repeated at the beginning of each pass. | |||
| */ | |||
| { | |||
| my_main_ptr main_ = (my_main_ptr) cinfo->main; | |||
| my_main_ptr4 main_ = (my_main_ptr4) cinfo->main; | |||
| int ci, i, rgroup; | |||
| int M = cinfo->min_DCT_scaled_size; | |||
| jpeg_component_info *compptr; | |||
| @@ -240,7 +240,7 @@ set_wraparound_pointers (j_decompress_ptr cinfo) | |||
| * This changes the pointer list state from top-of-image to the normal state. | |||
| */ | |||
| { | |||
| my_main_ptr main_ = (my_main_ptr) cinfo->main; | |||
| my_main_ptr4 main_ = (my_main_ptr4) cinfo->main; | |||
| int ci, i, rgroup; | |||
| int M = cinfo->min_DCT_scaled_size; | |||
| jpeg_component_info *compptr; | |||
| @@ -269,7 +269,7 @@ set_bottom_pointers (j_decompress_ptr cinfo) | |||
| * Also sets rowgroups_avail to indicate number of nondummy row groups in row. | |||
| */ | |||
| { | |||
| my_main_ptr main_ = (my_main_ptr) cinfo->main; | |||
| my_main_ptr4 main_ = (my_main_ptr4) cinfo->main; | |||
| int ci, i, rgroup, iMCUheight, rows_left; | |||
| jpeg_component_info *compptr; | |||
| JSAMPARRAY xbuf; | |||
| @@ -304,9 +304,9 @@ set_bottom_pointers (j_decompress_ptr cinfo) | |||
| */ | |||
| METHODDEF(void) | |||
| start_pass_main (j_decompress_ptr cinfo, J_BUF_MODE pass_mode) | |||
| start_pass_main2 (j_decompress_ptr cinfo, J_BUF_MODE pass_mode) | |||
| { | |||
| my_main_ptr main_ = (my_main_ptr) cinfo->main; | |||
| my_main_ptr4 main_ = (my_main_ptr4) cinfo->main; | |||
| switch (pass_mode) { | |||
| case JBUF_PASS_THRU: | |||
| @@ -318,7 +318,7 @@ start_pass_main (j_decompress_ptr cinfo, J_BUF_MODE pass_mode) | |||
| main_->iMCU_row_ctr = 0; | |||
| } else { | |||
| /* Simple case with no context needed */ | |||
| main_->pub.process_data = process_data_simple_main; | |||
| main_->pub.process_data = process_data_simple_main2; | |||
| } | |||
| main_->buffer_full = FALSE; /* Mark buffer empty */ | |||
| main_->rowgroup_ctr = 0; | |||
| @@ -342,11 +342,11 @@ start_pass_main (j_decompress_ptr cinfo, J_BUF_MODE pass_mode) | |||
| */ | |||
| METHODDEF(void) | |||
| process_data_simple_main (j_decompress_ptr cinfo, | |||
| process_data_simple_main2 (j_decompress_ptr cinfo, | |||
| JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, | |||
| JDIMENSION out_rows_avail) | |||
| { | |||
| my_main_ptr main_ = (my_main_ptr) cinfo->main; | |||
| my_main_ptr4 main_ = (my_main_ptr4) cinfo->main; | |||
| JDIMENSION rowgroups_avail; | |||
| /* Read input data if we haven't filled the main buffer yet */ | |||
| @@ -386,7 +386,7 @@ process_data_context_main (j_decompress_ptr cinfo, | |||
| JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, | |||
| JDIMENSION out_rows_avail) | |||
| { | |||
| my_main_ptr main_ = (my_main_ptr) cinfo->main; | |||
| my_main_ptr4 main_ = (my_main_ptr4) cinfo->main; | |||
| /* Read input data if we haven't filled the main buffer yet */ | |||
| if (! main_->buffer_full) { | |||
| @@ -475,15 +475,15 @@ process_data_crank_post (j_decompress_ptr cinfo, | |||
| GLOBAL(void) | |||
| jinit_d_main_controller (j_decompress_ptr cinfo, boolean need_full_buffer) | |||
| { | |||
| my_main_ptr main_; | |||
| my_main_ptr4 main_; | |||
| int ci, rgroup, ngroups; | |||
| jpeg_component_info *compptr; | |||
| main_ = (my_main_ptr) | |||
| main_ = (my_main_ptr4) | |||
| (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, | |||
| SIZEOF(my_main_controller)); | |||
| SIZEOF(my_main_controller4)); | |||
| cinfo->main = (struct jpeg_d_main_controller *) main_; | |||
| main_->pub.start_pass = start_pass_main; | |||
| main_->pub.start_pass = start_pass_main2; | |||
| if (need_full_buffer) /* shouldn't happen */ | |||
| ERREXIT(cinfo, JERR_BAD_BUFFER_MODE); | |||
| @@ -17,74 +17,6 @@ | |||
| #include "jpeglib.h" | |||
| typedef enum { /* JPEG marker codes */ | |||
| M_SOF0 = 0xc0, | |||
| M_SOF1 = 0xc1, | |||
| M_SOF2 = 0xc2, | |||
| M_SOF3 = 0xc3, | |||
| M_SOF5 = 0xc5, | |||
| M_SOF6 = 0xc6, | |||
| M_SOF7 = 0xc7, | |||
| M_JPG = 0xc8, | |||
| M_SOF9 = 0xc9, | |||
| M_SOF10 = 0xca, | |||
| M_SOF11 = 0xcb, | |||
| M_SOF13 = 0xcd, | |||
| M_SOF14 = 0xce, | |||
| M_SOF15 = 0xcf, | |||
| M_DHT = 0xc4, | |||
| M_DAC = 0xcc, | |||
| M_RST0 = 0xd0, | |||
| M_RST1 = 0xd1, | |||
| M_RST2 = 0xd2, | |||
| M_RST3 = 0xd3, | |||
| M_RST4 = 0xd4, | |||
| M_RST5 = 0xd5, | |||
| M_RST6 = 0xd6, | |||
| M_RST7 = 0xd7, | |||
| M_SOI = 0xd8, | |||
| M_EOI = 0xd9, | |||
| M_SOS = 0xda, | |||
| M_DQT = 0xdb, | |||
| M_DNL = 0xdc, | |||
| M_DRI = 0xdd, | |||
| M_DHP = 0xde, | |||
| M_EXP = 0xdf, | |||
| M_APP0 = 0xe0, | |||
| M_APP1 = 0xe1, | |||
| M_APP2 = 0xe2, | |||
| M_APP3 = 0xe3, | |||
| M_APP4 = 0xe4, | |||
| M_APP5 = 0xe5, | |||
| M_APP6 = 0xe6, | |||
| M_APP7 = 0xe7, | |||
| M_APP8 = 0xe8, | |||
| M_APP9 = 0xe9, | |||
| M_APP10 = 0xea, | |||
| M_APP11 = 0xeb, | |||
| M_APP12 = 0xec, | |||
| M_APP13 = 0xed, | |||
| M_APP14 = 0xee, | |||
| M_APP15 = 0xef, | |||
| M_JPG0 = 0xf0, | |||
| M_JPG13 = 0xfd, | |||
| M_COM = 0xfe, | |||
| M_TEM = 0x01, | |||
| M_ERROR = 0x100 | |||
| } JPEG_MARKER; | |||
| /* Private state */ | |||
| typedef struct { | |||
| @@ -104,7 +36,7 @@ typedef struct { | |||
| /* Note: cur_marker is not linked into marker_list until it's all read. */ | |||
| } my_marker_reader; | |||
| typedef my_marker_reader * my_marker_ptr; | |||
| typedef my_marker_reader * my_marker_ptr2; | |||
| /* | |||
| @@ -739,7 +671,7 @@ METHODDEF(boolean) | |||
| save_marker (j_decompress_ptr cinfo) | |||
| /* Save an APPn or COM marker into the marker list */ | |||
| { | |||
| my_marker_ptr marker = (my_marker_ptr) cinfo->marker; | |||
| my_marker_ptr2 marker = (my_marker_ptr2) cinfo->marker; | |||
| jpeg_saved_marker_ptr cur_marker = marker->cur_marker; | |||
| unsigned int bytes_read, data_length; | |||
| JOCTET FAR * data; | |||
| @@ -1055,13 +987,13 @@ read_markers (j_decompress_ptr cinfo) | |||
| case M_APP13: | |||
| case M_APP14: | |||
| case M_APP15: | |||
| if (! (*((my_marker_ptr) cinfo->marker)->process_APPn[ | |||
| if (! (*((my_marker_ptr2) cinfo->marker)->process_APPn[ | |||
| cinfo->unread_marker - (int) M_APP0]) (cinfo)) | |||
| return JPEG_SUSPENDED; | |||
| break; | |||
| case M_COM: | |||
| if (! (*((my_marker_ptr) cinfo->marker)->process_COM) (cinfo)) | |||
| if (! (*((my_marker_ptr2) cinfo->marker)->process_COM) (cinfo)) | |||
| return JPEG_SUSPENDED; | |||
| break; | |||
| @@ -1241,7 +1173,7 @@ jpeg_resync_to_restart (j_decompress_ptr cinfo, int desired) | |||
| METHODDEF(void) | |||
| reset_marker_reader (j_decompress_ptr cinfo) | |||
| { | |||
| my_marker_ptr marker = (my_marker_ptr) cinfo->marker; | |||
| my_marker_ptr2 marker = (my_marker_ptr2) cinfo->marker; | |||
| cinfo->comp_info = NULL; /* until allocated by get_sof */ | |||
| cinfo->input_scan_number = 0; /* no SOS seen yet */ | |||
| @@ -1261,11 +1193,11 @@ reset_marker_reader (j_decompress_ptr cinfo) | |||
| GLOBAL(void) | |||
| jinit_marker_reader (j_decompress_ptr cinfo) | |||
| { | |||
| my_marker_ptr marker; | |||
| my_marker_ptr2 marker; | |||
| int i; | |||
| /* Create subobject in permanent pool */ | |||
| marker = (my_marker_ptr) | |||
| marker = (my_marker_ptr2) | |||
| (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, | |||
| SIZEOF(my_marker_reader)); | |||
| cinfo->marker = (struct jpeg_marker_reader *) marker; | |||
| @@ -1300,7 +1232,7 @@ GLOBAL(void) | |||
| jpeg_save_markers (j_decompress_ptr cinfo, int marker_code, | |||
| unsigned int length_limit) | |||
| { | |||
| my_marker_ptr marker = (my_marker_ptr) cinfo->marker; | |||
| my_marker_ptr2 marker = (my_marker_ptr2) cinfo->marker; | |||
| long maxlength; | |||
| jpeg_marker_parser_method processor; | |||
| @@ -1349,7 +1281,7 @@ GLOBAL(void) | |||
| jpeg_set_marker_processor (j_decompress_ptr cinfo, int marker_code, | |||
| jpeg_marker_parser_method routine) | |||
| { | |||
| my_marker_ptr marker = (my_marker_ptr) cinfo->marker; | |||
| my_marker_ptr2 marker = (my_marker_ptr2) cinfo->marker; | |||
| if (marker_code == (int) M_COM) | |||
| marker->process_COM = routine; | |||
| @@ -32,7 +32,7 @@ typedef struct { | |||
| struct jpeg_color_quantizer * quantizer_2pass; | |||
| } my_decomp_master; | |||
| typedef my_decomp_master * my_master_ptr; | |||
| typedef my_decomp_master * my_master_ptr6; | |||
| /* | |||
| @@ -287,7 +287,7 @@ prepare_range_limit_table (j_decompress_ptr cinfo) | |||
| LOCAL(void) | |||
| master_selection (j_decompress_ptr cinfo) | |||
| { | |||
| my_master_ptr master = (my_master_ptr) cinfo->master; | |||
| my_master_ptr6 master = (my_master_ptr6) cinfo->master; | |||
| boolean use_c_buffer; | |||
| long samplesperrow; | |||
| JDIMENSION jd_samplesperrow; | |||
| @@ -437,7 +437,7 @@ master_selection (j_decompress_ptr cinfo) | |||
| METHODDEF(void) | |||
| prepare_for_output_pass (j_decompress_ptr cinfo) | |||
| { | |||
| my_master_ptr master = (my_master_ptr) cinfo->master; | |||
| my_master_ptr6 master = (my_master_ptr6) cinfo->master; | |||
| if (master->pub.is_dummy_pass) { | |||
| #ifdef QUANT_2PASS_SUPPORTED | |||
| @@ -497,7 +497,7 @@ prepare_for_output_pass (j_decompress_ptr cinfo) | |||
| METHODDEF(void) | |||
| finish_output_pass (j_decompress_ptr cinfo) | |||
| { | |||
| my_master_ptr master = (my_master_ptr) cinfo->master; | |||
| my_master_ptr6 master = (my_master_ptr6) cinfo->master; | |||
| if (cinfo->quantize_colors) | |||
| (*cinfo->cquantize->finish_pass) (cinfo); | |||
| @@ -514,7 +514,7 @@ finish_output_pass (j_decompress_ptr cinfo) | |||
| GLOBAL(void) | |||
| jpeg_new_colormap (j_decompress_ptr cinfo) | |||
| { | |||
| my_master_ptr master = (my_master_ptr) cinfo->master; | |||
| my_master_ptr6 master = (my_master_ptr6) cinfo->master; | |||
| /* Prevent application from calling me at wrong times */ | |||
| if (cinfo->global_state != DSTATE_BUFIMAGE) | |||
| @@ -542,9 +542,9 @@ jpeg_new_colormap (j_decompress_ptr cinfo) | |||
| GLOBAL(void) | |||
| jinit_master_decompress (j_decompress_ptr cinfo) | |||
| { | |||
| my_master_ptr master; | |||
| my_master_ptr6 master; | |||
| master = (my_master_ptr) | |||
| master = (my_master_ptr6) | |||
| (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, | |||
| SIZEOF(my_decomp_master)); | |||
| cinfo->master = (struct jpeg_decomp_master *) master; | |||
| @@ -80,7 +80,7 @@ typedef my_upsampler * my_upsample_ptr; | |||
| */ | |||
| LOCAL(void) | |||
| build_ycc_rgb_table (j_decompress_ptr cinfo) | |||
| build_ycc_rgb_table2 (j_decompress_ptr cinfo) | |||
| { | |||
| my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; | |||
| int i; | |||
| @@ -394,7 +394,7 @@ jinit_merged_upsampler (j_decompress_ptr cinfo) | |||
| upsample->spare_row = NULL; | |||
| } | |||
| build_ycc_rgb_table(cinfo); | |||
| build_ycc_rgb_table2(cinfo); | |||
| } | |||
| #endif /* UPSAMPLE_MERGING_SUPPORTED */ | |||
| @@ -32,7 +32,7 @@ | |||
| typedef struct { | |||
| unsigned int EOBRUN; /* remaining EOBs in EOBRUN */ | |||
| int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */ | |||
| } savable_state; | |||
| } savable_state3; | |||
| /* This macro is to work around compilers with missing or broken | |||
| * structure assignment. You'll need to fix this code if you have | |||
| @@ -60,7 +60,7 @@ typedef struct { | |||
| * In case of suspension, we exit WITHOUT updating them. | |||
| */ | |||
| bitread_perm_state bitstate; /* Bit buffer at start of MCU */ | |||
| savable_state saved; /* Other state at start of MCU */ | |||
| savable_state3 saved; /* Other state at start of MCU */ | |||
| /* These fields are NOT loaded into local working state. */ | |||
| unsigned int restarts_to_go; /* MCUs left in this restart interval */ | |||
| @@ -71,7 +71,7 @@ typedef struct { | |||
| d_derived_tbl * ac_derived_tbl; /* active table during an AC scan */ | |||
| } phuff_entropy_decoder; | |||
| typedef phuff_entropy_decoder * phuff_entropy_ptr; | |||
| typedef phuff_entropy_decoder * phuff_entropy_ptr2; | |||
| /* Forward declarations */ | |||
| METHODDEF(boolean) decode_mcu_DC_first JPP((j_decompress_ptr cinfo, | |||
| @@ -91,7 +91,7 @@ METHODDEF(boolean) decode_mcu_AC_refine JPP((j_decompress_ptr cinfo, | |||
| METHODDEF(void) | |||
| start_pass_phuff_decoder (j_decompress_ptr cinfo) | |||
| { | |||
| phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; | |||
| phuff_entropy_ptr2 entropy = (phuff_entropy_ptr2) cinfo->entropy; | |||
| boolean is_DC_band, bad; | |||
| int ci, coefi, tbl; | |||
| int *coef_bit_ptr; | |||
| @@ -193,41 +193,15 @@ start_pass_phuff_decoder (j_decompress_ptr cinfo) | |||
| } | |||
| /* | |||
| * Figure F.12: extend sign bit. | |||
| * On some machines, a shift and add will be faster than a table lookup. | |||
| */ | |||
| #ifdef AVOID_TABLES | |||
| #define HUFF_EXTEND(x,s) ((x) < (1<<((s)-1)) ? (x) + (((-1)<<(s)) + 1) : (x)) | |||
| #else | |||
| #define HUFF_EXTEND(x,s) ((x) < extend_test[s] ? (x) + extend_offset[s] : (x)) | |||
| static const int extend_test[16] = /* entry n is 2**(n-1) */ | |||
| { 0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, | |||
| 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000 }; | |||
| static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */ | |||
| { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, | |||
| ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1, | |||
| ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1, | |||
| ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 }; | |||
| #endif /* AVOID_TABLES */ | |||
| /* | |||
| * Check for a restart marker & resynchronize decoder. | |||
| * Returns FALSE if must suspend. | |||
| */ | |||
| LOCAL(boolean) | |||
| process_restart (j_decompress_ptr cinfo) | |||
| process_restartp (j_decompress_ptr cinfo) | |||
| { | |||
| phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; | |||
| phuff_entropy_ptr2 entropy = (phuff_entropy_ptr2) cinfo->entropy; | |||
| int ci; | |||
| /* Throw away any unused bits remaining in bit buffer; */ | |||
| @@ -285,20 +259,20 @@ process_restart (j_decompress_ptr cinfo) | |||
| METHODDEF(boolean) | |||
| decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) | |||
| { | |||
| phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; | |||
| phuff_entropy_ptr2 entropy = (phuff_entropy_ptr2) cinfo->entropy; | |||
| int Al = cinfo->Al; | |||
| register int s, r; | |||
| int blkn, ci; | |||
| JBLOCKROW block; | |||
| BITREAD_STATE_VARS; | |||
| savable_state state; | |||
| savable_state3 state; | |||
| d_derived_tbl * tbl; | |||
| jpeg_component_info * compptr; | |||
| /* Process restart marker if needed; may have to suspend */ | |||
| if (cinfo->restart_interval) { | |||
| if (entropy->restarts_to_go == 0) | |||
| if (! process_restart(cinfo)) | |||
| if (! process_restartp(cinfo)) | |||
| return FALSE; | |||
| } | |||
| @@ -356,7 +330,7 @@ decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) | |||
| METHODDEF(boolean) | |||
| decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) | |||
| { | |||
| phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; | |||
| phuff_entropy_ptr2 entropy = (phuff_entropy_ptr2) cinfo->entropy; | |||
| int Se = cinfo->Se; | |||
| int Al = cinfo->Al; | |||
| register int s, k, r; | |||
| @@ -368,7 +342,7 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) | |||
| /* Process restart marker if needed; may have to suspend */ | |||
| if (cinfo->restart_interval) { | |||
| if (entropy->restarts_to_go == 0) | |||
| if (! process_restart(cinfo)) | |||
| if (! process_restartp(cinfo)) | |||
| return FALSE; | |||
| } | |||
| @@ -441,7 +415,7 @@ decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) | |||
| METHODDEF(boolean) | |||
| decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) | |||
| { | |||
| phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; | |||
| phuff_entropy_ptr2 entropy = (phuff_entropy_ptr2) cinfo->entropy; | |||
| int p1 = 1 << cinfo->Al; /* 1 in the bit position being coded */ | |||
| int blkn; | |||
| JBLOCKROW block; | |||
| @@ -450,7 +424,7 @@ decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) | |||
| /* Process restart marker if needed; may have to suspend */ | |||
| if (cinfo->restart_interval) { | |||
| if (entropy->restarts_to_go == 0) | |||
| if (! process_restart(cinfo)) | |||
| if (! process_restartp(cinfo)) | |||
| return FALSE; | |||
| } | |||
| @@ -490,7 +464,7 @@ decode_mcu_DC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) | |||
| METHODDEF(boolean) | |||
| decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) | |||
| { | |||
| phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy; | |||
| phuff_entropy_ptr2 entropy = (phuff_entropy_ptr2) cinfo->entropy; | |||
| int Se = cinfo->Se; | |||
| int p1 = 1 << cinfo->Al; /* 1 in the bit position being coded */ | |||
| int m1 = (-1) << cinfo->Al; /* -1 in the bit position being coded */ | |||
| @@ -506,7 +480,7 @@ decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) | |||
| /* Process restart marker if needed; may have to suspend */ | |||
| if (cinfo->restart_interval) { | |||
| if (entropy->restarts_to_go == 0) | |||
| if (! process_restart(cinfo)) | |||
| if (! process_restartp(cinfo)) | |||
| return FALSE; | |||
| } | |||
| @@ -640,11 +614,11 @@ undoit: | |||
| GLOBAL(void) | |||
| jinit_phuff_decoder (j_decompress_ptr cinfo) | |||
| { | |||
| phuff_entropy_ptr entropy; | |||
| phuff_entropy_ptr2 entropy; | |||
| int *coef_bit_ptr; | |||
| int ci, i; | |||
| entropy = (phuff_entropy_ptr) | |||
| entropy = (phuff_entropy_ptr2) | |||
| (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, | |||
| SIZEOF(phuff_entropy_decoder)); | |||
| cinfo->entropy = (struct jpeg_entropy_decoder *) entropy; | |||
| @@ -56,9 +56,9 @@ typedef struct { | |||
| */ | |||
| UINT8 h_expand[MAX_COMPONENTS]; | |||
| UINT8 v_expand[MAX_COMPONENTS]; | |||
| } my_upsampler; | |||
| } my_upsampler2; | |||
| typedef my_upsampler * my_upsample_ptr; | |||
| typedef my_upsampler2 * my_upsample_ptr2; | |||
| /* | |||
| @@ -68,7 +68,7 @@ typedef my_upsampler * my_upsample_ptr; | |||
| METHODDEF(void) | |||
| start_pass_upsample (j_decompress_ptr cinfo) | |||
| { | |||
| my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; | |||
| my_upsample_ptr2 upsample = (my_upsample_ptr2) cinfo->upsample; | |||
| /* Mark the conversion buffer empty */ | |||
| upsample->next_row_out = cinfo->max_v_samp_factor; | |||
| @@ -92,7 +92,7 @@ sep_upsample (j_decompress_ptr cinfo, | |||
| JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, | |||
| JDIMENSION out_rows_avail) | |||
| { | |||
| my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; | |||
| my_upsample_ptr2 upsample = (my_upsample_ptr2) cinfo->upsample; | |||
| int ci; | |||
| jpeg_component_info * compptr; | |||
| JDIMENSION num_rows; | |||
| @@ -189,7 +189,7 @@ METHODDEF(void) | |||
| int_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, | |||
| JSAMPARRAY input_data, JSAMPARRAY * output_data_ptr) | |||
| { | |||
| my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample; | |||
| my_upsample_ptr2 upsample = (my_upsample_ptr2) cinfo->upsample; | |||
| JSAMPARRAY output_data = *output_data_ptr; | |||
| register JSAMPROW inptr, outptr; | |||
| register JSAMPLE invalue; | |||
| @@ -398,15 +398,15 @@ h2v2_fancy_upsample (j_decompress_ptr cinfo, jpeg_component_info * compptr, | |||
| GLOBAL(void) | |||
| jinit_upsampler (j_decompress_ptr cinfo) | |||
| { | |||
| my_upsample_ptr upsample; | |||
| my_upsample_ptr2 upsample; | |||
| int ci; | |||
| jpeg_component_info * compptr; | |||
| boolean need_buffer, do_fancy; | |||
| int h_in_group, v_in_group, h_out_group, v_out_group; | |||
| upsample = (my_upsample_ptr) | |||
| upsample = (my_upsample_ptr2) | |||
| (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, | |||
| SIZEOF(my_upsampler)); | |||
| SIZEOF(my_upsampler2)); | |||
| cinfo->upsample = (struct jpeg_upsampler *) upsample; | |||
| upsample->pub.start_pass = start_pass_upsample; | |||
| upsample->pub.upsample = sep_upsample; | |||
| @@ -17,6 +17,9 @@ | |||
| /* Include auto-config file to find out which system include files we need. */ | |||
| #ifndef __jinclude_h__ | |||
| #define __jinclude_h__ | |||
| #include "jconfig.h" /* auto configuration options */ | |||
| #define JCONFIG_INCLUDED /* so that jpeglib.h doesn't do it again */ | |||
| @@ -89,3 +92,101 @@ | |||
| ((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))) | |||
| typedef enum { /* JPEG marker codes */ | |||
| M_SOF0 = 0xc0, | |||
| M_SOF1 = 0xc1, | |||
| M_SOF2 = 0xc2, | |||
| M_SOF3 = 0xc3, | |||
| M_SOF5 = 0xc5, | |||
| M_SOF6 = 0xc6, | |||
| M_SOF7 = 0xc7, | |||
| M_JPG = 0xc8, | |||
| M_SOF9 = 0xc9, | |||
| M_SOF10 = 0xca, | |||
| M_SOF11 = 0xcb, | |||
| M_SOF13 = 0xcd, | |||
| M_SOF14 = 0xce, | |||
| M_SOF15 = 0xcf, | |||
| M_DHT = 0xc4, | |||
| M_DAC = 0xcc, | |||
| M_RST0 = 0xd0, | |||
| M_RST1 = 0xd1, | |||
| M_RST2 = 0xd2, | |||
| M_RST3 = 0xd3, | |||
| M_RST4 = 0xd4, | |||
| M_RST5 = 0xd5, | |||
| M_RST6 = 0xd6, | |||
| M_RST7 = 0xd7, | |||
| M_SOI = 0xd8, | |||
| M_EOI = 0xd9, | |||
| M_SOS = 0xda, | |||
| M_DQT = 0xdb, | |||
| M_DNL = 0xdc, | |||
| M_DRI = 0xdd, | |||
| M_DHP = 0xde, | |||
| M_EXP = 0xdf, | |||
| M_APP0 = 0xe0, | |||
| M_APP1 = 0xe1, | |||
| M_APP2 = 0xe2, | |||
| M_APP3 = 0xe3, | |||
| M_APP4 = 0xe4, | |||
| M_APP5 = 0xe5, | |||
| M_APP6 = 0xe6, | |||
| M_APP7 = 0xe7, | |||
| M_APP8 = 0xe8, | |||
| M_APP9 = 0xe9, | |||
| M_APP10 = 0xea, | |||
| M_APP11 = 0xeb, | |||
| M_APP12 = 0xec, | |||
| M_APP13 = 0xed, | |||
| M_APP14 = 0xee, | |||
| M_APP15 = 0xef, | |||
| M_JPG0 = 0xf0, | |||
| M_JPG13 = 0xfd, | |||
| M_COM = 0xfe, | |||
| M_TEM = 0x01, | |||
| M_ERROR = 0x100 | |||
| } JPEG_MARKER; | |||
| /* | |||
| * Figure F.12: extend sign bit. | |||
| * On some machines, a shift and add will be faster than a table lookup. | |||
| */ | |||
| #ifdef AVOID_TABLES | |||
| #define HUFF_EXTEND(x,s) ((x) < (1<<((s)-1)) ? (x) + (((-1)<<(s)) + 1) : (x)) | |||
| #else | |||
| #define HUFF_EXTEND(x,s) ((x) < extend_test[s] ? (x) + extend_offset[s] : (x)) | |||
| static const int extend_test[16] = /* entry n is 2**(n-1) */ | |||
| { 0, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, | |||
| 0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000 }; | |||
| static const int extend_offset[16] = /* entry n is (-1 << n) + 1 */ | |||
| { 0, ((-1)<<1) + 1, ((-1)<<2) + 1, ((-1)<<3) + 1, ((-1)<<4) + 1, | |||
| ((-1)<<5) + 1, ((-1)<<6) + 1, ((-1)<<7) + 1, ((-1)<<8) + 1, | |||
| ((-1)<<9) + 1, ((-1)<<10) + 1, ((-1)<<11) + 1, ((-1)<<12) + 1, | |||
| ((-1)<<13) + 1, ((-1)<<14) + 1, ((-1)<<15) + 1 }; | |||
| #endif /* AVOID_TABLES */ | |||
| #endif | |||
| @@ -84,7 +84,7 @@ jpeg_mem_available (j_common_ptr cinfo, long min_bytes_needed, | |||
| */ | |||
| GLOBAL(void) | |||
| jpeg_open_backing_store (j_common_ptr cinfo, backing_store_ptr info, | |||
| jpeg_open_backing_store (j_common_ptr cinfo, struct backing_store_struct *info, | |||
| long total_bytes_needed) | |||
| { | |||
| ERREXIT(cinfo, JERR_NO_BACKING_STORE); | |||
| @@ -18,6 +18,8 @@ | |||
| * and USE_MAC_MEMMGR. | |||
| */ | |||
| #ifndef __jmemsys_h__ | |||
| #define __jmemsys_h__ | |||
| /* Short forms of external names for systems with brain-damaged linkers. */ | |||
| @@ -134,20 +136,20 @@ typedef union { | |||
| #endif /* USE_MAC_MEMMGR */ | |||
| typedef struct backing_store_struct * backing_store_ptr; | |||
| //typedef struct backing_store_struct * backing_store_ptr; | |||
| typedef struct backing_store_struct { | |||
| /* Methods for reading/writing/closing this backing-store object */ | |||
| JMETHOD(void, read_backing_store, (j_common_ptr cinfo, | |||
| backing_store_ptr info, | |||
| struct backing_store_struct *info, | |||
| void FAR * buffer_address, | |||
| long file_offset, long byte_count)); | |||
| JMETHOD(void, write_backing_store, (j_common_ptr cinfo, | |||
| backing_store_ptr info, | |||
| struct backing_store_struct *info, | |||
| void FAR * buffer_address, | |||
| long file_offset, long byte_count)); | |||
| JMETHOD(void, close_backing_store, (j_common_ptr cinfo, | |||
| backing_store_ptr info)); | |||
| struct backing_store_struct *info)); | |||
| /* Private fields for system-dependent backing-store management */ | |||
| #ifdef USE_MSDOS_MEMMGR | |||
| @@ -178,7 +180,7 @@ typedef struct backing_store_struct { | |||
| */ | |||
| EXTERN(void) jpeg_open_backing_store JPP((j_common_ptr cinfo, | |||
| backing_store_ptr info, | |||
| struct backing_store_struct *info, | |||
| long total_bytes_needed)); | |||
| @@ -196,3 +198,6 @@ EXTERN(void) jpeg_open_backing_store JPP((j_common_ptr cinfo, | |||
| EXTERN(long) jpeg_mem_init JPP((j_common_ptr cinfo)); | |||
| EXTERN(void) jpeg_mem_term JPP((j_common_ptr cinfo)); | |||
| #endif | |||
| @@ -206,9 +206,9 @@ typedef struct { | |||
| FSERRPTR fserrors; /* accumulated errors */ | |||
| boolean on_odd_row; /* flag to remember which row we are on */ | |||
| int * error_limiter; /* table for clamping the applied error */ | |||
| } my_cquantizer; | |||
| } my_cquantizer2; | |||
| typedef my_cquantizer * my_cquantize_ptr; | |||
| typedef my_cquantizer2 * my_cquantize_ptr2; | |||
| /* | |||
| @@ -224,7 +224,7 @@ METHODDEF(void) | |||
| prescan_quantize (j_decompress_ptr cinfo, JSAMPARRAY input_buf, | |||
| JSAMPARRAY output_buf, int num_rows) | |||
| { | |||
| my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; | |||
| my_cquantize_ptr2 cquantize = (my_cquantize_ptr2) cinfo->cquantize; | |||
| register JSAMPROW ptr; | |||
| register histptr histp; | |||
| register hist3d histogram = cquantize->histogram; | |||
| @@ -314,7 +314,7 @@ update_box (j_decompress_ptr cinfo, boxptr boxp) | |||
| /* Shrink the min/max bounds of a box to enclose only nonzero elements, */ | |||
| /* and recompute its volume and population */ | |||
| { | |||
| my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; | |||
| my_cquantize_ptr2 cquantize = (my_cquantize_ptr2) cinfo->cquantize; | |||
| hist3d histogram = cquantize->histogram; | |||
| histptr histp; | |||
| int c0,c1,c2; | |||
| @@ -501,7 +501,7 @@ compute_color (j_decompress_ptr cinfo, boxptr boxp, int icolor) | |||
| { | |||
| /* Current algorithm: mean weighted by pixels (not colors) */ | |||
| /* Note it is important to get the rounding correct! */ | |||
| my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; | |||
| my_cquantize_ptr2 cquantize = (my_cquantize_ptr2) cinfo->cquantize; | |||
| hist3d histogram = cquantize->histogram; | |||
| histptr histp; | |||
| int c0,c1,c2; | |||
| @@ -857,7 +857,7 @@ fill_inverse_cmap (j_decompress_ptr cinfo, int c0, int c1, int c2) | |||
| /* histogram cell c0/c1/c2. (Only that one cell MUST be filled, but */ | |||
| /* we can fill as many others as we wish.) */ | |||
| { | |||
| my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; | |||
| my_cquantize_ptr2 cquantize = (my_cquantize_ptr2) cinfo->cquantize; | |||
| hist3d histogram = cquantize->histogram; | |||
| int minc0, minc1, minc2; /* lower left corner of update box */ | |||
| int ic0, ic1, ic2; | |||
| @@ -916,7 +916,7 @@ pass2_no_dither (j_decompress_ptr cinfo, | |||
| JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows) | |||
| /* This version performs no dithering */ | |||
| { | |||
| my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; | |||
| my_cquantize_ptr2 cquantize = (my_cquantize_ptr2) cinfo->cquantize; | |||
| hist3d histogram = cquantize->histogram; | |||
| register JSAMPROW inptr, outptr; | |||
| register histptr cachep; | |||
| @@ -950,7 +950,7 @@ pass2_fs_dither (j_decompress_ptr cinfo, | |||
| JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows) | |||
| /* This version performs Floyd-Steinberg dithering */ | |||
| { | |||
| my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; | |||
| my_cquantize_ptr2 cquantize = (my_cquantize_ptr2) cinfo->cquantize; | |||
| hist3d histogram = cquantize->histogram; | |||
| register LOCFSERROR cur0, cur1, cur2; /* current error or pixel value */ | |||
| LOCFSERROR belowerr0, belowerr1, belowerr2; /* error for pixel below cur */ | |||
| @@ -1108,7 +1108,7 @@ LOCAL(void) | |||
| init_error_limit (j_decompress_ptr cinfo) | |||
| /* Allocate and fill in the error_limiter table */ | |||
| { | |||
| my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; | |||
| my_cquantize_ptr2 cquantize = (my_cquantize_ptr2) cinfo->cquantize; | |||
| int * table; | |||
| int in, out; | |||
| @@ -1142,7 +1142,7 @@ init_error_limit (j_decompress_ptr cinfo) | |||
| METHODDEF(void) | |||
| finish_pass1 (j_decompress_ptr cinfo) | |||
| { | |||
| my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; | |||
| my_cquantize_ptr2 cquantize = (my_cquantize_ptr2) cinfo->cquantize; | |||
| /* Select the representative colors and fill in cinfo->colormap */ | |||
| cinfo->colormap = cquantize->sv_colormap; | |||
| @@ -1166,7 +1166,7 @@ finish_pass2 (j_decompress_ptr cinfo) | |||
| METHODDEF(void) | |||
| start_pass_2_quant (j_decompress_ptr cinfo, boolean is_pre_scan) | |||
| { | |||
| my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; | |||
| my_cquantize_ptr2 cquantize = (my_cquantize_ptr2) cinfo->cquantize; | |||
| hist3d histogram = cquantize->histogram; | |||
| int i; | |||
| @@ -1229,7 +1229,7 @@ start_pass_2_quant (j_decompress_ptr cinfo, boolean is_pre_scan) | |||
| METHODDEF(void) | |||
| new_color_map_2_quant (j_decompress_ptr cinfo) | |||
| { | |||
| my_cquantize_ptr cquantize = (my_cquantize_ptr) cinfo->cquantize; | |||
| my_cquantize_ptr2 cquantize = (my_cquantize_ptr2) cinfo->cquantize; | |||
| /* Reset the inverse color map */ | |||
| cquantize->needs_zeroed = TRUE; | |||
| @@ -1243,12 +1243,12 @@ new_color_map_2_quant (j_decompress_ptr cinfo) | |||
| GLOBAL(void) | |||
| jinit_2pass_quantizer (j_decompress_ptr cinfo) | |||
| { | |||
| my_cquantize_ptr cquantize; | |||
| my_cquantize_ptr2 cquantize; | |||
| int i; | |||
| cquantize = (my_cquantize_ptr) | |||
| cquantize = (my_cquantize_ptr2) | |||
| (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, | |||
| SIZEOF(my_cquantizer)); | |||
| SIZEOF(my_cquantizer2)); | |||
| cinfo->cquantize = (struct jpeg_color_quantizer *) cquantize; | |||
| cquantize->pub.start_pass = start_pass_2_quant; | |||
| cquantize->pub.new_color_map = new_color_map_2_quant; | |||
| @@ -1249,7 +1249,7 @@ typedef double FAR * FAR * png_doublepp; | |||
| /* Pointers to pointers to pointers; i.e., pointer to array */ | |||
| typedef char FAR * FAR * FAR * png_charppp; | |||
| #if defined(PNG_1_0_X) || defined(PNG_1_2_X) | |||
| #if 0 | |||
| /* SPC - Is this stuff deprecated? */ | |||
| /* It'll be removed as of libpng-1.3.0 - GR-P */ | |||
| /* libpng typedefs for types in zlib. If zlib changes | |||
| @@ -791,7 +791,10 @@ png_process_IDAT_data(png_structp png_ptr, png_bytep buffer, | |||
| png_ptr->row_number == png_ptr->num_rows)) | |||
| { | |||
| if (png_ptr->zstream.avail_in) | |||
| { | |||
| png_warning(png_ptr, "Too much data in IDAT chunks"); | |||
| } | |||
| png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED; | |||
| break; | |||
| } | |||
| @@ -37,10 +37,12 @@ BEGIN_JUCE_NAMESPACE | |||
| #include "juce_DirectoryIterator.h" | |||
| void* juce_findFileStart (const String& directory, const String& wildCard, String& firstResultFile, | |||
| bool* isDirectory, bool* isHidden, int64* fileSize, Time* modTime, Time* creationTime, bool* isReadOnly); | |||
| bool* isDirectory, bool* isHidden, int64* fileSize, | |||
| Time* modTime, Time* creationTime, bool* isReadOnly) throw(); | |||
| bool juce_findFileNext (void* handle, String& resultFile, | |||
| bool* isDirectory, bool* isHidden, int64* fileSize, Time* modTime, Time* creationTime, bool* isReadOnly); | |||
| void juce_findFileClose (void* handle); | |||
| bool* isDirectory, bool* isHidden, int64* fileSize, | |||
| Time* modTime, Time* creationTime, bool* isReadOnly) throw(); | |||
| void juce_findFileClose (void* handle) throw(); | |||
| //============================================================================== | |||
| @@ -55,7 +55,7 @@ BEGIN_JUCE_NAMESPACE | |||
| //============================================================================== | |||
| void* juce_fileOpen (const String& path, bool forWriting) throw(); | |||
| void juce_fileClose (void* handle) throw(); | |||
| int juce_fileWrite (void* handle, void* buffer, int size) throw(); | |||
| int juce_fileWrite (void* handle, const void* buffer, int size) throw(); | |||
| int64 juce_fileGetPosition (void* handle) throw(); | |||
| int64 juce_fileSetPosition (void* handle, int64 pos) throw(); | |||
| void juce_fileFlush (void* handle) throw(); | |||
| @@ -86,11 +86,13 @@ const String juce_getVolumeLabel (const String& filenameOnVolume, int& volumeSer | |||
| // juce_firstResultFile gets the name of the file (not the whole pathname) and | |||
| // the other pointers, if non-null, are set based on the properties of the file. | |||
| void* juce_findFileStart (const String& directory, const String& wildCard, String& firstResultFile, | |||
| bool* isDirectory, bool* isHidden, int64* fileSize, Time* modTime, Time* creationTime, bool* isReadOnly) throw(); | |||
| bool* isDirectory, bool* isHidden, int64* fileSize, Time* modTime, | |||
| Time* creationTime, bool* isReadOnly) throw(); | |||
| // returns false when no more files are found | |||
| bool juce_findFileNext (void* handle, String& resultFile, | |||
| bool* isDirectory, bool* isHidden, int64* fileSize, Time* modTime, Time* creationTime, bool* isReadOnly) throw(); | |||
| bool* isDirectory, bool* isHidden, int64* fileSize, | |||
| Time* modTime, Time* creationTime, bool* isReadOnly) throw(); | |||
| void juce_findFileClose (void* handle) throw(); | |||
| @@ -516,7 +516,7 @@ const String URL::addEscapeChars (const String& s) | |||
| //============================================================================== | |||
| extern bool juce_launchFile (const String& fileName, | |||
| const String& parameters); | |||
| const String& parameters) throw(); | |||
| bool URL::launchInDefaultBrowser() const | |||
| { | |||
| @@ -54,10 +54,7 @@ | |||
| #endif | |||
| /* ========================================================================= */ | |||
| uLong ZEXPORT adler32(adler, buf, len) | |||
| uLong adler; | |||
| const Bytef *buf; | |||
| uInt len; | |||
| uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len) | |||
| { | |||
| unsigned long sum2; | |||
| unsigned n; | |||
| @@ -125,10 +122,7 @@ uLong ZEXPORT adler32(adler, buf, len) | |||
| } | |||
| /* ========================================================================= */ | |||
| uLong ZEXPORT adler32_combine(adler1, adler2, len2) | |||
| uLong adler1; | |||
| uLong adler2; | |||
| z_off_t len2; | |||
| uLong ZEXPORT adler32_combine(uLong adler1, uLong adler2, z_off_t len2) | |||
| { | |||
| unsigned long sum1; | |||
| unsigned long sum2; | |||
| @@ -19,12 +19,8 @@ | |||
| memory, Z_BUF_ERROR if there was not enough room in the output buffer, | |||
| Z_STREAM_ERROR if the level parameter is invalid. | |||
| */ | |||
| int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) | |||
| Bytef *dest; | |||
| uLongf *destLen; | |||
| const Bytef *source; | |||
| uLong sourceLen; | |||
| int level; | |||
| int ZEXPORT compress2 (Bytef *dest, uLongf *destLen, const Bytef *source, | |||
| uLong sourceLen, int level) | |||
| { | |||
| z_stream stream; | |||
| int err; | |||
| @@ -59,11 +55,7 @@ int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) | |||
| /* =========================================================================== | |||
| */ | |||
| int ZEXPORT compress (dest, destLen, source, sourceLen) | |||
| Bytef *dest; | |||
| uLongf *destLen; | |||
| const Bytef *source; | |||
| uLong sourceLen; | |||
| int ZEXPORT compress (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen) | |||
| { | |||
| return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION); | |||
| } | |||
| @@ -72,8 +64,7 @@ int ZEXPORT compress (dest, destLen, source, sourceLen) | |||
| If the default memLevel or windowBits for deflateInit() is changed, then | |||
| this function needs to be updated. | |||
| */ | |||
| uLong ZEXPORT compressBound (sourceLen) | |||
| uLong sourceLen; | |||
| uLong ZEXPORT compressBound (uLong sourceLen) | |||
| { | |||
| return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + 11; | |||
| } | |||
| @@ -216,10 +216,7 @@ const unsigned long FAR * ZEXPORT get_crc_table() | |||
| #define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1 | |||
| /* ========================================================================= */ | |||
| unsigned long ZEXPORT crc32(crc, buf, len) | |||
| unsigned long crc; | |||
| const unsigned char FAR *buf; | |||
| unsigned len; | |||
| unsigned long ZEXPORT crc32 (unsigned long crc, const unsigned char FAR *buf, unsigned len) | |||
| { | |||
| if (buf == Z_NULL) return 0UL; | |||
| @@ -259,10 +256,7 @@ unsigned long ZEXPORT crc32(crc, buf, len) | |||
| #define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4 | |||
| /* ========================================================================= */ | |||
| local unsigned long crc32_little(crc, buf, len) | |||
| unsigned long crc; | |||
| const unsigned char FAR *buf; | |||
| unsigned len; | |||
| local unsigned long crc32_little(unsigned long crc, const unsigned char FAR *buf, unsigned len) | |||
| { | |||
| register u4 c; | |||
| register const u4 FAR *buf4; | |||
| @@ -299,10 +293,7 @@ local unsigned long crc32_little(crc, buf, len) | |||
| #define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4 | |||
| /* ========================================================================= */ | |||
| local unsigned long crc32_big(crc, buf, len) | |||
| unsigned long crc; | |||
| const unsigned char FAR *buf; | |||
| unsigned len; | |||
| local unsigned long crc32_big (unsigned long crc, const unsigned char FAR *buf, unsigned len) | |||
| { | |||
| register u4 c; | |||
| register const u4 FAR *buf4; | |||
| @@ -339,9 +330,7 @@ local unsigned long crc32_big(crc, buf, len) | |||
| #define GF2_DIM 32 /* dimension of GF(2) vectors (length of CRC) */ | |||
| /* ========================================================================= */ | |||
| local unsigned long gf2_matrix_times(mat, vec) | |||
| unsigned long *mat; | |||
| unsigned long vec; | |||
| local unsigned long gf2_matrix_times (unsigned long *mat, unsigned long vec) | |||
| { | |||
| unsigned long sum; | |||
| @@ -356,9 +345,7 @@ local unsigned long gf2_matrix_times(mat, vec) | |||
| } | |||
| /* ========================================================================= */ | |||
| local void gf2_matrix_square(square, mat) | |||
| unsigned long *square; | |||
| unsigned long *mat; | |||
| local void gf2_matrix_square (unsigned long *square, unsigned long *mat) | |||
| { | |||
| int n; | |||
| @@ -367,10 +354,7 @@ local void gf2_matrix_square(square, mat) | |||
| } | |||
| /* ========================================================================= */ | |||
| uLong ZEXPORT crc32_combine(crc1, crc2, len2) | |||
| uLong crc1; | |||
| uLong crc2; | |||
| z_off_t len2; | |||
| uLong ZEXPORT crc32_combine (uLong crc1, uLong crc2, z_off_t len2) | |||
| { | |||
| int n; | |||
| unsigned long row; | |||
| @@ -201,11 +201,7 @@ struct static_tree_desc_s {int dummy;}; /* for buggy compilers */ | |||
| zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head)); | |||
| /* ========================================================================= */ | |||
| int ZEXPORT deflateInit_(strm, level, version, stream_size) | |||
| z_streamp strm; | |||
| int level; | |||
| const char *version; | |||
| int stream_size; | |||
| int ZEXPORT deflateInit_(z_streamp strm, int level, const char *version, int stream_size) | |||
| { | |||
| return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, | |||
| Z_DEFAULT_STRATEGY, version, stream_size); | |||
| @@ -213,16 +209,7 @@ int ZEXPORT deflateInit_(strm, level, version, stream_size) | |||
| } | |||
| /* ========================================================================= */ | |||
| int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, | |||
| version, stream_size) | |||
| z_streamp strm; | |||
| int level; | |||
| int method; | |||
| int windowBits; | |||
| int memLevel; | |||
| int strategy; | |||
| const char *version; | |||
| int stream_size; | |||
| int ZEXPORT deflateInit2_ (z_streamp strm, int level, int method, int windowBits, int memLevel, int strategy, const char *version, int stream_size) | |||
| { | |||
| deflate_state *s; | |||
| int wrap = 1; | |||
| @@ -312,10 +299,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, | |||
| } | |||
| /* ========================================================================= */ | |||
| int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) | |||
| z_streamp strm; | |||
| const Bytef *dictionary; | |||
| uInt dictLength; | |||
| int ZEXPORT deflateSetDictionary (z_streamp strm, const Bytef *dictionary, uInt dictLength) | |||
| { | |||
| deflate_state *s; | |||
| uInt length = dictLength; | |||
| @@ -354,8 +338,7 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) | |||
| } | |||
| /* ========================================================================= */ | |||
| int ZEXPORT deflateReset (strm) | |||
| z_streamp strm; | |||
| int ZEXPORT deflateReset (z_streamp strm) | |||
| { | |||
| deflate_state *s; | |||
| @@ -390,9 +373,7 @@ int ZEXPORT deflateReset (strm) | |||
| } | |||
| /* ========================================================================= */ | |||
| int ZEXPORT deflateSetHeader (strm, head) | |||
| z_streamp strm; | |||
| gz_headerp head; | |||
| int ZEXPORT deflateSetHeader (z_streamp strm, gz_headerp head) | |||
| { | |||
| if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; | |||
| if (strm->state->wrap != 2) return Z_STREAM_ERROR; | |||
| @@ -401,10 +382,7 @@ int ZEXPORT deflateSetHeader (strm, head) | |||
| } | |||
| /* ========================================================================= */ | |||
| int ZEXPORT deflatePrime (strm, bits, value) | |||
| z_streamp strm; | |||
| int bits; | |||
| int value; | |||
| int ZEXPORT deflatePrime (z_streamp strm, int bits, int value) | |||
| { | |||
| if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; | |||
| strm->state->bi_valid = bits; | |||
| @@ -413,10 +391,7 @@ int ZEXPORT deflatePrime (strm, bits, value) | |||
| } | |||
| /* ========================================================================= */ | |||
| int ZEXPORT deflateParams(strm, level, strategy) | |||
| z_streamp strm; | |||
| int level; | |||
| int strategy; | |||
| int ZEXPORT deflateParams (z_streamp strm, int level, int strategy) | |||
| { | |||
| deflate_state *s; | |||
| compress_func func; | |||
| @@ -451,12 +426,7 @@ int ZEXPORT deflateParams(strm, level, strategy) | |||
| } | |||
| /* ========================================================================= */ | |||
| int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain) | |||
| z_streamp strm; | |||
| int good_length; | |||
| int max_lazy; | |||
| int nice_length; | |||
| int max_chain; | |||
| int ZEXPORT deflateTune (z_streamp strm, int good_length, int max_lazy, int nice_length, int max_chain) | |||
| { | |||
| deflate_state *s; | |||
| @@ -486,9 +456,7 @@ int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain) | |||
| * But even the conservative upper bound of about 14% expansion does not | |||
| * seem onerous for output buffer allocation. | |||
| */ | |||
| uLong ZEXPORT deflateBound(strm, sourceLen) | |||
| z_streamp strm; | |||
| uLong sourceLen; | |||
| uLong ZEXPORT deflateBound (z_streamp strm, uLong sourceLen) | |||
| { | |||
| deflate_state *s; | |||
| uLong destLen; | |||
| @@ -515,9 +483,7 @@ uLong ZEXPORT deflateBound(strm, sourceLen) | |||
| * IN assertion: the stream state is correct and there is enough room in | |||
| * pending_buf. | |||
| */ | |||
| local void putShortMSB (s, b) | |||
| deflate_state *s; | |||
| uInt b; | |||
| local void putShortMSB (deflate_state *s, uInt b) | |||
| { | |||
| put_byte(s, (Byte)(b >> 8)); | |||
| put_byte(s, (Byte)(b & 0xff)); | |||
| @@ -529,8 +495,7 @@ local void putShortMSB (s, b) | |||
| * to avoid allocating a large strm->next_out buffer and copying into it. | |||
| * (See also read_buf()). | |||
| */ | |||
| local void flush_pending(strm) | |||
| z_streamp strm; | |||
| local void flush_pending (z_streamp strm) | |||
| { | |||
| unsigned len = strm->state->pending; | |||
| @@ -549,9 +514,7 @@ local void flush_pending(strm) | |||
| } | |||
| /* ========================================================================= */ | |||
| int ZEXPORT deflate (strm, flush) | |||
| z_streamp strm; | |||
| int flush; | |||
| int ZEXPORT deflate (z_streamp strm, int flush) | |||
| { | |||
| int old_flush; /* value of flush param for previous deflate call */ | |||
| deflate_state *s; | |||
| @@ -856,8 +819,7 @@ int ZEXPORT deflate (strm, flush) | |||
| } | |||
| /* ========================================================================= */ | |||
| int ZEXPORT deflateEnd (strm) | |||
| z_streamp strm; | |||
| int ZEXPORT deflateEnd (z_streamp strm) | |||
| { | |||
| int status; | |||
| @@ -891,9 +853,7 @@ int ZEXPORT deflateEnd (strm) | |||
| * To simplify the source, this is not supported for 16-bit MSDOS (which | |||
| * doesn't have enough memory anyway to duplicate compression states). | |||
| */ | |||
| int ZEXPORT deflateCopy (dest, source) | |||
| z_streamp dest; | |||
| z_streamp source; | |||
| int ZEXPORT deflateCopy (z_streamp dest, z_streamp source) | |||
| { | |||
| #ifdef MAXSEG_64K | |||
| return Z_STREAM_ERROR; | |||
| @@ -953,10 +913,7 @@ int ZEXPORT deflateCopy (dest, source) | |||
| * allocating a large strm->next_in buffer and copying from it. | |||
| * (See also flush_pending()). | |||
| */ | |||
| local int read_buf(strm, buf, size) | |||
| z_streamp strm; | |||
| Bytef *buf; | |||
| unsigned size; | |||
| local int read_buf (z_streamp strm, Bytef *buf, unsigned size) | |||
| { | |||
| unsigned len = strm->avail_in; | |||
| @@ -983,8 +940,7 @@ local int read_buf(strm, buf, size) | |||
| /* =========================================================================== | |||
| * Initialize the "longest match" routines for a new zlib stream | |||
| */ | |||
| local void lm_init (s) | |||
| deflate_state *s; | |||
| local void lm_init (deflate_state *s) | |||
| { | |||
| s->window_size = (ulg)2L*s->w_size; | |||
| @@ -1024,9 +980,7 @@ local void lm_init (s) | |||
| /* For 80x86 and 680x0, an optimized version will be provided in match.asm or | |||
| * match.S. The code will be functionally equivalent. | |||
| */ | |||
| local uInt longest_match(s, cur_match) | |||
| deflate_state *s; | |||
| IPos cur_match; /* current match */ | |||
| local uInt longest_match(deflate_state *s, IPos cur_match) | |||
| { | |||
| unsigned chain_length = s->max_chain_length;/* max hash chain length */ | |||
| register Bytef *scan = s->window + s->strstart; /* current string */ | |||
| @@ -1172,9 +1126,7 @@ local uInt longest_match(s, cur_match) | |||
| /* --------------------------------------------------------------------------- | |||
| * Optimized version for level == 1 or strategy == Z_RLE only | |||
| */ | |||
| local uInt longest_match_fast(s, cur_match) | |||
| deflate_state *s; | |||
| IPos cur_match; /* current match */ | |||
| local uInt longest_match_fast (deflate_state *s, IPos cur_match) | |||
| { | |||
| register Bytef *scan = s->window + s->strstart; /* current string */ | |||
| register Bytef *match; /* matched string */ | |||
| @@ -1229,10 +1181,7 @@ local uInt longest_match_fast(s, cur_match) | |||
| /* =========================================================================== | |||
| * Check that the match at match_start is indeed a match. | |||
| */ | |||
| local void check_match(s, start, match, length) | |||
| deflate_state *s; | |||
| IPos start, match; | |||
| int length; | |||
| local void check_match(deflate_state *s, IPos start, IPos match, int length) | |||
| { | |||
| /* check that the match is indeed a match */ | |||
| if (zmemcmp(s->window + match, | |||
| @@ -1263,8 +1212,7 @@ local void check_match(s, start, match, length) | |||
| * performed for at least two bytes (required for the zip translate_eol | |||
| * option -- not supported here). | |||
| */ | |||
| local void fill_window(s) | |||
| deflate_state *s; | |||
| local void fill_window (deflate_state *s) | |||
| { | |||
| register unsigned n, m; | |||
| register Posf *p; | |||
| @@ -1387,9 +1335,7 @@ local void fill_window(s) | |||
| * NOTE: this function should be optimized to avoid extra copying from | |||
| * window to pending_buf. | |||
| */ | |||
| local block_state deflate_stored(s, flush) | |||
| deflate_state *s; | |||
| int flush; | |||
| local block_state deflate_stored(deflate_state *s, int flush) | |||
| { | |||
| /* Stored blocks are limited to 0xffff bytes, pending_buf is limited | |||
| * to pending_buf_size, and each stored block has a 5 byte header: | |||
| @@ -1445,9 +1391,7 @@ local block_state deflate_stored(s, flush) | |||
| * new strings in the dictionary only for unmatched strings or for short | |||
| * matches. It is used only for the fast compression options. | |||
| */ | |||
| local block_state deflate_fast(s, flush) | |||
| deflate_state *s; | |||
| int flush; | |||
| local block_state deflate_fast(deflate_state *s, int flush) | |||
| { | |||
| IPos hash_head = NIL; /* head of the hash chain */ | |||
| int bflush; /* set if current block must be flushed */ | |||
| @@ -1551,9 +1495,7 @@ local block_state deflate_fast(s, flush) | |||
| * evaluation for matches: a match is finally adopted only if there is | |||
| * no better match at the next window position. | |||
| */ | |||
| local block_state deflate_slow(s, flush) | |||
| deflate_state *s; | |||
| int flush; | |||
| local block_state deflate_slow(deflate_state *s, int flush) | |||
| { | |||
| IPos hash_head = NIL; /* head of hash chain */ | |||
| int bflush; /* set if current block must be flushed */ | |||
| @@ -23,6 +23,8 @@ | |||
| # define GZIP | |||
| #endif | |||
| #define NO_DUMMY_DECL | |||
| /* =========================================================================== | |||
| * Internal compression state. | |||
| */ | |||