aboutsummaryrefslogtreecommitdiff
path: root/Src/libvp6
diff options
context:
space:
mode:
authorJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
committerJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
commit20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (patch)
tree12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/libvp6
parent537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff)
downloadwinamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz
Initial community commit
Diffstat (limited to 'Src/libvp6')
-rw-r--r--Src/libvp6/config_dlg.cpp846
-rw-r--r--Src/libvp6/corelibs/include/WCompC.h86
-rw-r--r--Src/libvp6/corelibs/include/asmcolorconversions.h47
-rw-r--r--Src/libvp6/corelibs/include/bigend.h21
-rw-r--r--Src/libvp6/corelibs/include/cidasm.h20
-rw-r--r--Src/libvp6/corelibs/include/colorconversions.h37
-rw-r--r--Src/libvp6/corelibs/include/dkpltfrm.h73
-rw-r--r--Src/libvp6/corelibs/include/duck_hfb.h871
-rw-r--r--Src/libvp6/corelibs/include/duck_ifstream.hpp340
-rw-r--r--Src/libvp6/corelibs/include/duck_int.h26
-rw-r--r--Src/libvp6/corelibs/include/duck_io.h109
-rw-r--r--Src/libvp6/corelibs/include/duck_io_file.h44
-rw-r--r--Src/libvp6/corelibs/include/duck_io_http.h62
-rw-r--r--Src/libvp6/corelibs/include/duck_mem.h18
-rw-r--r--Src/libvp6/corelibs/include/duck_wav.h29
-rw-r--r--Src/libvp6/corelibs/include/duktypes.h25
-rw-r--r--Src/libvp6/corelibs/include/dxl_aud.h38
-rw-r--r--Src/libvp6/corelibs/include/dxl_main.h307
-rw-r--r--Src/libvp6/corelibs/include/littlend.h25
-rw-r--r--Src/libvp6/corelibs/include/miscasm.h19
-rw-r--r--Src/libvp6/corelibs/include/nethfb.h340
-rw-r--r--Src/libvp6/corelibs/include/testresults.h24
-rw-r--r--Src/libvp6/corelibs/include/toolvox.h1188
-rw-r--r--Src/libvp6/corelibs/include/tvgetstr.h148
-rw-r--r--Src/libvp6/corelibs/include/voxchunk.h127
-rw-r--r--Src/libvp6/corelibs/on2_common/src/on2_mem/build/win32/on2_mem.plg1786
-rw-r--r--Src/libvp6/corelibs/on2_common/src/on2_mem/build/win32/on2_mem.vcxproj317
-rw-r--r--Src/libvp6/corelibs/on2_common/src/on2_mem/build/win32/on2_mem.vcxproj.filters74
-rw-r--r--Src/libvp6/corelibs/on2_common/src/on2_mem/include/on2_mem.h108
-rw-r--r--Src/libvp6/corelibs/on2_common/src/on2_mem/include/on2_mem_tracker.h126
-rw-r--r--Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/hmm_alloc.c48
-rw-r--r--Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/hmm_base.c418
-rw-r--r--Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/hmm_dflt_abort.c43
-rw-r--r--Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/hmm_grow.c39
-rw-r--r--Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/hmm_largest.c49
-rw-r--r--Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/hmm_resize.c107
-rw-r--r--Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/hmm_shrink.c96
-rw-r--r--Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/hmm_true.c21
-rw-r--r--Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/include/cavl_if.h216
-rw-r--r--Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/include/cavl_impl.h1181
-rw-r--r--Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/include/heapmm.h142
-rw-r--r--Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/include/hmm_cnfg.h105
-rw-r--r--Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/include/hmm_intrnl.h149
-rw-r--r--Src/libvp6/corelibs/on2_common/src/on2_mem/on2_mem.c561
-rw-r--r--Src/libvp6/corelibs/on2_common/src/on2_mem/on2_mem.xcodeproj/project.pbxproj197
-rw-r--r--Src/libvp6/corelibs/on2_common/src/on2_mem/on2_mem_tracker.c596
-rw-r--r--Src/libvp6/corelibs/sal/generic/circlebuffer.c410
-rw-r--r--Src/libvp6/corelibs/sal/generic/circlebuffer.h99
-rw-r--r--Src/libvp6/corelibs/sal/generic/duck_io.c130
-rw-r--r--Src/libvp6/corelibs/sal/generic/duck_io_file.c224
-rw-r--r--Src/libvp6/corelibs/sal/generic/duck_io_http.c902
-rw-r--r--Src/libvp6/corelibs/sal/generic/on2_timer.c110
-rw-r--r--Src/libvp6/corelibs/sal/generic/on2_timer.h85
-rw-r--r--Src/libvp6/corelibs/sal/sal.vcproj228
-rw-r--r--Src/libvp6/corelibs/sal/win32/duck_io.c106
-rw-r--r--Src/libvp6/corelibs/sal/win32/duck_io32.c70
-rw-r--r--Src/libvp6/corelibs/sal/win32/duck_mem.c132
-rw-r--r--Src/libvp6/corelibs/sal/win32/duck_str.c19
-rw-r--r--Src/libvp6/include/AC3.hpp140
-rw-r--r--Src/libvp6/include/ACM.hpp31
-rw-r--r--Src/libvp6/include/AVC.hpp29
-rw-r--r--Src/libvp6/include/AVI.hpp984
-rw-r--r--Src/libvp6/include/Aud.hpp79
-rw-r--r--Src/libvp6/include/CPUIdLib.h57
-rw-r--r--Src/libvp6/include/DRMInfo.hpp85
-rw-r--r--Src/libvp6/include/FourCC.hpp110
-rw-r--r--Src/libvp6/include/IntTypes.cpp43
-rw-r--r--Src/libvp6/include/IntTypes.hpp28
-rw-r--r--Src/libvp6/include/MP3.hpp109
-rw-r--r--Src/libvp6/include/MediaInfo.hpp87
-rw-r--r--Src/libvp6/include/Mp3Header.hpp63
-rw-r--r--Src/libvp6/include/NSV.hpp381
-rw-r--r--Src/libvp6/include/NSV_Reader.hpp688
-rw-r--r--Src/libvp6/include/On2Crypt.h132
-rw-r--r--Src/libvp6/include/On2Decrypt.h75
-rw-r--r--Src/libvp6/include/PlayerModel.hpp112
-rw-r--r--Src/libvp6/include/Rvd.hpp198
-rw-r--r--Src/libvp6/include/VFWSetting.hpp65
-rw-r--r--Src/libvp6/include/VP6VFWState.hpp143
-rw-r--r--Src/libvp6/include/VPStreamData.hpp117
-rw-r--r--Src/libvp6/include/Vid.hpp167
-rw-r--r--Src/libvp6/include/WAV.hpp130
-rw-r--r--Src/libvp6/include/cclib.h183
-rw-r--r--Src/libvp6/include/codec_common_interface.h95
-rw-r--r--Src/libvp6/include/dkpltfrm.h73
-rw-r--r--Src/libvp6/include/duck_bmp.h79
-rw-r--r--Src/libvp6/include/duck_dxa.h230
-rw-r--r--Src/libvp6/include/duck_dxl.h583
-rw-r--r--Src/libvp6/include/endian.hpp202
-rw-r--r--Src/libvp6/include/littlend.h25
-rw-r--r--Src/libvp6/include/on2cmp.h49
-rw-r--r--Src/libvp6/include/on2vpplugin.h58
-rw-r--r--Src/libvp6/include/type_aliases.h75
-rw-r--r--Src/libvp6/include/vp50/comp_interface.h54
-rw-r--r--Src/libvp6/include/vp50/vfw_pb_interface.h66
-rw-r--r--Src/libvp6/include/vp50/vp50_comp_interface.h138
-rw-r--r--Src/libvp6/include/vp50dversion.h1
-rw-r--r--Src/libvp6/include/vp6.h13
-rw-r--r--Src/libvp6/include/vp60/comp_interface.h55
-rw-r--r--Src/libvp6/include/vp60/vfw_pb_interface.h62
-rw-r--r--Src/libvp6/include/vp60/vp60_comp_interface.h211
-rw-r--r--Src/libvp6/include/vp60dversion.h1
-rw-r--r--Src/libvp6/include/vp60eversion.h1
103 files changed, 20071 insertions, 0 deletions
diff --git a/Src/libvp6/config_dlg.cpp b/Src/libvp6/config_dlg.cpp
new file mode 100644
index 00000000..cd3c8712
--- /dev/null
+++ b/Src/libvp6/config_dlg.cpp
@@ -0,0 +1,846 @@
+/****************************************************************************
+*
+* Module Title : vfw_config_dlg.c
+*
+* Description : Configuration Parameters dialog module.
+*
+****************************************************************************/
+
+/****************************************************************************
+* Header Files
+****************************************************************************/
+#include <windows.h>
+#include <stdio.h>
+#include <commctrl.h>
+#include "type_aliases.h"
+#include "vp60_comp_interface.h"
+#include "resource.h" // Must be the version resident in the VCAP dll directory!!!
+#include "vpvfwver.h"
+#include "vp6vfw.h"
+#include "vp60_comp_interface.h"
+#include <commdlg.h>
+//#include <cderr.h>
+extern HINSTANCE hInstance;
+
+void BuildVersionInfo(char *modname,char *VersionInfo,int *vers)
+{
+
+ // ************************************************************
+ // The next bit of code reads version information from resource
+ VersionInfo[0]=0;
+ char szFullPath[256];
+ DWORD dwVerHnd;
+ DWORD dwVerInfoSize;
+ GetModuleFileName(/*GetModuleHandle(modname)*/hInstance, szFullPath, sizeof(szFullPath));
+ dwVerInfoSize = GetFileVersionInfoSize(szFullPath, &dwVerHnd);
+
+ if (dwVerInfoSize)
+ {
+ // If we were able to get the information, process it:
+ HANDLE hMem;
+ LPVOID lpvMem;
+
+ hMem = GlobalAlloc(GMEM_MOVEABLE, dwVerInfoSize);
+ lpvMem = GlobalLock(hMem);
+ GetFileVersionInfo(szFullPath, dwVerHnd, dwVerInfoSize, lpvMem);
+
+ UINT cchVer = 0;
+ LPSTR lszVer = NULL;
+ strcat(VersionInfo, "\r");
+ VerQueryValue(lpvMem,TEXT("\\StringFileInfo\\040904E4\\FileDescription"), (void **) &lszVer, &cchVer);
+ strcat(VersionInfo,lszVer);
+ strcat(VersionInfo, "\r\r");
+ VerQueryValue(lpvMem,TEXT("\\StringFileInfo\\040904E4\\LegalCopyright"), (void **) &lszVer, &cchVer);
+ strcat(VersionInfo,lszVer);
+ strcat(VersionInfo, "\r");
+ strcat(VersionInfo, " Version ");
+ VerQueryValue(lpvMem,TEXT("\\StringFileInfo\\040904E4\\ProductVersion"), (void **) &lszVer, &cchVer);
+ strcat(VersionInfo,lszVer);
+
+ GlobalUnlock(hMem);
+ GlobalFree(hMem);
+ }
+}
+
+BOOL FAR PASCAL Advanced_ParamsDlgProc( HWND hWndDlg,UINT Message,WPARAM wParam,LPARAM lParam );
+BOOL FAR PASCAL General_ParamsDlgProc( HWND hWndDlg,UINT Message,WPARAM wParam,LPARAM lParam );
+BOOL FAR PASCAL Settings_ParamsDlgProc( HWND hWndDlg,UINT Message,WPARAM wParam,LPARAM lParam );
+BOOL FAR PASCAL Main_ParamsDlgProc( HWND hWndDlg,
+ UINT Message,
+ WPARAM wParam,
+ LPARAM lParam)
+{
+ COMP_CONFIG_VP6 *compConfig = (COMP_CONFIG_VP6 *)GetWindowLong(hWndDlg,GWL_USERDATA);
+
+ switch(Message)
+ {
+ case WM_NOTIFY:
+ {
+ switch(wParam)
+ {
+ case IDC_TAB1:
+ {
+ NMHDR *msg = (NMHDR *) lParam;
+
+ switch(msg->code)
+ {
+ case TCN_SELCHANGE:
+ {
+ HWND hwndTab = GetDlgItem(hWndDlg, IDC_TAB1);
+ int whichTab = TabCtrl_GetCurSel(hwndTab);
+ switch(whichTab)
+ {
+ case 2:
+ {
+ if(compConfig->PlaceHolder)
+ DestroyWindow((HWND) compConfig->PlaceHolder);
+ compConfig->PlaceHolder = (INT32) CreateDialogParam(hInstance,"SETTINGS",hWndDlg,Settings_ParamsDlgProc ,(LPARAM) compConfig);
+ ShowWindow((HWND) compConfig->PlaceHolder,SW_SHOW);
+ return TRUE;
+ }
+ case 0:
+ {
+ if(compConfig->PlaceHolder)
+ DestroyWindow((HWND) compConfig->PlaceHolder);
+ compConfig->PlaceHolder = (INT32) CreateDialogParam(hInstance,"GENERAL",hWndDlg,General_ParamsDlgProc ,(LPARAM) compConfig);
+ ShowWindow((HWND) compConfig->PlaceHolder,SW_SHOW);
+ return TRUE;
+ }
+ case 1:
+ {
+
+ if(compConfig->PlaceHolder)
+ DestroyWindow((HWND) compConfig->PlaceHolder);
+ compConfig->PlaceHolder = (INT32) CreateDialogParam(hInstance,"ADVANCED",hWndDlg,Advanced_ParamsDlgProc ,(LPARAM) compConfig);
+ ShowWindow((HWND) compConfig->PlaceHolder,SW_SHOW);
+ return TRUE;
+ }
+ }
+
+ break;
+ }
+ }
+ break;
+ }
+ }
+ return (FALSE);
+ }
+ case WM_CTLCOLORSTATIC:
+ {
+ HDC hdc = (HDC) wParam;
+ HWND hwndStatic = (HWND) lParam;
+
+ if ( hwndStatic == GetDlgItem ( hWndDlg, IDC_TITLE ) ||
+ hwndStatic == GetDlgItem ( hWndDlg, IDC_FRAME ) )
+ {
+ return (LRESULT) GetStockObject(WHITE_BRUSH); ;
+ }
+ }
+ break;
+ case WM_INITDIALOG:
+ {
+
+ HWND hwndTab = GetDlgItem(hWndDlg, IDC_TAB1);
+ TC_ITEM tie;
+
+ SetWindowLong(hWndDlg, GWL_USERDATA, (unsigned long)lParam);
+ compConfig = (COMP_CONFIG_VP6 *) lParam;
+
+ tie.mask = TCIF_TEXT | TCIF_STATE | TCIF_IMAGE;
+ tie.iImage = -1;
+
+ tie.pszText = "General";
+ if (TabCtrl_InsertItem(hwndTab, 0, &tie) == -1)
+ return NULL;
+
+ tie.pszText = "Advanced";
+ if (TabCtrl_InsertItem(hwndTab, 1, &tie) == -1)
+ return NULL;
+
+ tie.pszText = "Settings";
+ if (TabCtrl_InsertItem(hwndTab, 2, &tie) == -1)
+ return NULL;
+
+ char VersionString[2048]={0};
+ int vers;
+ BuildVersionInfo("VP6VFW.DLL",VersionString,&vers);
+ SetDlgItemText( hWndDlg, IDC_TITLE, VersionString);
+
+
+ compConfig->PlaceHolder = (INT32) CreateDialogParam(hInstance,"GENERAL",hWndDlg,General_ParamsDlgProc ,(LPARAM) compConfig);
+ ShowWindow((HWND) compConfig->PlaceHolder,SW_SHOW);
+
+
+ return (TRUE);
+ }
+
+
+ case WM_CLOSE: /* Close the dialog. */
+ /* Closing the Dialog behaves the same as Cancel */
+ PostMessage(hWndDlg, WM_COMMAND, IDCANCEL, 0L);
+ return (TRUE);
+
+ case WM_COMMAND: /* A control has been activated. */
+ switch(LOWORD(wParam))
+ {
+ /* OK leaves the current settings in force */
+ case IDOK:
+ EndDialog(hWndDlg, IDOK);
+ break;
+
+ case IDCANCEL:
+ EndDialog(hWndDlg, IDCANCEL);
+ break;
+
+ default:
+ return (FALSE);
+
+ }
+ return (FALSE);
+
+ default:
+ return (FALSE);
+
+ } /* End of Main Dialog case statement. */
+
+ return FALSE;
+} /* End of WndProc */
+
+
+
+BOOL FAR PASCAL General_ParamsDlgProc( HWND hWndDlg,
+ UINT Message,
+ WPARAM wParam,
+ LPARAM lParam)
+{
+ COMP_CONFIG_VP6 *compConfig = (COMP_CONFIG_VP6 *)GetWindowLong(hWndDlg,GWL_USERDATA);
+
+ switch(Message)
+ {
+ case WM_SETFOCUS:
+ Message+=0;
+ break;
+ case WM_INITDIALOG:
+ {
+ SetWindowLong(hWndDlg, GWL_USERDATA, (unsigned long)lParam);
+ compConfig = (COMP_CONFIG_VP6 *) lParam;
+
+ // fill mode box
+ SendDlgItemMessage(hWndDlg, IDD_MODE, CB_ADDSTRING, 0, (LPARAM) (LPCSTR) "Realtime / Live Encoding");
+ SendDlgItemMessage(hWndDlg, IDD_MODE, CB_ADDSTRING, 0, (LPARAM) (LPCSTR) "Good Quality Fast Encoding");
+ SendDlgItemMessage(hWndDlg, IDD_MODE, CB_ADDSTRING, 0, (LPARAM) (LPCSTR) "One Pass - Best Quality");
+ SendDlgItemMessage(hWndDlg, IDD_MODE, CB_ADDSTRING, 0, (LPARAM) (LPCSTR) "Two Pass - First Pass" );
+ SendDlgItemMessage(hWndDlg, IDD_MODE, CB_ADDSTRING, 0, (LPARAM) (LPCSTR) "Two Pass - Second Pass - Good Quality");
+ SendDlgItemMessage(hWndDlg, IDD_MODE, CB_ADDSTRING, 0, (LPARAM) (LPCSTR) "Two Pass - Second Pass - Best Quality");
+
+ // set mode
+ SendDlgItemMessage(hWndDlg, IDD_MODE, CB_SETCURSEL, (LPARAM) compConfig->Mode,0);
+
+ // set end usage
+ switch(compConfig->EndUsage)
+ {
+ case 0:
+ CheckDlgButton( hWndDlg, IDC_ENDUSAGE1, 1);
+ CheckDlgButton( hWndDlg, IDC_ENDUSAGE2, 0);
+ break;
+ default:
+ CheckDlgButton( hWndDlg, IDC_ENDUSAGE2, 1);
+ CheckDlgButton( hWndDlg, IDC_ENDUSAGE1, 0);
+ break;
+ }
+
+ // set material
+ switch(compConfig->Interlaced)
+ {
+ case 1:
+ CheckDlgButton( hWndDlg, IDC_MATERIAL1, 1);
+ CheckDlgButton( hWndDlg, IDC_MATERIAL2, 0);
+ break;
+ default:
+ CheckDlgButton( hWndDlg, IDC_MATERIAL2, 1);
+ CheckDlgButton( hWndDlg, IDC_MATERIAL1, 0);
+ break;
+ }
+
+ // setup noise reduction slider
+ SendDlgItemMessage(hWndDlg, IDC_NOISEREDUCTION_SLIDER, TBM_SETRANGE, (WPARAM) TRUE, (LPARAM) MAKELONG(0, 6));
+
+ // set noise reduction
+ SetDlgItemInt( hWndDlg, IDC_NOISEREDUCTION, compConfig->NoiseSensitivity, FALSE );
+ SendDlgItemMessage(hWndDlg, IDC_NOISEREDUCTION_SLIDER, TBM_SETPOS, (WPARAM) TRUE,(LPARAM) compConfig->NoiseSensitivity);
+ SendDlgItemMessage(hWndDlg, IDC_NOISEREDUCTION_SLIDER, TBM_SETTICFREQ, (WPARAM) 1,(LPARAM) 1);
+
+ // set auto keyframe
+ CheckDlgButton( hWndDlg, IDC_AUTOKEYFRAME_CHECK, (compConfig->AutoKeyFrameEnabled) ? 1 : 0 );
+
+ // set max frames btw keys
+ SetDlgItemInt( hWndDlg, IDC_MAXFRAMESBTWKEYS, compConfig->ForceKeyFrameEvery, FALSE );
+
+ return (TRUE);
+ }
+ case WM_HSCROLL:
+ {
+ // change edit box to match slider
+ SetDlgItemInt( hWndDlg, IDC_NOISEREDUCTION, SendDlgItemMessage(hWndDlg, IDC_NOISEREDUCTION_SLIDER, TBM_GETPOS, 0,0), FALSE );
+ return (TRUE);
+ }
+
+ case WM_DESTROY: //case WM_CLOSE: /* Close the dialog. */
+
+ // save everything to our structure
+ compConfig->AutoKeyFrameEnabled = SendDlgItemMessage(hWndDlg, IDC_AUTOKEYFRAME_CHECK, BM_GETCHECK, 0, 0);
+ compConfig->EndUsage = (END_USAGE) SendDlgItemMessage(hWndDlg, IDC_ENDUSAGE2, BM_GETCHECK, 0, 0);
+ compConfig->Interlaced = SendDlgItemMessage(hWndDlg, IDC_MATERIAL1, BM_GETCHECK, 0, 0);
+ compConfig->ForceKeyFrameEvery = GetDlgItemInt(hWndDlg, IDC_MAXFRAMESBTWKEYS, NULL, FALSE );
+ compConfig->Mode = (MODE) SendDlgItemMessage(hWndDlg, IDD_MODE, CB_GETCURSEL, 0, 0);
+ compConfig->NoiseSensitivity = GetDlgItemInt(hWndDlg, IDC_NOISEREDUCTION, NULL, FALSE );
+ return (TRUE);
+
+ case WM_COMMAND: /* A control has been activated. */
+ {
+ switch(HIWORD(wParam))
+ {
+ case EN_KILLFOCUS:
+ {
+ // error checking
+ int value = GetDlgItemInt(hWndDlg, LOWORD(wParam), NULL, FALSE );
+
+ switch(LOWORD(wParam))
+ {
+ case IDC_NOISEREDUCTION:
+ {
+ if(value < 0) value = 0;
+ if(value > 6) value = 6;
+
+ SendDlgItemMessage(hWndDlg, IDC_NOISEREDUCTION_SLIDER, TBM_SETPOS, (WPARAM) TRUE, value );
+ SetDlgItemInt( hWndDlg, LOWORD(wParam), value, FALSE );
+ break;
+ }
+ break;
+ case IDC_MAXFRAMESBTWKEYS:
+ {
+ if(value < 0) value = 0;
+ SetDlgItemInt( hWndDlg, LOWORD(wParam), value, FALSE );
+ break;
+ }
+ default:
+ return (FALSE);
+ }
+
+ }
+ }
+ return (FALSE);
+ }
+
+
+ default:
+ return (FALSE);
+
+ } /* End of Main Dialog case statement. */
+
+ return FALSE;
+} /* End of WndProc */
+
+
+
+
+BOOL FAR PASCAL Advanced_ParamsDlgProc( HWND hWndDlg,
+ UINT Message,
+ WPARAM wParam,
+ LPARAM lParam)
+{
+ COMP_CONFIG_VP6 *compConfig = (COMP_CONFIG_VP6 *)GetWindowLong(hWndDlg,GWL_USERDATA);
+ switch(Message)
+ {
+ case WM_INITDIALOG:
+ {
+
+ SetWindowLong(hWndDlg, GWL_USERDATA, (unsigned long)lParam);
+ compConfig = (COMP_CONFIG_VP6 *) lParam;
+
+ if ( compConfig->EndUsage == 1)
+ {
+ EnableWindow(GetDlgItem(hWndDlg, IDC_EDIT_MAXBITRATE), 0);
+ EnableWindow(GetDlgItem(hWndDlg, STREAMING_PARAMETERS), 0);
+ EnableWindow(GetDlgItem(hWndDlg, PEAK_BITRATE), 0);
+ EnableWindow(GetDlgItem(hWndDlg, PREBUFFER), 0);
+ EnableWindow(GetDlgItem(hWndDlg, IDC_EDIT_PREBUFFER), 0);
+ EnableWindow(GetDlgItem(hWndDlg, OPTIMAL_BUFFER), 0);
+ EnableWindow(GetDlgItem(hWndDlg, IDC_EDIT_OPTIMAL), 0);
+ EnableWindow(GetDlgItem(hWndDlg, MAX_BUFFER), 0);
+ EnableWindow(GetDlgItem(hWndDlg, IDC_EDIT_MAXBUFFER), 0);
+ }
+ if(compConfig->Mode < 4)
+ {
+ EnableWindow(GetDlgItem(hWndDlg, TWO_PASS_SECTION_DATARATE), 0);
+ EnableWindow(GetDlgItem(hWndDlg, VARIABILITY), 0);
+ EnableWindow(GetDlgItem(hWndDlg, IDC_DATARATEVARIABILITY), 0);
+ EnableWindow(GetDlgItem(hWndDlg, MIN_SECTION), 0);
+ EnableWindow(GetDlgItem(hWndDlg, IDC_EDIT_MINBANDWIDTH), 0);
+ EnableWindow(GetDlgItem(hWndDlg, MAX_SECTION), 0);
+ EnableWindow(GetDlgItem(hWndDlg, IDC_EDIT_MAXBANDWIDTH), 0);
+ }
+
+ // set buffer stats
+ SetDlgItemInt( hWndDlg, IDC_EDIT_PREBUFFER, compConfig->StartingBufferLevel, FALSE );
+ SetDlgItemInt( hWndDlg, IDC_EDIT_OPTIMAL, compConfig->OptimalBufferLevel, FALSE );
+ SetDlgItemInt( hWndDlg, IDC_EDIT_MAXBUFFER, compConfig->MaximumBufferSize, FALSE );
+
+ // setup vbr slider
+ SendDlgItemMessage(hWndDlg, IDC_DATARATEVARIABILITY_SLIDER, TBM_SETRANGE, (WPARAM) TRUE, (LPARAM) MAKELONG(0, 100));
+ SendDlgItemMessage(hWndDlg, IDC_DATARATEVARIABILITY_SLIDER, TBM_SETTICFREQ, (WPARAM) 10,(LPARAM) 10);
+
+ // set vbr settings
+ SendDlgItemMessage(hWndDlg, IDC_DATARATEVARIABILITY_SLIDER, TBM_SETPOS, (WPARAM) TRUE,(LPARAM) compConfig->TwoPassVBRBias);
+ SetDlgItemInt( hWndDlg, IDC_DATARATEVARIABILITY, compConfig->TwoPassVBRBias, FALSE );
+ SetDlgItemInt( hWndDlg, IDC_EDIT_MINBANDWIDTH, compConfig->TwoPassVBRMinSection, FALSE );
+ SetDlgItemInt( hWndDlg, IDC_EDIT_MAXBANDWIDTH, compConfig->TwoPassVBRMaxSection, FALSE );
+ SetDlgItemInt( hWndDlg, IDC_EDIT_MAXBITRATE, compConfig->MaxAllowedDatarate, FALSE );
+
+
+
+ // datarate control options
+ SetDlgItemInt( hWndDlg, IDC_EDIT_UNDERSHOOT, compConfig->UnderShootPct, FALSE );
+
+ // set adjust quantizer control
+ CheckDlgButton( hWndDlg, IDC_ADJUSTQ_CHECK, (compConfig->FixedQ) ? 0 : 1 );
+ SetDlgItemInt( hWndDlg, IDC_EDIT_MINQUALITY, compConfig->BestAllowedQ, FALSE );
+ SetDlgItemInt( hWndDlg, IDC_EDIT_MAXQUALITY, compConfig->Quality, FALSE );
+
+ // allowing dropped frames
+ CheckDlgButton( hWndDlg, IDC_ALLOW_DROPPED_FRAMES_CHECK, (compConfig->AllowDF) ? 1 : 0 );
+ SetDlgItemInt( hWndDlg, IDC_EDIT_TEMPORAL_DOWN, compConfig->DropFramesWaterMark, FALSE );
+
+ // allowing spatial resampling
+ CheckDlgButton( hWndDlg, IDC_SCALE_CHECK, (compConfig->AllowSpatialResampling) ? 1 : 0 );
+ SetDlgItemInt( hWndDlg, IDC_EDIT_SPATIAL_DOWN, compConfig->ResampleDownWaterMark, FALSE );
+ SetDlgItemInt( hWndDlg, IDC_EDIT_SPATIAL_UP, compConfig->ResampleUpWaterMark, FALSE );
+
+
+ return (TRUE);
+ }
+
+
+ case WM_DESTROY: //case WM_CLOSE: /* Close the dialog. */
+
+ // save everything to our structure
+ compConfig->StartingBufferLevel = GetDlgItemInt(hWndDlg, IDC_EDIT_PREBUFFER, NULL, FALSE );
+ compConfig->OptimalBufferLevel = GetDlgItemInt(hWndDlg, IDC_EDIT_OPTIMAL, NULL, FALSE );
+ compConfig->MaximumBufferSize = GetDlgItemInt(hWndDlg, IDC_EDIT_MAXBUFFER, NULL, FALSE );
+ compConfig->TwoPassVBRBias = GetDlgItemInt(hWndDlg, IDC_DATARATEVARIABILITY, NULL, FALSE );
+ compConfig->TwoPassVBRMinSection = GetDlgItemInt(hWndDlg, IDC_EDIT_MINBANDWIDTH, NULL, FALSE );
+ compConfig->TwoPassVBRMaxSection = GetDlgItemInt(hWndDlg, IDC_EDIT_MAXBANDWIDTH, NULL, FALSE );
+ compConfig->MaxAllowedDatarate = GetDlgItemInt(hWndDlg, IDC_EDIT_MAXBITRATE, NULL, FALSE );
+ compConfig->UnderShootPct = GetDlgItemInt(hWndDlg, IDC_EDIT_UNDERSHOOT, NULL, FALSE );
+ compConfig->FixedQ = !SendDlgItemMessage(hWndDlg, IDC_ADJUSTQ_CHECK, BM_GETCHECK, 0, 0);
+ compConfig->BestAllowedQ = GetDlgItemInt(hWndDlg, IDC_EDIT_MINQUALITY, NULL, FALSE );
+ compConfig->Quality = GetDlgItemInt(hWndDlg, IDC_EDIT_MAXQUALITY, NULL, FALSE );
+ compConfig->AllowDF = SendDlgItemMessage(hWndDlg, IDC_ALLOW_DROPPED_FRAMES_CHECK, BM_GETCHECK, 0, 0);
+ compConfig->DropFramesWaterMark = GetDlgItemInt(hWndDlg, IDC_EDIT_TEMPORAL_DOWN, NULL, FALSE );
+ compConfig->AllowSpatialResampling = SendDlgItemMessage(hWndDlg, IDC_SCALE_CHECK, BM_GETCHECK, 0, 0);
+ compConfig->ResampleDownWaterMark = GetDlgItemInt(hWndDlg, IDC_EDIT_SPATIAL_DOWN, NULL, FALSE );
+ compConfig->ResampleUpWaterMark = GetDlgItemInt(hWndDlg, IDC_EDIT_SPATIAL_UP, NULL, FALSE );
+
+ return (TRUE);
+
+ case WM_HSCROLL:
+ {
+ // change edit box to match slider
+ SetDlgItemInt( hWndDlg, IDC_DATARATEVARIABILITY, SendDlgItemMessage(hWndDlg, IDC_DATARATEVARIABILITY_SLIDER, TBM_GETPOS, 0,0), FALSE );
+ return (TRUE);
+ }
+
+ case WM_COMMAND: /* A control has been activated. */
+ {
+ switch(HIWORD(wParam))
+ {
+ case EN_KILLFOCUS:
+ {
+ // error checking
+ int value = GetDlgItemInt(hWndDlg, LOWORD(wParam), NULL, FALSE );
+
+ switch(LOWORD(wParam))
+ {
+ case IDC_DATARATEVARIABILITY:
+ {
+ if(value < 0) value = 0;
+ if(value > 100 ) value = 100;
+ SendDlgItemMessage(hWndDlg, IDC_DATARATEVARIABILITY_SLIDER, TBM_SETPOS, (WPARAM) TRUE, value );
+ SetDlgItemInt( hWndDlg, LOWORD(wParam), value, FALSE );
+ break;
+ }
+
+ // save everything to our structure
+ case IDC_EDIT_PREBUFFER:
+ {
+ if(value < 0) value = 0;
+ if(value > 30 ) value = 30;
+ SetDlgItemInt( hWndDlg, LOWORD(wParam), value, FALSE );
+ break;
+ }
+ case IDC_EDIT_OPTIMAL:
+ {
+ if(value < 0) value = 0;
+ if(value > 30 ) value = 30;
+ SetDlgItemInt( hWndDlg, LOWORD(wParam), value, FALSE );
+ break;
+ }
+ case IDC_EDIT_MAXBUFFER:
+ {
+ if(value < 0) value = 0;
+ if(value > 30 ) value = 30;
+ SetDlgItemInt( hWndDlg, LOWORD(wParam), value, FALSE );
+ break;
+ }
+
+ case IDC_EDIT_MINBANDWIDTH:
+ {
+ if(value < 0) value = 0;
+ if(value > 100 ) value = 100;
+ SetDlgItemInt( hWndDlg, LOWORD(wParam), value, FALSE );
+ break;
+ }
+ case IDC_EDIT_MAXBANDWIDTH:
+ {
+ if(value < 100) value = 100;
+ if(value > 1000 ) value = 1000;
+ SetDlgItemInt( hWndDlg, LOWORD(wParam), value, FALSE );
+ break;
+ }
+ case IDC_EDIT_UNDERSHOOT:
+ {
+ if(value < 50) value = 50;
+ if(value > 100 ) value = 100;
+ SetDlgItemInt( hWndDlg, LOWORD(wParam), value, FALSE );
+ break;
+ }
+
+ case IDC_EDIT_MINQUALITY:
+ {
+ if(value < 0) value = 0;
+ if(value > 63 ) value = 63;
+ SetDlgItemInt( hWndDlg, LOWORD(wParam), value, FALSE );
+ break;
+ }
+ case IDC_EDIT_MAXQUALITY:
+ {
+ if(value < 0) value = 0;
+ if(value > 63 ) value = 63;
+ SetDlgItemInt( hWndDlg, LOWORD(wParam), value, FALSE );
+ break;
+ }
+
+ case IDC_EDIT_TEMPORAL_DOWN :
+ {
+ if(value < 0) value = 0;
+ if(value > 100 ) value = 100;
+ SetDlgItemInt( hWndDlg, LOWORD(wParam), value, FALSE );
+ break;
+ }
+ case IDC_EDIT_SPATIAL_DOWN :
+ {
+ if(value < 0) value = 0;
+ if(value > 100 ) value = 100;
+
+ SetDlgItemInt( hWndDlg, LOWORD(wParam), value, FALSE );
+ break;
+ }
+ case IDC_EDIT_SPATIAL_UP :
+ {
+ if(value < 0) value = 0;
+ if(value > 100 ) value = 100;
+
+ SetDlgItemInt( hWndDlg, LOWORD(wParam), value, FALSE );
+ break;
+ }
+
+ }
+ }
+ default:
+ return (FALSE);
+ }
+
+ return (FALSE);
+ }
+
+ default:
+ return (FALSE);
+
+ } /* End of Main Dialog case statement. */
+
+ return FALSE;
+} /* End of WndProc */
+
+
+
+BOOL FAR PASCAL Settings_ParamsDlgProc( HWND hWndDlg,
+ UINT Message,
+ WPARAM wParam,
+ LPARAM lParam)
+{
+ COMP_CONFIG_VP6 *compConfig = (COMP_CONFIG_VP6 *)GetWindowLong(hWndDlg,GWL_USERDATA);
+
+ switch(Message)
+ {
+ case WM_INITDIALOG:
+ {
+ SetWindowLong(hWndDlg, GWL_USERDATA, (unsigned long)lParam);
+ compConfig = (COMP_CONFIG_VP6 *) lParam;
+
+ if(!memcmp(compConfig->SettingsFile,compConfig->RootDirectory,strlen(compConfig->RootDirectory)))
+ {
+ strcpy(compConfig->SettingsFile,compConfig->SettingsFile+strlen(compConfig->RootDirectory));
+ }
+ if(!memcmp(compConfig->SettingsFile+strlen(compConfig->SettingsFile)-4,".vps",4))
+ {
+ compConfig->SettingsFile[strlen(compConfig->SettingsFile)-4]=0;
+ }
+ SetDlgItemText(hWndDlg,IDC_FIRSTPASS,compConfig->FirstPassFile);
+ SetDlgItemText(hWndDlg,IDC_SETTINGSFILE,compConfig->SettingsFile);
+
+ WIN32_FIND_DATA wfd;
+
+ char FileFilter[512];
+ strncpy(FileFilter,compConfig->RootDirectory,512);
+ strcat(FileFilter,"\\*.vps");
+ HANDLE ffh = FindFirstFile(FileFilter,&wfd);
+ if( ffh !=INVALID_HANDLE_VALUE)
+ {
+ do
+ {
+ wfd.cFileName[strlen(wfd.cFileName)-4]=0;
+ SendDlgItemMessage(hWndDlg, IDC_SETTINGS_LIST, LB_ADDSTRING, 0, (LPARAM) (LPCSTR) wfd.cFileName);
+ }
+ while ( FindNextFile(ffh,&wfd));
+ FindClose(ffh);
+ }
+
+
+ return (TRUE);
+ }
+
+ case WM_DESTROY: //case WM_CLOSE: /* Close the dialog. */
+
+ // save everything to our structure
+ GetDlgItemText(hWndDlg,IDC_FIRSTPASS,compConfig->FirstPassFile,512);
+ GetDlgItemText(hWndDlg,IDC_SETTINGSFILE,compConfig->SettingsFile,512);
+ if(compConfig->SettingsFile[1] != ':' && compConfig->SettingsFile[1] != '\\')
+ {
+ char tmp[512];
+ strncpy(tmp,compConfig->SettingsFile,512);
+ strncpy(compConfig->SettingsFile,compConfig->RootDirectory,512);
+ strcat(compConfig->SettingsFile,tmp);
+ }
+ if(compConfig->SettingsFile[strlen(compConfig->SettingsFile)-4] != '.' )
+ {
+ strcat(compConfig->SettingsFile,".vps");
+ }
+
+ return (TRUE);
+
+ case WM_COMMAND: /* A control has been activated. */
+ {
+ switch(HIWORD(wParam))
+ {
+ case LBN_SELCHANGE :
+ {
+ int curSel =SendDlgItemMessage(hWndDlg, IDC_SETTINGS_LIST, LB_GETCURSEL, 0, 0);
+ SendDlgItemMessage(hWndDlg, IDC_SETTINGS_LIST, LB_GETTEXT, curSel, (DWORD) compConfig->SettingsFile);
+ SetDlgItemText(hWndDlg,IDC_SETTINGSFILE,compConfig->SettingsFile);
+ if(compConfig->SettingsFile[1] != ':' && compConfig->SettingsFile[1] != '\\')
+ {
+ char tmp[512];
+ strncpy(tmp,compConfig->SettingsFile,512);
+ strncpy(compConfig->SettingsFile,compConfig->RootDirectory,512);
+ strcat(compConfig->SettingsFile,"\\");
+ strcat(compConfig->SettingsFile,tmp);
+ }
+ if(compConfig->SettingsFile[strlen(compConfig->SettingsFile)-4] != '.' )
+ {
+ strcat(compConfig->SettingsFile,".vps");
+ }
+ FILE *f = fopen(compConfig->SettingsFile,"rb");
+ if(f)
+ {
+ char tmp[512];
+ HWND still = (HWND) compConfig->PlaceHolder;
+ strncpy(tmp,compConfig->RootDirectory,512);
+ fread(compConfig,sizeof COMP_CONFIG_VP6,1,f);
+ strncpy(compConfig->RootDirectory,tmp,512);
+ fclose(f);
+ compConfig->PlaceHolder = (INT32) still;
+ }
+ }
+
+ case BN_CLICKED:
+ switch(LOWORD(wParam))
+ {
+ case ID_SAVE:
+ {
+ FILE *f;
+
+ GetDlgItemText(hWndDlg,IDC_SETTINGSFILE,compConfig->SettingsFile,512);
+ GetDlgItemText(hWndDlg,IDC_FIRSTPASS,compConfig->FirstPassFile,512);
+
+ if(compConfig->SettingsFile[1] != ':' && compConfig->SettingsFile[1] != '\\')
+ {
+ char tmp[512];
+ strncpy(tmp,compConfig->SettingsFile,512);
+ strncpy(compConfig->SettingsFile,compConfig->RootDirectory,512);
+ strcat(compConfig->SettingsFile,"\\");
+ strcat(compConfig->SettingsFile,tmp);
+ }
+ if(compConfig->SettingsFile[strlen(compConfig->SettingsFile)-4] != '.' )
+ {
+ strcat(compConfig->SettingsFile,".vps");
+ }
+
+ f=fopen(compConfig->SettingsFile,"wb");
+ if(f)
+ {
+ fwrite(compConfig,10+sizeof COMP_CONFIG_VP6,1,f);
+ fclose(f);
+ }
+ int curSel = SendDlgItemMessage(hWndDlg, IDC_SETTINGS_LIST, LB_FINDSTRING, 0, (LPARAM) (LPCSTR) compConfig->SettingsFile );
+ if( curSel == LB_ERR)
+ {
+ WIN32_FIND_DATA wfd;
+
+ int curSel = SendDlgItemMessage(hWndDlg, IDC_SETTINGS_LIST, LB_RESETCONTENT, 0, 0 );
+ char FileFilter[512];
+ strncpy(FileFilter,compConfig->RootDirectory,512);
+ strcat(FileFilter,"\\*.vps");
+ HANDLE ffh = FindFirstFile(FileFilter,&wfd);
+ if( ffh !=INVALID_HANDLE_VALUE)
+ {
+ do
+ {
+ wfd.cFileName[strlen(wfd.cFileName)-4]=0;
+ SendDlgItemMessage(hWndDlg, IDC_SETTINGS_LIST, LB_ADDSTRING, 0, (LPARAM) (LPCSTR) wfd.cFileName);
+ }
+ while ( FindNextFile(ffh,&wfd));
+ FindClose(ffh);
+ }
+ }
+
+
+ return TRUE;
+ };
+ case ID_DELETE:
+ {
+ int curSel =SendDlgItemMessage(hWndDlg, IDC_SETTINGS_LIST, LB_GETCURSEL, 0, 0);
+ SendDlgItemMessage(hWndDlg, IDC_SETTINGS_LIST, LB_DELETESTRING, curSel, 0);
+
+
+ DeleteFile(compConfig->SettingsFile);
+
+ return TRUE;
+ };
+ case IDC_LOAD_FIRSTPASS:
+ {
+ static TCHAR szFilterLoad[] = TEXT("VP First Pass \0*.vpf\0\0");
+ OPENFILENAME ofn;
+ TCHAR szTitle[64];
+ TCHAR szT[256];
+ ofn.lStructSize= sizeof(ofn);
+ ofn.hInstance= 0;
+ ofn.lpstrFilter= szFilterLoad;
+ ofn.lpstrCustomFilter= NULL;
+ ofn.nMaxCustFilter= 0;
+ ofn.nFilterIndex= 0;
+ ofn.lpstrFileTitle= szTitle;
+ ofn.nMaxFileTitle= sizeof(szTitle);
+ ofn.lpstrInitialDir= compConfig->RootDirectory;
+ ofn.lpstrTitle= NULL;
+ ofn.nFileOffset= 0;
+ ofn.nFileExtension= 0;
+ ofn.lpstrDefExt= "vps";
+ ofn.lCustData= 0L;
+ ofn.lpfnHook= NULL;
+ ofn.lpTemplateName= NULL;
+ ofn.hwndOwner= hWndDlg;
+ ofn.lpstrFile= szT;
+ ofn.nMaxFile= sizeof(szT);
+ ofn.Flags= 0;
+ szTitle[0] = TEXT('\0');
+ szT[0] = TEXT('\0');
+ if(GetOpenFileName(&ofn))
+ {
+ strncpy(compConfig->FirstPassFile,ofn.lpstrFile,512);
+ SetDlgItemText(hWndDlg,IDC_FIRSTPASS,compConfig->FirstPassFile);
+ }
+
+
+ return TRUE;
+ }
+ case IDC_LOAD_SETTINGS:
+ {
+ static TCHAR szFilterLoad[] = TEXT("VP Setting Files\0*.vps\0\0");
+ OPENFILENAME ofn;
+ TCHAR szTitle[64];
+ TCHAR szT[256];
+ ofn.lStructSize= sizeof(ofn);
+ ofn.hInstance= 0;
+ ofn.lpstrFilter= szFilterLoad;
+ ofn.lpstrCustomFilter= NULL;
+ ofn.nMaxCustFilter= 0;
+ ofn.nFilterIndex= 0;
+ ofn.lpstrFileTitle= szTitle;
+ ofn.nMaxFileTitle= sizeof(szTitle);
+ ofn.lpstrInitialDir= compConfig->RootDirectory;
+ ofn.lpstrTitle= NULL;
+ ofn.nFileOffset= 0;
+ ofn.nFileExtension= 0;
+ ofn.lpstrDefExt= "vps";
+ ofn.lCustData= 0L;
+ ofn.lpfnHook= NULL;
+ ofn.lpTemplateName= NULL;
+ ofn.hwndOwner= hWndDlg;
+ ofn.lpstrFile= szT;
+ ofn.nMaxFile= sizeof(szT);
+ ofn.Flags= 0;
+ szTitle[0] = TEXT('\0');
+ szT[0] = TEXT('\0');
+ if(GetOpenFileName(&ofn))
+ {
+
+ strncpy(compConfig->SettingsFile,ofn.lpstrFile,512);
+
+ FILE *f = fopen(compConfig->SettingsFile,"rb");
+ if(f)
+ {
+ HWND still = (HWND) compConfig->PlaceHolder;
+ fread(compConfig,sizeof COMP_CONFIG_VP6,1,f);
+ fclose(f);
+ compConfig->PlaceHolder = (INT32) still;
+ }
+ if(!memcmp(compConfig->SettingsFile,compConfig->RootDirectory,strlen(compConfig->RootDirectory)))
+ {
+ strcpy(compConfig->SettingsFile,compConfig->SettingsFile+strlen(compConfig->RootDirectory));
+ }
+ if(!memcmp(compConfig->SettingsFile+strlen(compConfig->SettingsFile)-4,".vps",4))
+ {
+ compConfig->SettingsFile[strlen(compConfig->SettingsFile)-4]=0;
+ }
+ SetDlgItemText(hWndDlg,IDC_SETTINGSFILE,compConfig->SettingsFile);
+ }
+
+
+ return TRUE;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ }
+
+
+ default:
+ return (FALSE);
+
+ } /* End of Main Dialog case statement. */
+
+ return FALSE;
+} /* End of WndProc */
diff --git a/Src/libvp6/corelibs/include/WCompC.h b/Src/libvp6/corelibs/include/WCompC.h
new file mode 100644
index 00000000..dee8f788
--- /dev/null
+++ b/Src/libvp6/corelibs/include/WCompC.h
@@ -0,0 +1,86 @@
+/****************************************************************************
+
+ Entry for "C" calls
+
+****************************************************************************/
+#ifndef WCOMPC_H
+#define WCOMPC_H
+
+
+#ifndef YUVINPUTBUFFERCONFIG
+#define YUVINPUTBUFFERCONFIG
+typedef struct
+{
+ int YWidth;
+ int YHeight;
+ int YStride;
+
+ int UVWidth;
+ int UVHeight;
+ int UVStride;
+
+ char * YBuffer;
+ char * UBuffer;
+ char * VBuffer;
+
+} YUV_INPUT_BUFFER_CONFIG;
+#endif
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ void NewWC(void **wc);
+
+ void DeleteWC(void **wc);
+
+ int BeginCompressWC(
+ void *wc,
+ int ScreenWidth,
+ int ScreenHeight,
+ int Width,
+ int Height,
+ int XOffset,
+ int YOffset);
+
+
+ int CompressYUVWC(void *wc,
+ YUV_INPUT_BUFFER_CONFIG *YuvInputData,
+ unsigned char *OutputBufferPtr,
+ unsigned char *ReconBufferPtr,
+ int TargetSize);
+
+ int CompressWC(void *wc,
+ unsigned char *InputData,
+ unsigned char *OutputBufferPtr,
+ unsigned char *ReconBufferPtr,
+ int TargetSize);
+
+ int AnalyzeWC(void *wc,
+ unsigned char *InputData);
+
+
+ void EndCompressWC(void *wc);
+
+
+ int BeginDecompressWC(void *wc,
+ int ScreenWidth,
+ int ScreenHeight,
+ int Width,
+ int Height,
+ int XOffset,
+ int YOffset);
+
+ int DecompressWC(void *wc,
+ unsigned char *InputBufferPtr,
+ unsigned char *OutputBufferPtr);
+
+
+ void EndDecompressWC(void *wc);
+#ifdef __cplusplus
+
+ }
+#endif
+
+#endif \ No newline at end of file
diff --git a/Src/libvp6/corelibs/include/asmcolorconversions.h b/Src/libvp6/corelibs/include/asmcolorconversions.h
new file mode 100644
index 00000000..8f28e23e
--- /dev/null
+++ b/Src/libvp6/corelibs/include/asmcolorconversions.h
@@ -0,0 +1,47 @@
+//==========================================================================
+//
+// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
+// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
+// PURPOSE.
+//
+// Copyright (c) 1999 - 2001 On2 Technologies Inc. All Rights Reserved.
+//
+//--------------------------------------------------------------------------
+
+
+#ifndef ASMCOLORCONVERSIONS_H
+#define ASMCOLORCONVERSIONS_H
+
+void CC_RGB32toYV12_MMX( unsigned char *RGBABuffer, int ImageWidth, int ImageHeight,
+ unsigned char *YBuffer, unsigned char *UBuffer, unsigned char *VBuffer, int SrcPitch,int DstPitch );
+
+void CC_RGB32toYV12_XMM( unsigned char *RGBABuffer, int ImageWidth, int ImageHeight,
+ unsigned char *YBuffer, unsigned char *UBuffer, unsigned char *VBuffer, int SrcPitch,int DstPitch );
+
+void CC_RGB24toYV12_MMX( unsigned char *RGBBuffer, int ImageWidth, int ImageHeight,
+ unsigned char *YBuffer, unsigned char *UBuffer, unsigned char *VBuffer, int SrcPitch,int DstPitch );
+
+void CC_RGB24toYV12_XMM( unsigned char *RGBBuffer, int ImageWidth, int ImageHeight,
+ unsigned char *YBuffer, unsigned char *UBuffer, unsigned char *VBuffer, int SrcPitch,int DstPitch );
+
+void CC_UYVYtoYV12_MMX( unsigned char *UYVYBuffer, int ImageWidth, int ImageHeight,
+ unsigned char *YBuffer, unsigned char *UBuffer, unsigned char *VBuffer, int SrcPitch, int DstPitch );
+
+void CC_UYVYtoYV12_XMM( unsigned char *UYVYBuffer, int ImageWidth, int ImageHeight,
+ unsigned char *YBuffer, unsigned char *UBuffer, unsigned char *VBuffer, int SrcPitch, int DstPitch );
+
+void CC_YUY2toYV12_MMX( unsigned char *YUY2Buffer, int ImageWidth, int ImageHeight,
+ unsigned char *YBuffer, unsigned char *UBuffer, unsigned char *VBuffer, int SrcPitch, int DstPitch );
+
+void CC_YUY2toYV12_XMM( unsigned char *YUY2Buffer, int ImageWidth, int ImageHeight,
+ unsigned char *YBuffer, unsigned char *UBuffer, unsigned char *VBuffer, int SrcPitch, int DstPitch );
+
+void CC_YVYUtoYV12_MMX( unsigned char *YVYUBuffer, int ImageWidth, int ImageHeight,
+ unsigned char *YBuffer, unsigned char *UBuffer, unsigned char *VBuffer, int SrcPitch,int DstPitch );
+
+void CC_YVYUtoYV12_XMM( unsigned char *YVYUBuffer, int ImageWidth, int ImageHeight,
+ unsigned char *YBuffer, unsigned char *UBuffer, unsigned char *VBuffer, int SrcPitch,int DstPitch );
+
+
+#endif /* ASMCOLORCONVERSIONS_H */
diff --git a/Src/libvp6/corelibs/include/bigend.h b/Src/libvp6/corelibs/include/bigend.h
new file mode 100644
index 00000000..158fb466
--- /dev/null
+++ b/Src/libvp6/corelibs/include/bigend.h
@@ -0,0 +1,21 @@
+#ifndef _bigend_h
+#define _bigend_h
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+#define invert2(x) ( (((x)>>8)&0x00ff) | (((x)<<8)&0xff00) )
+#define invert4(x) ( ((invert2(x)&0x0000ffff)<<16) | (invert2((x>>16))&0x0000ffff) )
+
+#define highByte(x) (unsigned char)x
+#define mid2Byte(x) (unsigned char)(x >> 8)
+#define mid1Byte(x) (unsigned char)(x >> 16)
+#define lowByte(x) (unsigned char)(x >> 24)
+
+#define SWAPENDS 1
+
+#if defined(__cplusplus)
+}
+#endif
+#endif
diff --git a/Src/libvp6/corelibs/include/cidasm.h b/Src/libvp6/corelibs/include/cidasm.h
new file mode 100644
index 00000000..3eaa6fc8
--- /dev/null
+++ b/Src/libvp6/corelibs/include/cidasm.h
@@ -0,0 +1,20 @@
+//==========================================================================
+//
+// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
+// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
+// PURPOSE.
+//
+// Copyright (c) 1999 - 2001 On2 Technologies Inc. All Rights Reserved.
+//
+//--------------------------------------------------------------------------
+
+
+#ifndef _CIDASM_H
+#define _CIDASM_H
+
+extern PROCTYPE getCPUType(void);
+extern void InitXMMReg( void );
+extern void TrashXMMReg( void *Junk );
+extern int VerifyXMMReg( void );
+#endif /* _CIDASM_H */
diff --git a/Src/libvp6/corelibs/include/colorconversions.h b/Src/libvp6/corelibs/include/colorconversions.h
new file mode 100644
index 00000000..367549c0
--- /dev/null
+++ b/Src/libvp6/corelibs/include/colorconversions.h
@@ -0,0 +1,37 @@
+//==========================================================================
+//
+// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
+// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
+// PURPOSE.
+//
+// Copyright (c) 1999 - 2001 On2 Technologies Inc. All Rights Reserved.
+//
+//--------------------------------------------------------------------------
+
+
+#ifndef COLORCONVERSIONS_H
+#define COLORCONVERSIONS_H
+
+#define ScaleFactor 0x8000
+#define ShiftFactor 15
+
+#define PixelsPerBlock 4
+#define PixelsPerBlockShift 2
+
+void CC_RGB32toYV12_C( unsigned char *RGBABuffer, int ImageWidth, int ImageHeight,
+ unsigned char *YBuffer, unsigned char *UBuffer, unsigned char *VBuffer, int SrcPitch,int DstPitch );
+
+void CC_RGB24toYV12_C( unsigned char *RGBBuffer, int ImageWidth, int ImageHeight,
+ unsigned char *YBuffer, unsigned char *UBuffer, unsigned char *VBuffer, int SrcPitch,int DstPitch );
+
+void CC_UYVYtoYV12_C( unsigned char *UYVYBuffer, int ImageWidth, int ImageHeight,
+ unsigned char *YBuffer, unsigned char *UBuffer, unsigned char *VBuffer, int SrcPitch, int DstPitch );
+
+void CC_YUY2toYV12_C( unsigned char *YUY2Buffer, int ImageWidth, int ImageHeight,
+ unsigned char *YBuffer, unsigned char *UBuffer, unsigned char *VBuffer, int SrcPitch, int DstPitch );
+
+void CC_YVYUtoYV12_C( unsigned char *YVYUBuffer, int ImageWidth, int ImageHeight,
+ unsigned char *YBuffer, unsigned char *UBuffer, unsigned char *VBuffer, int SrcPitch,int DstPitch );
+
+#endif /* COLORCONVERSIONS_H */
diff --git a/Src/libvp6/corelibs/include/dkpltfrm.h b/Src/libvp6/corelibs/include/dkpltfrm.h
new file mode 100644
index 00000000..40bda1ab
--- /dev/null
+++ b/Src/libvp6/corelibs/include/dkpltfrm.h
@@ -0,0 +1,73 @@
+//==========================================================================
+//
+// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
+// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
+// PURPOSE.
+//
+// Copyright (c) 1999 - 2001 On2 Technologies Inc. All Rights Reserved.
+//
+//--------------------------------------------------------------------------
+
+#ifndef _dkpltfrm_h
+#define _dkpltfrm_h
+/********************************************************
+
+ PC for Win95/DOS/etc...
+
+********************************************************/
+
+/*
+#define DX_COUNTERS 0
+*/
+
+
+/* #define VOXWARE_WIN32 1 */
+
+
+#define SUPPORT565 1
+#define DX_TR20 1
+#define TINKER 1
+#define LARGECHUNKS 1
+
+#define RGBORDER 0
+#define BGRORDER 1
+
+
+#define DKTRUE 1
+#define DKFALSE !DKTRUE
+
+#define TBLOFFSET 0
+#define CENTER_TABLE 0
+
+#define BLACK16X2 0x00000000
+
+//#include "nofar.h"
+#include "littlend.h"
+
+#define LIMITREADS /* limit reads average frame size */
+#define LIMIT_1_5 /* limit reads to 1.5x the average frame size */
+#define DISPLAYDIB 0
+
+#define AUDIOINTERLEAVED 1
+typedef int GfsHn;
+#define slow_seek duck_seek
+#define gooseCD(x,y)
+
+#define COLORORDER RGBORDER
+
+#define SWAPENDS 0
+
+#define HW_CD_BUFFER 0
+#define CD_ONLY 0
+
+#define DX24BIT
+
+
+#if !defined(UINT64)
+typedef unsigned __int64 UINT64;
+#endif
+
+
+
+#endif /* include guards */
diff --git a/Src/libvp6/corelibs/include/duck_hfb.h b/Src/libvp6/corelibs/include/duck_hfb.h
new file mode 100644
index 00000000..04407bd1
--- /dev/null
+++ b/Src/libvp6/corelibs/include/duck_hfb.h
@@ -0,0 +1,871 @@
+#ifndef _duck_hfb_h
+#define _duck_hfb_h
+
+
+/******************************************************************************\
+<table BGCOLOR=#FFC0C0 border=1 WIDTH=100% ><tr><td><b>
+ duck_hfb.h </b></td><td><b> TrueMotion include file for buffering/streaming libraries </b>
+
+</td></tr><tr><td>&nbsp</td><td> Version: 6.0.0
+</td></tr><tr><td>&nbsp</td><td> Updated: $Date: 2010/07/23 19:10:44 $
+</td></tr><tr><td>&nbsp</td><td> Copyright (c) 1994-98, The Duck Corp. All rights reserved.
+</td></tr>
+</table>
+******************************************************************************/
+
+
+
+#define lHFB_ HFB_
+#define libFunc
+
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+#include "duck_bmp.h"
+#include "duck_wav.h"
+#include <string.h> /* for size_t */
+
+typedef enum dukDirect { /* direction to move within stream */
+ DUK_BACKWARD=-1, /* move backward from current position */
+ DUK_ABSOLUTE=0, /* move to an absolute position */
+ DUK_FORWARD=1, /* move forward from current position */
+ DUK_RESET=2 /* reset stream according to file position */
+} hfbDirection;
+
+typedef enum HFB_FileType { /* type of file opened */
+ DUK_NULFILE = 0, /* not a TrueMotion "S" A/V file */
+ DUK_DUKFILE = 1, /* TrueMotion "S" duk file */
+ DUK_AVIFILE = -1, /* TrueMotion "S" Video for Windows AVI compatible file */
+ DUK_QTFILE = 3 /* TrueMotion "S" Quicktime MOV compatible file */
+} hfbFileType;
+
+typedef enum HFB_StreamType {/* stream types */
+ DUK_UNDEFINED = 0, /* indeterminate or uninitialized stream */
+ DUK_AUDSTREAM = 1, /* audio stream */
+ DUK_VIDSTREAM = 2, /* video stream */
+ DUK_TXTSTREAM = 3 /* text stream */
+} hfbStreamType;
+
+typedef enum HFB_Modes { /* HFB buffering modes */
+ HFBMODE_NORMAL = 0, /* normal play once mode */
+ HFBMODE_FORWARDLOOP = 1, /* forward looping mode (loop back to start) */
+ HFBMODE_REVERSE = 2, /* reverse play once mode (not yet implemented)*/
+ HFBMODE_REVERSELOOP = 4, /* reverse looping mode (not yet implemented)*/
+ HFBMODE_QUEUE = 8, /* file queue mode (not yet implemented)*/
+ HFBMODE_FLYINDEX = 16, /* HFB does not have to read the AVI index to play the movie */ /* FWG 6-23-99 */
+ HFBMODE_ASYNC = 32, /* HFB is in asnyc mode. Needed for first read and index stuff */ /* FWG 7-7-99 */
+ HFBMODE_ASYNC_FLYINDEX = 64, /* Asnyc & Fly-Index mode. */ /* FWG 7-7-99 */
+ HFBMODE_PSEUDO_ASYNC = 128 /* */
+} hfbBufferMode;
+
+typedef enum BUFFERSTATUS {
+ HFB_BUSY = 0,
+ HFB_COMPLETE
+} hfbBufferStatus;
+
+typedef enum PRELOADSPEC {
+ HFB_FULL = -2,
+ HFB_THREEQUARTERS = -1,
+ HFB_NONE = 0
+} hfbPreloadSpec;
+
+#define HFB_USE_DEFAULT 0L
+#define HFB_RESET_COUNT -1L
+#define HFB_IGNORE_COUNT -2L
+
+#define HFB_DATA_READ 0x01
+#define HFB_DATA_RELEASED 0x02
+#define HFB_DATA_KEYFRAME 0x08
+
+
+typedef struct tHFB_STREAM_INFO{
+ hfbStreamType streamType;
+ int streamNum;
+ int lSampleRate;
+ int lStart;
+ int lLength;
+ char szName[24];
+ union {
+ DKWAVEFORM WaveformInfo;
+ DKBITMAP BitmapInfo;
+ DKBITMAP_old depricatedBitmapInfo; /* please don't use this */
+ } a;
+ DK_BITMAPINFOHEADER bmih; /* should be part of union or replace DKBITMAP ... but due to healthy paranoia add here ... */
+} HFB_STREAM_INFO, MFP_STREAM_INFO;
+
+typedef struct tHFB_FILE_INFO{
+ int lFileSize;
+ int lNumStreams;
+ char sName[96];
+ int lNumFrames;
+} HFB_FILE_INFO, MFP_FILE_INFO;
+
+typedef struct tHFBFile *HFB_FILE_HANDLE;
+typedef struct tHFBStream *HFB_STREAM_HANDLE;
+typedef struct tHFBBuffer *HFB_BUFFER_HANDLE;
+
+typedef int HFB_DATA_HANDLE;
+
+#define DCK_DEFAULT_READSIZE 0
+#define DCK_DEFAULT_BUFFSIZE 0
+
+/* main HFB initialization and exit routines */
+
+/*@
+@Name HFB_Init
+@Description Allocate and initialize required data structures.If all three parameters are -1,
+HFB will dynamically allocate objects as needed.
+@Return value 0 if success or negative return code.
+@*/
+libFunc int HFB_Init(
+ int maxOpenFiles, /* maximum of concurently open file objects. */
+ int maxOpenStreams, /* maximum of concurently open streams. */
+ int maxOpenBuffers /* maximum of concurently open buffer objects. */
+);
+
+
+
+/*@
+@Name HFB_Exit
+@Description free any allocated strcutures, close all files, etc.
+@Return value none.
+@*/
+libFunc void HFB_Exit(void);
+
+
+
+
+/*@
+@Name HFB_SeekToIndex
+@Description Seek to the index in the AVI file
+@Return Value returns 0 on success.
+@*/
+libFunc int HFB_SeekToIndex(HFB_FILE_HANDLE FileHandle);
+
+
+/*@
+@!Name HFB_BeginLoadIndex
+@Description
+@Return value
+@*/
+libFunc int HFB_BeginLoadIndex(
+ HFB_BUFFER_HANDLE dckPtr, /* */
+ int size /* */
+);
+
+
+/*@
+@!Name HFB_FinishLoadIndex
+@Description
+@Return value
+@*/
+libFunc int HFB_FinishLoadIndex(
+ HFB_BUFFER_HANDLE dckPtr, /* */
+ void *data, /* */
+ int size /* */
+);
+
+
+
+
+
+
+/*@
+@!Name HFB_ParseBigIndex
+@Description
+@Return value
+@*/
+libFunc int HFB_ParseBigIndex(
+ HFB_BUFFER_HANDLE dckPtr,
+ void *data,
+ int size
+);
+
+
+
+/*@
+@Name HFB_OpenFile
+@Description open specified file, parse its header(s) and load the index
+@Return value handle to HFB file object.
+@*/
+libFunc HFB_FILE_HANDLE HFB_OpenFile(
+ const char *fileName, /* file to be opened. */
+ HFB_BUFFER_HANDLE bufferHandle, /* handle to a pre-existing HFB buffer. */
+ unsigned int userData /* user data. */
+ );
+
+
+
+/* the following three functions, findfile, parsefile and loadindex,
+ are encapsulated by openfile, they are provided as a convenience
+ for use on systems with asynchronous i/o */
+
+#if 0 // Changed to a static funtion MEW 11-6-03
+/*@
+@Name HFB_FindFile
+@Description This function implements a portion of the functionality performed by HFB_OpenFile.
+@Return value Handle to a HFB file object.
+@*/
+libFunc HFB_FILE_HANDLE HFB_FindFile(
+ const char *fileName, /* name of file to open */
+ unsigned int userData /* user data */
+ );
+#endif
+
+
+/*@
+@Name HFB_ParseFile
+@Description After a file has been found, and at least a single sector is buffered, it's header can be
+parsedfor the information necessary to describe what the file contains. The combination of loading functions must
+appear in this order HFB_FindFile, HFB_ParseFile, HFBLoadIndex.
+@Return value none.
+@*/
+libFunc int HFB_ParseFile(
+ HFB_FILE_HANDLE fileHandle, /* handle to an HFB file object. */
+ HFB_BUFFER_HANDLE bufferHandle /* handle to an HFB buffer object. */
+ );
+
+
+
+/*@
+@Name HFB_LoadIndex
+@Description Load a TrueMotion file's index into the specified buffer object.
+Must be used in this order ... HFB_FindFile, HFB_ParseFile, HFB_LoadIndex.
+@Return value 0 if successful, -1 if error
+@*/
+libFunc int HFB_LoadIndex(
+ HFB_FILE_HANDLE fileHandle, /* handle to HFB file object. */
+ HFB_BUFFER_HANDLE bufferHandle /* handle to HFFB buffer object. */
+ );
+
+
+/*@
+@Name HFB_CloseFile
+@Description Close a TrueMotion file (AVI) and release file structures.
+@Return value None.
+@*/
+libFunc void HFB_CloseFile(
+ HFB_FILE_HANDLE fHnd /* handle to an HFB file object. */
+);
+
+
+
+/*@
+@Name HFB_GetFileInfo
+@Description Used to read information about an opened TrueMotion File (AVI).
+@Return value a pointer to an HFB_FILE_INFO structure describing the indicated file.
+@*/
+libFunc HFB_FILE_INFO *HFB_GetFileInfo(
+ HFB_FILE_HANDLE fileHandle /* handle to an HFB file object. */
+);
+
+
+
+/*@
+@Name HFB_CreateBuffer
+@Description Create High-speed File Buffer.
+@Return value Handle to an HFB Buffer object, or null if no buffer objects available.
+@*/
+libFunc HFB_BUFFER_HANDLE HFB_CreateBuffer(
+ int sizeOfBuffer, /* size in bytes of buffer to allocate. */
+ int reserved /* reserved - must bbe zero. */
+);
+
+
+
+/*@
+@Name HFB_InitBuffer
+@Description After creating a buffer and opening a file, an application mst initialize the buffer with data.
+@Return value Zero if successful, non-zero if not successful.
+@*/
+libFunc int HFB_InitBuffer(
+ HFB_BUFFER_HANDLE bufferHandle, /* handle to HFB buffer object. */
+ HFB_FILE_HANDLE fileToLoad, /* handle to HFB file object */
+ int startFrame, /* frame at which to being playback , normally 0. */
+ int initialReadSize /* amount of buffer to preload with data (specified in bytes). -1 means 3/4 buffer. -2 fill entire buffer */
+);
+
+
+
+/*@
+@Name HFB_FillBuffer
+@Description read additional data from a file into space invalidated by HFB_ReleaseStreamingData calls
+or any empty buffer space available. For best results call this function once per frame with the elapsedFrames set to DUCK_IGNORE_COUNT.
+The function will use the elapsedFrame parameter in conjunction with internal computed values to determine the amount to read from the file
+in order to avoid waiting for data to become availabble.
+@Return value Number of bytes actually read from the disk file into the buffer or a negative error code.
+@*/
+libFunc int HFB_FillBuffer(
+ HFB_BUFFER_HANDLE bufferHandle, /* handle to a buffer objects */
+ int maxToRead, /* maximum number of bytes to read during this call */
+ int elapsedFrames /* number of frames elapsed since start of play */
+ );
+
+
+/*@
+@Name HFB_DestroyBuffer
+@Description Free memory used by buffer and release buffer object.
+@Return value none.
+@*/
+libFunc void HFB_DestroyBuffer(
+ HFB_BUFFER_HANDLE bufferHandle /* handle to an HFB buffer object */
+);
+
+
+/*@
+@!Name HFB_ResetStreams
+@Description
+@Return value
+@*/
+libFunc void HFB_ResetStreams(
+ HFB_BUFFER_HANDLE bufferHandle /* */
+);
+
+
+
+/*@
+@Name HFB_SetBufferMode
+@Description Sets the mode for the specified bufffer. Buffer mode defaults to HFBMODE_NORMAL unless this function is called.
+@Return value
+@*/
+libFunc int HFB_SetBufferMode(
+ HFB_BUFFER_HANDLE buffer, /* handle to HFB buffer object. */
+ hfbBufferMode mode /* mode. */
+ );
+
+
+/*@
+@!Name HFB_GetBufferPerCentFull
+@Description
+@Return value
+@*/
+libFunc int HFB_GetBufferPerCentFull(
+ HFB_BUFFER_HANDLE buffer /* */
+);
+
+
+
+/*@
+@!Name HFB_GetmovieSize
+@Description
+@Return value
+@*/
+libFunc int HFB_GetmovieSize(
+ HFB_BUFFER_HANDLE buffer /* */
+);
+
+
+
+/*@
+@!Name HFB_GetBufferSpace
+@Description
+@Return value
+@*/
+libFunc int HFB_GetBufferSpace(
+ HFB_BUFFER_HANDLE buffer /* */
+);
+
+
+
+/*@
+@Name HFB_GetBufferStatus
+@Description Use this to detemine if a buffer has reached an end of file.
+@Return value 0 - buffer OK. 1 - Buffer reached end of file.
+@*/
+libFunc hfbBufferStatus HFB_GetBufferStatus(
+ HFB_BUFFER_HANDLE buffer /* handle to an HFB buffer object. */
+);
+
+
+
+/*@
+@!Name HFB_ConditionBuffer
+@Description
+@Return value
+@*/
+libFunc int HFB_ConditionBuffer(
+ HFB_BUFFER_HANDLE bufferHandle, /* */
+ int bufferSize, /* */
+ int reserved /* */
+);
+
+
+#define HFB_ResetBuffer HFB_ConditionBuffer
+
+
+/*@
+@Name HFB_GetStream
+@Description get a stream reference handle by name, number, or type.
+@Return value handle to a stream object.
+@*/
+libFunc HFB_STREAM_HANDLE HFB_GetStream(
+ HFB_FILE_HANDLE fileHandle, /* handle to HFB file object. */
+ const char *StreamNameOrNull, /* C string containing the name of a stream within the specified file. Null to ignore. */
+ int streamNumber, /* an absolute stream number or the nth occuring stream of the specified file. */
+ unsigned int streamType /* the type of stream to be opened. */
+);
+
+
+
+/*@
+@Name HFB_ReleaseStream
+@Description relinquish reference to stream object so it may return to the pool.
+@Return value none.
+@*/
+libFunc void HFB_ReleaseStream(
+ HFB_STREAM_HANDLE streamHandle /* handle to an HFB stream object. */
+);
+
+
+
+/*@
+@Name HFB_GetStreamInfo
+@Description get a pointer to stream info struct
+@Return value pointer to a struct containing the stream info.
+@*/
+libFunc HFB_STREAM_INFO* HFB_GetStreamInfo(
+ HFB_STREAM_HANDLE streamHandle /* handle to an HFB stream object */
+);
+
+
+
+
+#define HFB_GetStreamLength(strmh) HFB_GetStreamInfo(strmh)->lLength
+
+#define HFB_GetStreamName(strmh) HFB_GetStreamInfo(strmh)->szName
+
+
+/*@
+@Name HFB_GetStreamingData
+@Description Get pointer to buffered record and length. Normally this will be balanced by a call to HFB_ReleaseStreamingData, unless
+the entire file fits within the HFB buffer. The operation does not move compressed data.
+@Return value >= 0 handle to compressed block; -1 request out of range ; -2 block exists but is not in the buffer ...
+usually caused by unrleased block of buffer starvation ; -4 block has been release from use.
+@*/
+libFunc HFB_DATA_HANDLE HFB_GetStreamingData(
+ HFB_STREAM_HANDLE streamHandle, /* handle to an HFB stream object. */
+ void **ptrToPtr, /* pointer to pointer to compressed data. */
+ int *ptrToLength, /* pointer to length of data in bytes. */
+ hfbDirection directionToMove, /* direction in which to read records. */
+ int framesToMove /* the number of reqested records. */
+);
+
+
+
+
+/*@
+@Name HFB_ReleaseStreamingData
+@Description release buffer space occupied by record
+@Return value none.
+@*/
+libFunc void HFB_ReleaseStreamingData(
+ HFB_BUFFER_HANDLE bufferHandle, /* handle to HFB buffer object. */
+ HFB_DATA_HANDLE recordToRelease /* index of data record to release. */
+);
+
+
+
+/*@
+@Name HFB_ReadData
+@Description read data directly from a file into a supplied buffer,
+ limit is set by initial value of *ptrToLength
+@Return value 0 on success, or negative error code.
+@*/
+libFunc int HFB_ReadData(
+ HFB_STREAM_HANDLE streamHandle, /* handle to HFB stream object. */
+ void *data, /* pointer to where data should be copied. Used by duck_read. */
+ int *maxLength, /* pointer to max data size, will be over-written with actual count of bytes read. */
+ hfbDirection directionToMove, /* direction in which the seek should move. */
+ int count /* the number of datarecords to move before reading. Absolute referencse begin at 0. */
+);
+
+
+libFunc int HFB_ReadDataBlocking(
+ HFB_STREAM_HANDLE streamHandle, /* handle to HFB stream object. */
+ void *data, /* pointer to where data should be copied. Used by duck_read. */
+ int *maxLength, /* pointer to max data size, will be over-written with actual count of bytes read. */
+ hfbDirection directionToMove, /* direction in which the seek should move. */
+ int count /* the number of datarecords to move before reading. Absolute referencse begin at 0. */
+);
+
+
+
+/*@
+@!Name HFB_FramestoNextKeyFrame
+@Description
+@Return value
+@*/
+libFunc int HFB_FramestoNextKeyFrame(
+ HFB_STREAM_HANDLE streamHandle, /* */
+ int recordHandle, /* */
+ int *numberOfRecordsSpanned /* */
+ );
+
+
+
+/*@
+@!Name HFB_FrameToChunk
+@Description
+@Return value
+@*/
+libFunc int HFB_FrameToChunk(
+ HFB_STREAM_HANDLE streamHandle, /* */
+ int frameNumber /* */
+ );
+
+
+/*@
+@Name HFB_PreviousKeyFrame
+@Description Get the frameNumber of the keyframe at or prior to the specified frameNumber
+@Return value
+@*/
+libFunc int HFB_PreviousKeyFrame(
+ HFB_STREAM_HANDLE streamHandle, /* */
+ int frameNumber /* */
+ );
+
+
+
+typedef enum FTYPE {
+ HFB_FRAMENUM = 0,
+ HFB_INDEXNUM = 1
+} hfbFrameNumber;
+
+
+
+/*@
+@Name HFB_GetIndexFlags
+@Description get the HFB index flags for the specified record/frame
+@Return value >= 0 data block flags for data block specifid; -1 frameNum is out of index range ; -2 frameNum is out of frame range.
+@*/
+libFunc int HFB_GetIndexFlags(
+ HFB_STREAM_HANDLE , /* handle to HFB stream object. */
+ hfbFrameNumber frameNumberType, /* one of HFB_FRAMENUM, HFB_INDEXNUM */
+ int recordHandleOrFrameNumber /* record handle or frame number. */
+);
+
+/*@
+@Name HFB_AddIndexFlags
+@Description add the HFB index flags for the specified record/frame
+@Return value 0 if unsuccessful; 1 if successful;
+@*/
+libFunc int HFB_AddIndexFlags(
+ HFB_STREAM_HANDLE , /* handle to HFB stream object. */
+ hfbFrameNumber frameNumberType, /* one of HFB_FRAMENUM, HFB_INDEXNUM */
+ int recordHandleOrFrameNumber, /* record handle or frame number. */
+ int flags /* flags to add */
+);
+
+/*@
+@Name HFB_GetDataPosition
+@Description get current data position. video - frameNumber, audio - sampleCount.
+This is useful for resolving differences between streams when starting from a position other than the beginning of the file.
+@Return value Longword starting position of the data record within the stream, expressed in audio samples for audio streams and frames for video streams.
+@*/
+libFunc int HFB_GetDataPosition(
+ HFB_STREAM_HANDLE streamHandle, /* handle to HFB stream object. */
+ HFB_DATA_HANDLE dataIndex /* index to a data record within a stream. Use -1 to find position of first available record in the buffered stream */
+);
+
+
+
+/*@
+@Name HFB_GetAudioInfo
+@Description Get information about audio stream.
+@Return value pointer to a DKWAVEFORM structure describing the audio information contained in the stream.
+@*/
+libFunc DKWAVEFORM *HFB_GetAudioInfo(
+ HFB_STREAM_HANDLE aStream, /* handle to HFB stream object */
+ int *NumChannels, /* pointer to number of channels in the audio stream. */
+ int *SamplesPerSec, /* pointer to samples per second in the audio stream. */
+ int *BytesPerSec, /* pointer to bytes per second in the audio stream. */
+ int *wFormat /* pointer to the format tag value for the audio stream. */
+);
+
+
+
+/*@
+@!Name HFB_GetInitialFrames
+@Description /* get the amount of audio skew expressed in records
+@Return value
+@*/
+libFunc int HFB_GetInitialFrames(
+ HFB_STREAM_HANDLE videoStream, /* handle to video stream */
+ HFB_STREAM_HANDLE audioStream /* handle to audio stream */
+);
+
+
+
+/*@
+@Name HFB_GetSamplesPerFrame
+@Description get the number of audio frames elapsed during a single video frame
+@Return value The number of audio samples from the audio stream occurring within a single frame interval of video.
+@*/
+libFunc int HFB_GetSamplesPerFrame(
+ HFB_STREAM_HANDLE videoStream, /* handle to an HFB video stream */
+ HFB_STREAM_HANDLE audioStream /* handle to an HFB audio stream */
+);
+
+
+
+/*@
+@Name HFB_GetFrameRates
+@Description get video frame rate and calculated audio skew (in audio samples)
+@Return value
+@*/
+libFunc void HFB_GetFrameRates(
+ HFB_STREAM_HANDLE videoStream, /* handle to an HFB video stream */
+ HFB_STREAM_HANDLE audioStream, /* handle to an HFB audio stream */
+ int *ptrToIntegerFrameRate, /* pointer to receive frame rate of dominant stream. */
+ int *ptrToEstimatedAudioSampleSkew /* pointer to number of audio samples appearing before the first video frame in file. */
+);
+
+
+/*@
+@Name HFB_GetDRMData
+@Description get the DRMX data chunk
+@Return value
+@*/
+libFunc int HFB_GetDRMData(
+ HFB_FILE_HANDLE dckPtr, /* */
+ unsigned int* pOutEncFourCC, /* */
+ int* pOutLength, /* */
+ unsigned char** ppOutData /* */
+);
+
+
+
+/*@
+@!Name HFB_GetStreamParentBuffer
+@Description functions to retrieve parent buffer and file of a given stream
+@Return value
+@*/
+libFunc HFB_BUFFER_HANDLE HFB_GetStreamParentBuffer(
+ HFB_STREAM_HANDLE streamHandle /* */
+);
+
+
+/*@
+@!Name HFB_GetStreamParentFile
+@Description
+@Return value
+@*/
+libFunc HFB_FILE_HANDLE HFB_GetStreamParentFile(
+ HFB_STREAM_HANDLE streamHandle /* */
+);
+
+
+
+/*@
+@!Name HFB_GetStreamParentFileHandle
+@Description function to retrieve parent file handle of a given stream
+@Return value
+@*/
+libFunc int HFB_GetStreamParentFileHandle(
+ HFB_STREAM_HANDLE streamhandle /* */
+); /* FWG 6-23-99 */
+
+
+
+
+/*@
+@Name HFB_SetMaxFrameSize
+@Description Tell HFB maximum frame size in bytes.
+****** DO NOT GIVE WRONG NUMBER****** This might cause
+HFB to crash. Only used in Fly-Index mode.
+@Return Value T.B.D.
+@*/
+libFunc int HFB_SetMaxFrameSize(
+ HFB_BUFFER_HANDLE Buffer, /* handle to an HFB Buffer */
+ int maxFrameSize /* maximum frame size */
+); /* FWG 7-7-99 */
+
+
+
+libFunc hfbBufferMode HFB_GetBufferMode(HFB_BUFFER_HANDLE); /* FWG 7-8-99 */
+
+/* used to precisely calculate rational frame rates
+ for a specific stream */
+libFunc void HFB_GetStreamRateAndScale(
+ HFB_STREAM_HANDLE xStream, /* stream handle */
+ int *rate, /* rate - of rate and scale. */
+ int *scale /* scale - of rate and scale. */
+);
+
+
+
+/*@
+@Name HFB_GetStreamFCCs
+@Description get stream type and handler fourCC codes,
+@Return Value returns type (not handler)
+@*/
+libFunc unsigned int HFB_GetStreamFCCs(
+ HFB_STREAM_HANDLE xStream, /* handle to compressed stream */
+ unsigned int *type, /* pointer to stream type */
+ unsigned int *handler /* pointer to fourCC code */
+ );
+
+
+
+/*@
+@Name HFB_NextKeyFrame
+@Description returns the index of the next keyframe, looking forward from StartChunk.
+byteRate is the projected byterate up to that keyframe.
+@Return Value returns the index of the next keyframe
+@*/
+int HFB_NextKeyFrame(
+ HFB_STREAM_HANDLE sPtr, /* stream handle */
+ int StartChunk, /* look forward from here. */
+ int *byteRate /* */
+);
+
+/*
+@Name HFB_isVideoKeyFrame
+@Description checks if a video frame is a key frame (in logarithmic time)
+@Return Value returns 1 if key frame, 0 if not, -1 on error
+@Note: only works for the first video stream*/
+
+int HFB_isVideoKeyFrame(
+ HFB_BUFFER_HANDLE dckPtr, /* buffer handle */
+ int frameNum /* video frame to check */
+);
+
+int HFB_ProjectBitRate(HFB_STREAM_HANDLE sPtr, int StartChunk, int *numFrames );
+// returns the byterate for the next *numFrames , given a starting chunkIndex
+// numFrames is a pointer since the actual amount looked ahead may be adjusted
+// as you get to the end of the stream
+
+/* Determine the stream to which we can switch that has the highest precedence */
+/* (defined by order in the array), but is below the ceiling specified by the caller */
+/* Note: We can only switch to another stream if its next frame is a keyframe. */
+/* Note: If no streams are below the ceiling, we will attempt to switch to the */
+/* lowest bitrate stream on a keyframe. */
+int HFB_SelectBestFitStream(
+ HFB_STREAM_HANDLE* streamArray, // array of streams to consider
+ int numberOfStreamsInArray, // number of streams in the array
+ int currentStream, // array index matching currently used stream
+ int desiredProjectionSpan, // distance in frames ahead to project
+ int bitRateCeiling); // we're looking for a stream under this bitrate
+
+
+/* get streamSampleSize, <= 0 means variable */
+libFunc int HFB_GetStreamSampleSize(HFB_STREAM_HANDLE xStream);
+
+
+/*@
+@!Name HFB_WhatsAhead
+@Description
+@Return value
+@*/
+libFunc int HFB_WhatsAhead(
+ HFB_STREAM_HANDLE sPtr, /* */
+ int StartChunk, /* */
+ int *horizon /* */
+);
+
+
+
+/* windows 95 dll system abstraction functions */
+
+libFunc void HFB_Setmalloc(
+ void *(*mallocFuncPtr)(unsigned int size)
+ );
+
+libFunc void HFB_Setcalloc(
+ void *(*callocFuncPtr)(unsigned int size, unsigned int number)
+ );
+
+libFunc void HFB_Setfree(
+ void (*freeFuncPtr)(void *)
+ );
+
+libFunc void HFB_Setopen(
+ int (*openFuncPtr)(const char *, int,...)
+ );
+
+libFunc void HFB_Setclose(
+ int (*closeFuncPtr)(int)
+ );
+
+libFunc void HFB_Setread(
+ int (*readFuncPtr)(int,void *, unsigned int)
+ );
+
+libFunc void HFB_Setseek(
+ int (*seekFuncPtr)(int,int,int)
+ );
+
+/*@
+@Name HFB_GetStreamArray
+@Description HFB_GetStreamArray
+will return an array of all streams in a file
+that are of the given type. If the given type is DUK_UNDEFINED,
+all streams will be included in the array, regardless of type.
+This function will also report back the size of the array (ie: the number
+of matching streams) through the numberOfStreams pointer.
+@Return value The array of stream handles
+@*/
+HFB_STREAM_HANDLE* HFB_GetStreamArray(
+ HFB_FILE_HANDLE FileHandle, /* the file we will be looking in for our streams */
+ unsigned int StreamType, /* the type of stream we are looking for */
+ unsigned int* numberOfStreams /* a pointer to the number of matching streams */
+);
+
+
+
+/*@
+@Name HFB_ReleaseStreamArray
+@Description HFB_ReleaseStreamArray will deallocate an array of streams which
+was previously allocated by a call to HFB_GetStreamArray().
+@Return Value
+@*/
+void HFB_ReleaseStreamArray(
+ HFB_STREAM_HANDLE* StreamArray, /* the array of streams we want to release */
+ unsigned int numberOfStreams /* number of streams in the array */
+);
+
+/*@
+@Name HFB_GetLastError
+@Description HFB_GetLastError will return the last error that occured
+@Return Value 0 if successful, -1 if unsuccessful
+@*/
+int HFB_GetLastError(
+ HFB_BUFFER_HANDLE bfHnd, /* pointer to the buffer handle */
+ int* lastErrorCode, /* will return negative value for HFB error,
+ positive value for SAL error */
+ char errorString[], /* will return error string */
+ size_t maxLen /* max size of error string */
+);
+
+
+typedef enum HFB_ERR_t {
+
+ HFB_ERR_MIN = -7,
+ HFB_ERROR_LOADING_INDEX = -6,
+ HFB_ERROR_PARSING_FILE = -5,
+ HFB_PARTIALREAD = -4,
+ HFB_ENDOFSTREAM = -3,
+ HFB_NOTREADY = -2,
+ HFB_ERROR = -1,
+ HFB_OK = 0
+
+} HFB_ERR;
+
+
+typedef struct HFB_ERR_DECODE_temp
+{
+ HFB_ERR code;
+ char* decode;
+
+} HFB_ERR_DECODE_t;
+
+
+#if defined(__cplusplus)
+}
+#endif
+
+#undef libFunc
+
+#endif
diff --git a/Src/libvp6/corelibs/include/duck_ifstream.hpp b/Src/libvp6/corelibs/include/duck_ifstream.hpp
new file mode 100644
index 00000000..cd43e2c7
--- /dev/null
+++ b/Src/libvp6/corelibs/include/duck_ifstream.hpp
@@ -0,0 +1,340 @@
+#if !defined(_duck_ifstream_h)
+#define _duck_ifstream_h
+
+
+#include "duck_io.h"
+
+
+
+
+#include <stdio.h>
+#include <sstream>
+#include <ios>
+#include <assert.h>
+
+
+
+#include "iduck_ifstream.hpp"
+
+
+
+
+class duck_ifstream_ifstream : duck_ifstream
+{
+ public:
+
+ bool operator!() const
+ {
+ return (m_fd == 0);
+ }
+
+
+ bool is_open()
+ {
+ return (m_fd != 0);
+ }
+
+
+ int length()
+ {
+ if (m_length < 0)
+ {
+ FILE* fp = (FILE* ) m_fd;
+ long off = ftell(fp);
+
+ fseek(fp, 0,SEEK_END);
+
+ long off2 = ftell(fp);
+
+ fseek(fp, off, SEEK_SET);
+
+ m_length = (int ) off2;
+
+ return (int) off2;
+ }
+ else
+ {
+ return m_length;
+ }
+ }
+
+
+ void time_out(unsigned long milli)
+ {
+ ;
+ }
+
+
+ bool eof()
+ {
+ return feof(m_fd);
+ }
+
+
+ operator bool () const
+ {
+ return (m_fd != 0);
+ }
+
+
+ void open(const char* filename, std::ios_base::openmode mode)
+ {
+ m_length = -1;
+ m_fd = fopen(filename, "rb");
+ }
+
+
+ void open(void *src, void* ignore)
+ {
+ assert(0);
+ }
+
+ void close()
+ {
+ if (m_fd)
+ {
+ fclose(m_fd);
+ }
+ }
+
+ void read(void *buffer, size_t len)
+ {
+ fread((unsigned char* ) buffer, sizeof(char), len, m_fd);
+ }
+
+ void get(char& c)
+ {
+ fread((unsigned char* ) &c, sizeof(char), 1, m_fd);
+ }
+
+
+ void seekg(long position)
+ {
+ fseek(m_fd, position, SEEK_SET);
+ }
+
+
+
+ void seekg(long offset, int origin)
+ {
+
+ switch (origin)
+ {
+ case std::ios_base::cur :
+ fseek(m_fd, offset , SEEK_CUR);
+ break;
+ case std::ios_base::end :
+ fseek(m_fd, offset, SEEK_END);
+ break;
+ case std::ios_base::beg :
+ fseek(m_fd, offset, SEEK_SET);
+ break;
+
+ default :
+ assert(0);
+ break;
+ }
+ }
+
+
+ void ignore(long offset)
+ {
+ fseek(m_fd, offset, SEEK_CUR);
+ }
+
+
+ long tellg()
+ {
+ const std::streamoff off = ftell(m_fd);
+ return std::streampos(off);
+ }
+
+
+ private:
+ FILE* m_fd;
+
+ int m_length;
+
+};
+
+
+
+extern "C" {
+void MessageBox(char* title, char* msg);
+}
+
+
+
+#include "duck_io.h"
+
+
+
+
+class duck_ifstream_http : duck_ifstream
+{
+ public:
+
+ bool operator!() const
+ {
+ return (m_fd <= 0);
+ }
+
+
+ bool is_open()
+ {
+ return (m_fd > 0);
+ }
+
+
+ ~duck_ifstream_http()
+ {
+ duck_exit_http(m_fd);
+ }
+
+
+ operator bool () const
+ {
+ return (m_fd >= 0);
+ }
+
+
+ int length()
+ {
+ return duck_length((int ) m_fd);
+ }
+
+
+
+
+ void time_out(unsigned long milli)
+ {
+ duck_http_timeout(m_fd, milli);
+ }
+
+
+
+ bool eof()
+ {
+ return duck_eof(m_fd);
+ }
+
+
+
+
+
+ void open(const char* url, std::ios_base::openmode mode)
+ {
+
+ m_fd = (int) duck_init_http(url);
+
+
+ if (duck_open((char *) m_fd, 0) < 0)
+ {
+ if (m_fd)
+ {
+ duck_close((int ) m_fd);
+ m_fd = -1;
+ }
+
+ }
+
+ }
+
+
+ void open(void *src, void* ignore)
+ {
+ assert(0);
+ }
+
+ void close()
+ {
+ if (m_fd >= 0)
+ {
+ duck_close(m_fd);
+ }
+ }
+
+ void read(void *buffer, size_t len)
+ {
+ size_t x;
+
+ x = duck_read(m_fd, (unsigned char* ) buffer, (long ) len);
+
+ if (x != len)
+ {
+ MessageBox("Error", "NSV Read Failed");
+ }
+ }
+
+ void get(char& c)
+ {
+ duck_read(m_fd, (unsigned char *) &c, 1);
+ }
+
+
+ void seekg(long position)
+ {
+ long o = position - duck_tell(m_fd);
+
+ if (o >= 0)
+ {
+ duck_seek(m_fd, o, SEEK_CUR);
+ }
+ else
+ {
+ duck_close(m_fd);
+ duck_open((char *) m_fd, 0);
+
+ duck_seek(m_fd, position, SEEK_CUR);
+ }
+ }
+
+
+
+ void seekg(long offset, int origin)
+ {
+
+ switch (origin)
+ {
+ case std::ios_base::cur :
+ duck_seek(m_fd, offset, SEEK_CUR);
+ break;
+ default :
+ /* don't do it ! */
+ /* assert(0); */
+ break;
+ }
+ }
+
+
+ void ignore(long offset)
+ {
+ duck_seek(m_fd, offset, SEEK_CUR);
+ }
+
+
+ long tellg()
+ {
+ long off = duck_tell(m_fd);
+ return off;
+ }
+
+
+ private:
+ int m_fd;
+
+
+ #if 0
+ /* disable copying ! */
+ duck_ifstream_http(const duck_ifstream_http& );
+
+
+ /* disable copying ! */
+ operator= (const duck_ifstream_http& );
+ #endif
+
+};
+
+
+
+#endif
diff --git a/Src/libvp6/corelibs/include/duck_int.h b/Src/libvp6/corelibs/include/duck_int.h
new file mode 100644
index 00000000..a469eefa
--- /dev/null
+++ b/Src/libvp6/corelibs/include/duck_int.h
@@ -0,0 +1,26 @@
+//==========================================================================
+//
+// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
+// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
+// PURPOSE.
+//
+// Copyright (c) 1999 - 2001 On2 Technologies Inc. All Rights Reserved.
+//
+//--------------------------------------------------------------------------
+
+
+#ifndef _duck_int_h
+#define _duck_int_h
+
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+int *duck_int386x(int intVal, void *r1, void *r2, void *sr);
+
+#if defined(__cplusplus)
+}
+#endif
+#endif
diff --git a/Src/libvp6/corelibs/include/duck_io.h b/Src/libvp6/corelibs/include/duck_io.h
new file mode 100644
index 00000000..2d87b978
--- /dev/null
+++ b/Src/libvp6/corelibs/include/duck_io.h
@@ -0,0 +1,109 @@
+//==========================================================================
+//
+// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
+// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
+// PURPOSE.
+//
+// Copyright (c) 1999 - 2001 On2 Technologies Inc. All Rights Reserved.
+//
+//--------------------------------------------------------------------------
+
+
+#ifndef _duck_io_h
+#define _duck_io_h
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+#if defined (_WIN32)
+ typedef __int64 int64_t;
+#endif
+typedef struct
+{
+ int64_t offset; // offset to start from
+ int blocking; // non-zero for blocking
+} ReOpen_t;
+
+
+typedef enum {
+ SAL_ERR_MAX = -10,
+ SAL_ERROR = -11, // Default error
+ SAL_ERR_WSASTARTUP = -12,
+ SAL_ERR_SOCKET_CREATE = -13,
+ SAL_ERR_RESOLVING_HOSTNAME = -14,
+ SAL_ERR_SERVER_CONNECTION = -15,
+ SAL_ERR_SENDING_DATA = -16,
+ SAL_ERR_RECEIVING_DATA = -17,
+ SAL_ERR_404_FILE_NOT_FOUND = -18,
+ SAL_ERR_PARSING_HTTP_HEADER = -19,
+ SAL_ERR_PARSING_CONTENT_LEN = -20,
+ SAL_ERR_CONNECTION_TIMEOUT = -21,
+ SAL_ERR_FILE_OPEN_FAILED = -22,
+ SAL_ERR_MIN = -23
+} SAL_ERR; /* EMH 1-15-03 */
+
+
+typedef struct SalErrMap_temp
+{
+ SAL_ERR code;
+ const char* decode;
+
+} SalErrMap_t;
+
+
+static char* SalErrText(SAL_ERR e)
+{
+ int t;
+ const SalErrMap_t gSalErrMap[] =
+ {
+ { SAL_ERR_WSASTARTUP, "Error with WSAStartup" },
+ { SAL_ERR_SOCKET_CREATE, "Error creating socket" },
+ { SAL_ERR_RESOLVING_HOSTNAME, "Error resolving hostname" },
+ { SAL_ERR_SERVER_CONNECTION, "Error connecting to server" },
+ { SAL_ERR_SENDING_DATA, "Error sending data" },
+ { SAL_ERR_RECEIVING_DATA, "Error receiving data" },
+ { SAL_ERR_404_FILE_NOT_FOUND, "Error file not found " },
+ { SAL_ERR_PARSING_HTTP_HEADER, "Error parsing http header" },
+ { SAL_ERR_PARSING_CONTENT_LEN, "Error parsing content length" },
+ { SAL_ERR_CONNECTION_TIMEOUT, "Error Connection timed out" },
+ { SAL_ERR_FILE_OPEN_FAILED, "Error opening file" }
+ };
+
+ for(t = 0; t < sizeof(gSalErrMap)/sizeof(SalErrMap_t); t++)
+ {
+ if (e == gSalErrMap[t].code)
+ return (char *) gSalErrMap[t].decode;
+ }
+
+ return 0;
+}
+
+
+
+
+
+
+
+int duck_open(const char *fname, unsigned long userData);
+
+void duck_close(int ghndl);
+
+int duck_read(int ghndl,unsigned char *buf, int nbytes);
+
+int64_t duck_seek(int gHndl,int64_t offs, int origin);
+
+int duck_readFinished(int han, int flag); /* FWG 7-9-99 */
+
+int duck_name(int handle, char name[], size_t maxLen); /* EMH 9-23-03 */
+
+int duck_read_blocking(int handle,unsigned char *buffer,int bytes); /* EMH 9-23-03 */
+
+int64_t duck_available_data(int handle); /* EMH 10-23-03 */
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif
diff --git a/Src/libvp6/corelibs/include/duck_io_file.h b/Src/libvp6/corelibs/include/duck_io_file.h
new file mode 100644
index 00000000..af341622
--- /dev/null
+++ b/Src/libvp6/corelibs/include/duck_io_file.h
@@ -0,0 +1,44 @@
+//==========================================================================
+//
+// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
+// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
+// PURPOSE.
+//
+// Copyright (c) 1999 - 2001 On2 Technologies Inc. All Rights Reserved.
+//
+//--------------------------------------------------------------------------
+
+
+#ifndef _duck_io_h_old
+#define _duck_io_h_old
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+#if defined (_WIN32)
+typedef __int64 int64_t;
+#else
+typedef long long int64_t;
+#endif
+
+#include "duck_io.h"
+
+int duck_open_file(const char *fname, unsigned long userData);
+
+void duck_close_file(int ghndl);
+
+int duck_read_file(int ghndl,unsigned char *buf, int nbytes);
+
+int64_t duck_seek_file(int gHndl,int64_t offs, int origin);
+
+int duck_name_file(int handle, char fname[], size_t maxLen); /* EMH 9-23-03 */
+
+int64_t duck_available_data_file(int handle); /* EMH 10-23-03 */
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif
diff --git a/Src/libvp6/corelibs/include/duck_io_http.h b/Src/libvp6/corelibs/include/duck_io_http.h
new file mode 100644
index 00000000..746c97f6
--- /dev/null
+++ b/Src/libvp6/corelibs/include/duck_io_http.h
@@ -0,0 +1,62 @@
+//==========================================================================
+//
+// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
+// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
+// PURPOSE.
+//
+// Copyright (c) 1999 - 2001 On2 Technologies Inc. All Rights Reserved.
+//
+//--------------------------------------------------------------------------
+
+
+#ifndef _duck_io_h_http
+#define _duck_io_h_http
+
+#include <string.h> /* get size_t */
+#include "duck_io.h"
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+#if defined (_WIN32)
+typedef __int64 int64_t;
+#else
+typedef long long int64_t;
+#endif
+
+
+int duck_open_http(const char *fname, unsigned long userData);
+
+void duck_close_http(int ghndl);
+
+int duck_read_http(int ghndl,unsigned char *buf, int nbytes);
+
+int64_t duck_seek_http(int gHndl,int64_t offs, int origin);
+
+int duck_sal_error_http(void* handle, SAL_ERR* lastErrorCode, char buffer[], size_t maxLen); /* EMH 1-15-03 */
+
+char* duck_init_http(char* url); /* EMH 1-17-03 */
+
+void duck_exit_http(int handle); /* EMH 6-09-03 */
+
+int duck_sal_fill(void * handle, bool blocking); /* EMH 6-12-03 */
+
+void duck_http_timeout(int handle, unsigned long milliseconds);
+
+int duck_sal_buff_percent(void* handle); /* debug */
+
+int64_t duck_available_data_http(int handle); /* EMH 10-23-03 */
+
+int64_t duck_content_len(void *handle);
+
+int duck_name_http(int handle, char url[], size_t maxLen); /* EMH 9-23-03 */
+
+int duck_read_blocking_http(int handle,unsigned char *buffer, int bytes); /* EMH 9-23-03 */
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif
diff --git a/Src/libvp6/corelibs/include/duck_mem.h b/Src/libvp6/corelibs/include/duck_mem.h
new file mode 100644
index 00000000..10329fdd
--- /dev/null
+++ b/Src/libvp6/corelibs/include/duck_mem.h
@@ -0,0 +1,18 @@
+//==========================================================================
+//
+// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
+// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
+// PURPOSE.
+//
+// Copyright (c) 1999 - 2001 On2 Technologies Inc. All Rights Reserved.
+//
+//--------------------------------------------------------------------------
+
+
+#ifndef _duck_mem_h
+#define _duck_mem_h
+
+#include "../on2_common/src/on2_mem/include/on2_mem.h"
+
+#endif
diff --git a/Src/libvp6/corelibs/include/duck_wav.h b/Src/libvp6/corelibs/include/duck_wav.h
new file mode 100644
index 00000000..107e30aa
--- /dev/null
+++ b/Src/libvp6/corelibs/include/duck_wav.h
@@ -0,0 +1,29 @@
+#ifndef _duck_wav_h
+#define _duck_wav_h
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+typedef struct tDKWAVEFORM
+{
+ unsigned short wFormatTag; /* format type */
+ unsigned short nChannels; /* number of channels (i.e. mono, stereo...) */
+ unsigned int nSamplesPerSec; /* sample rate */
+ unsigned int nAvgBytesPerSec; /* for buffer estimation */
+ unsigned short nBlockAlign; /* block size of data */
+ unsigned short wBitsPerSample; /* Number of bits per sample of mono data */
+ unsigned short cbSize; /* The count in bytes of the size of
+ extra information (after cbSize) */
+ unsigned short wSamplesPerBlock;
+
+ unsigned int userData[16];
+} DKWAVEFORM;
+
+/* don't try to endian fix the userData ! */
+static int DKWAVEFORM_REFLECT[ ] = { 2,2, 4,4, 2,2,2,2 };
+
+#if defined(__cplusplus)
+}
+#endif
+#endif
diff --git a/Src/libvp6/corelibs/include/duktypes.h b/Src/libvp6/corelibs/include/duktypes.h
new file mode 100644
index 00000000..17a57d65
--- /dev/null
+++ b/Src/libvp6/corelibs/include/duktypes.h
@@ -0,0 +1,25 @@
+#ifndef _duktypes_h
+#define _duktypes_h
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+typedef unsigned char U8;
+typedef unsigned short U16;
+typedef unsigned long U32;
+typedef signed char I8;
+typedef short I16;
+typedef long I32;
+/*
+//typedef int Boolean;
+*/
+#if 1 /* def _MSC_VER */
+typedef unsigned char uchar;
+/*typedef unsigned short ushort;*/
+typedef unsigned long ulong;
+#endif
+#if defined(__cplusplus)
+}
+#endif
+
+#endif
diff --git a/Src/libvp6/corelibs/include/dxl_aud.h b/Src/libvp6/corelibs/include/dxl_aud.h
new file mode 100644
index 00000000..22b97bec
--- /dev/null
+++ b/Src/libvp6/corelibs/include/dxl_aud.h
@@ -0,0 +1,38 @@
+#ifndef _dxl_aud_h
+#define _dxl_aud_h
+
+#include "duck_hfb.h"
+#include "duck_dxl.h"
+
+
+enum spkrst8 { SPEAKEROFF = 0, SPEAKERON = 1, FEEDSPEAKER = 2, MONOSPEAKER = 3};
+enum syncst8 { NOSYNC = 0, SYNCSPEAKER = 1, SYNCSYSTEM = 2};
+
+
+extern enum spkrst8 speakerstate;
+extern enum syncst8 syncstate;
+
+
+void Announcement(char *msg);
+
+extern "C" {
+
+ int FillAudio( HFB_BUFFER_HANDLE hfb, MFP_STREAM_HANDLE as, int *index,
+ void **blk, long *Len, int buffPreload, int MultiBlock);
+
+ int SetupAudio( HFB_BUFFER_HANDLE hfb, MFP_STREAM_HANDLE as, int Setstate,
+ int freq, int width16, int Stereo);
+
+ void StartPlaying(void) ;
+
+ void StopPlaying(void);
+
+
+ void ResyncAudio(
+ HFB_BUFFER_HANDLE hfb,
+ HFB_STREAM_HANDLE astr,
+ int *index, void **blk, long *Len, int frame, int frame_rate);
+}
+
+
+#endif
diff --git a/Src/libvp6/corelibs/include/dxl_main.h b/Src/libvp6/corelibs/include/dxl_main.h
new file mode 100644
index 00000000..4ca1dfce
--- /dev/null
+++ b/Src/libvp6/corelibs/include/dxl_main.h
@@ -0,0 +1,307 @@
+//==========================================================================
+//
+// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
+// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
+// PURPOSE.
+//
+// Copyright (c) 1999 - 2001 On2 Technologies Inc. All Rights Reserved.
+//
+//--------------------------------------------------------------------------
+
+
+#ifndef _dxl_main_h
+#define _dxl_main_h
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+struct vScreen;
+struct tXImage;
+
+struct tAudioBuff;
+struct tXAudioSource;
+
+#if defined(__cplusplus)
+}
+#endif
+
+
+
+
+#if defined(_WIN32_WCE)
+#ifndef NULL
+#define NULL 0
+#endif
+#endif
+
+#include "dkpltfrm.h"
+//#include "duktypes.h"
+#include "duck_dxl.h"
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+#define TMRTType 5
+
+#define validate(x) {if (!x) return (int ) DXL_NULLSOURCE; if (!x->dkFlags.inUse) return (int ) DXL_NOTINUSE ;}
+
+typedef void *blitFunc;
+/*typedef void (*blitFunc2)(DXL_XIMAGE_HANDLE,DXL_VSCREEN_HANDLE); */
+
+typedef int DXL_BLIT_FORMAT;
+
+enum DKOBJECTTYPE {
+ DXUNUSED = 0,
+ DXXIMAGE = 1,
+ DXVSCREEN = 2
+};
+
+enum COLORDEPTH {
+ PALETTE8 = 0,
+ RGB555 = 1,
+ RGB555A = 2,
+ RGB888 = 3,
+ RGBA8888 = 4
+};
+
+typedef struct tagflgs {
+ unsigned inUse : 1;
+ unsigned DXed : 1;
+ unsigned clutOwner: 1;
+ unsigned doCompleteBlit : 1;
+ unsigned keyFrame : 1;
+ unsigned nullFrame : 1;
+ unsigned interframe : 1;
+ unsigned logo : 1;
+ unsigned allocated : 1;
+} dkInfoFlags;
+
+typedef struct vflgs {
+ unsigned clipped : 1;
+ unsigned showInfoDots : 1;
+} vFlags;
+
+typedef struct frameheader {
+ unsigned char hdrSize;
+ unsigned char Type;
+ unsigned char DeltaSet;
+ unsigned char Table;
+ unsigned short Ysize;
+ unsigned short Xsize;
+ unsigned short CheckSum;
+ unsigned char CVersion;
+ unsigned char metaType;
+ unsigned char Frameinfo;
+ unsigned char Control;
+ unsigned short xoff,yoff,width,height;
+} FRAMEHEADER;
+
+typedef struct DXINFOSTRUCT{
+ int imwidth;
+ int imheight;
+ int blockpower;
+ int lpbmione;
+ int block2x;
+ unsigned char *vectbl;
+ int hinterp;
+ int interframe;
+ int iskeyframe;
+ int sprite;
+ int bitcnt;
+ int hdrSize;
+ int drawing;
+ int fmt;
+ FRAMEHEADER f;
+ int algorithm;
+} dxInfoStruct;
+
+/*
+ base "class" for xImage(s):
+
+ enum DKOBJECTTYPE dkObjectType; // type of object
+ dkInfoFlags dkFlags; // universal flags
+ enum COLORDEPTH cDepth; // colorDepth
+ short imWidth,imHeight; // internal width & height
+ short x,y,w,h; // location and dx'd dimensions
+ unsigned char *addr; // pointer to compressed data
+ DXL_VSCREEN_HANDLE lVScreen; // last know destination
+ DXL_XIMAGE_HANDLE (*create)(void); // creator (constructor)
+ DXL_XIMAGE_HANDLE (*recreate)(void); // recreate base w/h/type/etc.
+ int (*destroy)(void); // destroyer (destructor)
+ int (*seedData)(void); // reseed with new compressed data
+ int (*dx)(void); // decompress (to vScreen)
+ int (*blit)(void); // blit from internal state
+*/
+
+/*
+ char *(*perfStats)(DXL_XIMAGE_HANDLE, char *storage); \
+*/
+
+typedef struct profilePack_t
+{
+ UINT64 dxClocks;
+ UINT64 profileStart;
+ UINT64 profileEnd;
+ int frameCount;
+
+} DXL_PROFILEPACK;
+
+
+#define xImageBaseStruct \
+ enum DKOBJECTTYPE dkObjectType; \
+ dkInfoFlags dkFlags; \
+ enum COLORDEPTH colorDepth; \
+ short imWidth,imHeight; \
+ short x,y,w,h; \
+ unsigned char *addr; \
+ DXL_VSCREEN_HANDLE lVScreen; \
+ enum BITDEPTH *bdPrefs; \
+ DXL_XIMAGE_HANDLE (*create)(void *); \
+ DXL_XIMAGE_HANDLE (*recreate)(DXL_XIMAGE_HANDLE,void *,int,int,int,int); \
+ int (*destroy)(DXL_XIMAGE_HANDLE); \
+ int (*seedData)(DXL_XIMAGE_HANDLE); \
+ int (*dx)(DXL_XIMAGE_HANDLE, DXL_VSCREEN_HANDLE); \
+ int (*blit)(DXL_XIMAGE_HANDLE, DXL_VSCREEN_HANDLE); \
+ int (*internalFormat)(DXL_XIMAGE_HANDLE, DXL_VSCREEN_HANDLE); \
+ int (*verify)(DXL_XIMAGE_HANDLE, DXL_VSCREEN_HANDLE); \
+ int fSize; \
+ long (*GetXImageCSize)(DXL_XIMAGE_HANDLE); \
+ void *(*getFrameBuffer)(DXL_XIMAGE_HANDLE); \
+ void (*setParameter)(DXL_XIMAGE_HANDLE, int , unsigned long );\
+ DXL_PROFILEPACK prof
+
+
+
+typedef struct tXImage{
+ xImageBaseStruct;
+} DXL_XIMAGE;
+
+typedef struct tXImage1{
+ xImageBaseStruct;
+
+ /********** TM1 specific follows **********/
+ enum IMAGETYPE imType;
+
+ unsigned char *lineBuffer;
+ int lineBufferSize;
+
+ unsigned long *chromaBuffer;
+ int chromaBufferSize;
+
+ short dxCount; /* number of lines left to decompress */
+ short lw,lh;
+
+ enum BGMODE sprMode;
+ short sprColor; /* sprite mode and color for blending */
+
+ dxInfoStruct dxInfo;
+} DXL_XIMAGE_1,*DXL_XIMAGE_1HANDLE;
+
+typedef struct vScreen{
+ enum DKOBJECTTYPE dkObjectType;
+ unsigned char *addr,*laddr; /* address of destination and what it was the last time */
+ unsigned char *bAddr,*bOffsetAddr; /* address of sprite background */
+ enum BITDEPTH bd; /* format of destination */
+ enum BLITQUALITY bq; /* blit translation mode */
+ short pitch,height; /* pitch and height of dest */
+ short bx,by,bPitch; /* x,y, and pitch of background */
+ short viewX,viewY; /* offset/clipping viewport within destination */
+ short viewW,viewH;
+ short clipX,clipY; /* clipping rectangle within viewport */
+ short clipW,clipH;
+ dkInfoFlags dkFlags;
+ DXL_XIMAGE_HANDLE lXImage; /* last XImage decompressed here, useful for smart blitting */
+ unsigned char *clut1,*clut2;
+ DXL_BLIT_FORMAT blitFormat;
+
+ void *blitSetup;
+ void *blitter;
+ void *blitExit;
+
+ int vesaMode;
+ unsigned char *drawAddr;
+ short drawW,drawH;
+ vFlags flags;
+
+} DXL_VSCREEN;
+
+/* private functions */
+int decodeHeader(void *data,register dxInfoStruct *dxInfo);
+
+
+#define MAX_CDEPTHS DXMAX
+#define MAX_BQUALITIES DXBLITMAX
+
+typedef enum tDXL_INTERNAL_FORMAT {
+ DXL_NULL_IFORMAT = -1,
+ DXL_LINE16 = 0,
+ DXL_LINE16i = 1,
+ DXL_LINE16hi = 2,
+ DXL_LINE16spr = 3,
+ DXL_LINE8 = 4,
+ TM2_BLOCK24 = 5,
+ TM1_24 = 6,
+ TORQ_YUY2 = 7,
+ TORQ_YUY2hi = 8,
+ YV12 = 9,
+ SWET_YUV = 10,
+ DXL_MAX_IFORMATS
+} DXL_INTERNAL_FORMAT;
+
+DXL_BLIT_FORMAT DXL_ReserveBlitter(void);
+DXL_BLIT_FORMAT DXL_OverrideBlitter(enum BLITQUALITY bq,enum BITDEPTH bd);
+int DXL_RegisterBlitter(DXL_BLIT_FORMAT dFormat, DXL_INTERNAL_FORMAT ,
+ blitFunc blit, blitFunc setup, blitFunc exit);
+
+blitFunc DXL_GetBlitFunc(DXL_XIMAGE_HANDLE ,DXL_VSCREEN_HANDLE );
+blitFunc DXL_GetBlitSetupFunc(DXL_XIMAGE_HANDLE ,DXL_VSCREEN_HANDLE );
+blitFunc DXL_GetBlitExitFunc(DXL_XIMAGE_HANDLE ,DXL_VSCREEN_HANDLE );
+
+blitFunc DXL_GetVBlitFunc(DXL_VSCREEN_HANDLE ,DXL_VSCREEN_HANDLE );
+blitFunc DXL_GetVBlitSetupFunc(DXL_VSCREEN_HANDLE ,DXL_VSCREEN_HANDLE );
+blitFunc DXL_GetVBlitExitFunc(DXL_VSCREEN_HANDLE ,DXL_VSCREEN_HANDLE );
+
+DXL_BLIT_FORMAT DXL_GetVScreenBlitFormat(DXL_VSCREEN_HANDLE );
+DXL_INTERNAL_FORMAT DXL_GetXImageInternalFormat(DXL_XIMAGE_HANDLE ,DXL_VSCREEN_HANDLE );
+
+DXL_INTERNAL_FORMAT DXL_GetVScreenInternalFormat(DXL_VSCREEN_HANDLE vScreen);
+
+int dxl_GetAlgHandle(unsigned long fourcc);
+int dxl_RegisterInternalFormat(int xHandle, DXL_INTERNAL_FORMAT xFormat);
+
+int DXL_VScreenInfoDots(DXL_XIMAGE_HANDLE src, DXL_VSCREEN_HANDLE dst);
+
+int DXL_GetVScreenSizeOfPixel(DXL_VSCREEN_HANDLE );
+unsigned char *DXL_GetDestAddress(DXL_XIMAGE_HANDLE src, DXL_VSCREEN_HANDLE dst);
+
+int DXL_GetXImageOffset(DXL_XIMAGE_HANDLE,int *,int *);
+
+typedef DXL_XIMAGE_HANDLE (*createFunc)(unsigned char *data);
+int DXL_RegisterXImage(createFunc creator,unsigned long fourcc,DXL_INTERNAL_FORMAT iForm);
+
+void registerDuckBlitters(void);
+void resetBlitters(void);
+
+void dxv_logo( unsigned char *dst, int width, int height, int pitch,
+ enum BITDEPTH format, int dci, enum BLITQUALITY bq);
+
+void dxl_24c(void *compaddr, void *scrnaddr,
+ int dstPitch,int iskeyframe,
+ int hinterp,int doublesize,
+ int scrnwidth,int scrnheight,
+ int blockpower, int block2x,
+ int forceheight, char *lastdecomp,
+ char *lastcdecomp);
+
+#define DXL_MKFOURCC( ch0, ch1, ch2, ch3 ) \
+ ( (unsigned long)(unsigned char)(ch0) | ( (unsigned long)(unsigned char)(ch1) << 8 ) | \
+ ( (unsigned long)(unsigned char)(ch2) << 16 ) | ( (unsigned long)(unsigned char)(ch3) << 24 ) )
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif
diff --git a/Src/libvp6/corelibs/include/littlend.h b/Src/libvp6/corelibs/include/littlend.h
new file mode 100644
index 00000000..65fbcbcc
--- /dev/null
+++ b/Src/libvp6/corelibs/include/littlend.h
@@ -0,0 +1,25 @@
+#ifndef _littlend_h
+#define _littlend_h
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+#define invert2(x) (x)
+#define invert4(x) (x)
+
+#define lowByte(x) (unsigned char)x
+#define mid1Byte(x) (unsigned char)(x >> 8)
+#define mid2Byte(x) (unsigned char)(x >> 16)
+#define highByte(x) (unsigned char)(x >> 24)
+
+#define SWAPENDS 0
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif
+
+
+
diff --git a/Src/libvp6/corelibs/include/miscasm.h b/Src/libvp6/corelibs/include/miscasm.h
new file mode 100644
index 00000000..131b7643
--- /dev/null
+++ b/Src/libvp6/corelibs/include/miscasm.h
@@ -0,0 +1,19 @@
+//==========================================================================
+//
+// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
+// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
+// PURPOSE.
+//
+// Copyright (c) 1999 - 2001 On2 Technologies Inc. All Rights Reserved.
+//
+//--------------------------------------------------------------------------
+
+
+#ifndef MISCASM_H
+#define MISCASM_H
+
+void CC_RGB32toYV12_MMXLU( unsigned char *RGBABuffer, int ImageWidth, int ImageHeight,
+ unsigned char *YBuffer, unsigned char *UBuffer, unsigned char *VBuffer );
+
+#endif MISCASM_H
diff --git a/Src/libvp6/corelibs/include/nethfb.h b/Src/libvp6/corelibs/include/nethfb.h
new file mode 100644
index 00000000..85a705f4
--- /dev/null
+++ b/Src/libvp6/corelibs/include/nethfb.h
@@ -0,0 +1,340 @@
+#ifndef _nethfb_h
+#define _nethfb_h
+
+#include "duck_hfb.h"
+
+#ifndef NETHFB
+
+#define lHFB_GetDataSize HFB_GetDataSize
+#define lHFB_GetStreamingData HFB_GetStreamingData
+#define lHFB_ReleaseStreamingData HFB_ReleaseStreamingData
+#define lHFB_ReadData HFB_ReadData
+#define lHFB_WhatsAhead HFB_WhatsAhead
+#define lHFB_GetAudioInfo HFB_GetAudioInfo
+#define lHFB_GetInitialFrames HFB_GetInitialFrames
+#define lHFB_GetSamplesPerFrame HFB_GetSamplesPerFrame
+#define lHFB_GetFrameRates HFB_GetFrameRates
+#define lHFB_GetDRMData HFB_GetDRMData
+#define lHFB_LoadIndex HFB_LoadIndex
+#define lHFB_ParseFile HFB_ParseFile
+#define lHFB_Init HFB_Init
+#define lHFB_Exit HFB_Exit
+#define lHFB_FindFile HFB_FindFile
+#define lHFB_OpenFile HFB_OpenFile
+#define lHFB_SeekToIndex HFB_SeekToIndex
+#define lHFB_BeginLoadIndex HFB_BeginLoadIndex
+#define lHFB_FinishLoadIndex HFB_FinishLoadIndex
+#define lHFB_ReadMoreIndex HFB_ReadMoreIndex
+#define lHFB_ParseBigIndex HFB_ParseBigIndex
+#define lHFB_CloseFile HFB_CloseFile
+#define lHFB_GetFileInfo HFB_GetFileInfo
+#define lHFB_ResetStreams HFB_ResetStreams
+#define lHFB_GetStream HFB_GetStream
+#define lHFB_ReleaseStream HFB_ReleaseStream
+#define lHFB_GetStreamInfo HFB_GetStreamInfo
+#define lHFB_CreateBuffer HFB_CreateBuffer
+#define lHFB_DestroyBuffer HFB_DestroyBuffer
+#define lHFB_ResetBuffer HFB_ResetBuffer
+#define lHFB_SetBufferMode HFB_SetBufferMode
+#define lHFB_QueueOpenFile HFB_QueueOpenFile
+#define lHFB_GetBufferPerCentFull HFB_GetBufferPerCentFull
+#define lHFB_GetmovieSize HFB_GetmovieSize
+#define lHFB_InitBuffer HFB_InitBuffer
+#define lHFB_GetBufferSpace HFB_GetBufferSpace
+#define lHFB_FillBuffer HFB_FillBuffer
+#define lHFB_GetBufferStatus HFB_GetBufferStatus
+#define lHFB_FramestoNextKeyFrame HFB_FramestoNextKeyFrame
+#define lHFB_FrameToChunk HFB_FrameToChunk
+#define lHFB_PreviousKeyFrame HFB_PreviousKeyFrame
+#define lHFB_GetIndexFlags HFB_GetIndexFlags
+#define lHFB_AddIndexFlags HFB_AddIndexFlags
+#define lHFB_GetDataPosition HFB_GetDataPosition
+#define lHFB_ConditionBuffer HFB_ConditionBuffer
+#define lHFB_WalkFlags HFB_WalkFlags
+#define lHFB_isVideoKeyFrame HFB_isVideoKeyFrame
+
+#define lHFB_GetStreamParentBuffer HFB_GetStreamParentBuffer
+#define lHFB_GetStreamParentFile HFB_GetStreamParentFile
+
+#define lHFB_GetStreamRateAndScale HFB_GetStreamRateAndScale
+#define lHFB_GetStreamFCCs HFB_GetStreamFCCs
+#define lHFB_GetStreamSampleSize HFB_GetStreamSampleSize
+#define lHFB_GetLastError HFB_GetLastError
+
+#else
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+/* main HFB initialization and exit routines */
+
+int lHFB_Init(int ,int ,int );
+void lHFB_Exit(void);
+
+/* FWG 9-13-2000 */
+int lHFB_SeekToIndex(HFB_FILE_HANDLE FileHandle);
+int lHFB_BeginLoadIndex(HFB_BUFFER_HANDLE dckPtr, int size);
+int lHFB_FinishLoadIndex(HFB_BUFFER_HANDLE dckPtr, void *data, int size);
+
+/* open specified file, parse its header(s) and load the index */
+HFB_FILE_HANDLE lHFB_OpenFile(
+ const char *fileName,
+ HFB_BUFFER_HANDLE bufferHandle,
+ unsigned int userData
+ );
+
+/* the following three functions, findfile, parsefile and loadindex,
+ are encapsulated by openfile, they are provided as a convenience
+ for use on systems with asynchronous i/o */
+
+//HFB_FILE_HANDLE lHFB_FindFile(const char *fileName, unsigned int userData);
+
+int lHFB_ParseFile(
+ HFB_FILE_HANDLE fileHandle,
+ HFB_BUFFER_HANDLE bufferHandle
+ );
+
+int lHFB_LoadIndex(
+ HFB_FILE_HANDLE fileHandle,
+ HFB_BUFFER_HANDLE bufferHandle
+ );
+
+void lHFB_CloseFile(HFB_FILE_HANDLE fHnd);
+
+HFB_FILE_INFO *lHFB_GetFileInfo(HFB_FILE_HANDLE fileHandle);
+
+HFB_BUFFER_HANDLE lHFB_CreateBuffer(
+ int sizeOfBuffer,
+ int reserved
+ );
+
+void lHFB_InitBuffer(
+ HFB_BUFFER_HANDLE bufferHandle,
+ HFB_FILE_HANDLE fileToLoad,
+ int startFrame,
+ int initialReadSize
+ );
+
+int lHFB_FillBuffer(
+ HFB_BUFFER_HANDLE bufferHandle,
+ int maxToRead,
+ int frameSyncCounter
+ );
+
+void lHFB_DestroyBuffer(HFB_BUFFER_HANDLE bufferHandle);
+
+void lHFB_ResetStreams(HFB_BUFFER_HANDLE bufferHandle);
+
+int lHFB_SetBufferMode(
+ HFB_BUFFER_HANDLE ,
+ hfbBufferMode mode
+ );
+
+int lHFB_GetBufferPerCentFull(HFB_BUFFER_HANDLE );
+int lHFB_GetmovieSize(HFB_BUFFER_HANDLE );
+int lHFB_GetBufferSpace(HFB_BUFFER_HANDLE );
+hfbBufferStatus lHFB_GetBufferStatus(HFB_BUFFER_HANDLE );
+
+int lHFB_ConditionBuffer(
+ HFB_BUFFER_HANDLE bufferHandle,
+ int bufferSize,
+ int reserved);
+
+#define lHFB_ResetBuffer lHFB_ConditionBuffer
+
+/* get a stream reference handle */
+HFB_STREAM_HANDLE lHFB_GetStream(
+ HFB_FILE_HANDLE fileHandle,
+ const char *StreamNameOrNull,
+ int streamNumber,
+ unsigned int streamType);
+
+/* relinquish reference to stream */
+void lHFB_ReleaseStream(HFB_STREAM_HANDLE streamHandle);
+
+/* get a pointer to stream info struct */
+HFB_STREAM_INFO *lHFB_GetStreamInfo(HFB_STREAM_HANDLE );
+
+#define lHFB_GetStreamLength(strmh) \
+ lHFB_GetStreamInfo(strmh)->lLength
+
+#define lHFB_GetStreamName(strmh) \
+ lHFB_GetStreamInfo(strmh)->szName
+
+/* get pointer to buffered record and length */
+HFB_DATA_HANDLE lHFB_GetStreamingData(
+ HFB_STREAM_HANDLE streamHandle,
+ void **ptrToPtr,
+ int *ptrToLength,
+ hfbDirection directionToMove,
+ int framesToMove
+ );
+
+/* release buffer space occupied by record */
+void lHFB_ReleaseStreamingData(
+ HFB_BUFFER_HANDLE bufferHandle,
+ HFB_DATA_HANDLE recordToRelease);
+
+/* read data directly from a file into a
+ supplied buffer, limit is set by initial value
+ of *ptrToLength */
+int lHFB_ReadData(
+ HFB_STREAM_HANDLE streamHandle,
+ void *ptrToBuffer,
+ int *ptrToLength,
+ hfbDirection directionToMove,
+ int framesToMove);
+
+int lHFB_FramestoNextKeyFrame(
+ HFB_STREAM_HANDLE streamHandle,
+ int recordHandle,
+ int *numberOfRecordsSpanned
+ );
+
+int lHFB_FrameToChunk(
+ HFB_STREAM_HANDLE streamHandle,
+ int frameNumber
+ );
+
+/* get the frameNumber of the keyframe
+ at or prior to the specified frameNumber */
+int lHFB_PreviousKeyFrame(
+ HFB_STREAM_HANDLE streamHandle,
+ int frameNumber
+ );
+
+/* get the HFB index flags for the specified record/frame */
+
+int lHFB_GetIndexFlags(
+ HFB_STREAM_HANDLE ,
+ hfbFrameNumber frameNumberType,
+ int recordHandleOrFrameNumber);
+
+/* add the HFB index flags for the specified record/frame */
+
+int lHFB_AddIndexFlags(
+ HFB_STREAM_HANDLE ,
+ hfbFrameNumber frameNumberType,
+ int recordHandleOrFrameNumber,
+ int flagsToAdd);
+
+
+/* get current data position
+ video - frameNumber
+ audio - sampleCount */
+int lHFB_GetDataPosition(
+ HFB_STREAM_HANDLE streamHandle,
+ HFB_DATA_HANDLE dataRecordHandle
+ );
+
+/* get information about audio stream */
+DKWAVEFORM *lHFB_GetAudioInfo(
+ HFB_STREAM_HANDLE nStream,
+ int *NumChannels,
+ int *SamplesPerSec,
+ int *BytesPerSec,
+ int *wFormat);
+
+/* get the amount of audio skew
+ expressed in records */
+int lHFB_GetInitialFrames(
+ HFB_STREAM_HANDLE videoStream,
+ HFB_STREAM_HANDLE audioStream
+ );
+
+/* get the number of audio frames elapsed
+ during a single video frame */
+int lHFB_GetSamplesPerFrame(
+ HFB_STREAM_HANDLE videoStream,
+ HFB_STREAM_HANDLE audioStream
+ );
+
+/* get video frame rate and
+ calculated audio skew (in audio samples) */
+void lHFB_GetFrameRates(
+ HFB_STREAM_HANDLE videoStream,
+ HFB_STREAM_HANDLE audioStream,
+ int *ptrToIntegerFrameRate,
+ int *ptrToEstimatedAudioSampleSkew);
+
+/* */
+int lHFB_GetDRMData(
+ HFB_FILE_HANDLE dckPtr,
+ unsigned int* pOutEncFourCC,
+ int* pOutLength,
+ unsigned char** ppOutData);
+
+
+/*get pointer to stream information streuct */
+HFB_STREAM_INFO *lHFB_GetStreamInfo(HFB_STREAM_HANDLE );
+
+/* functions to retrieve parent buffer
+ and file of a given stream*/
+HFB_BUFFER_HANDLE lHFB_GetStreamParentBuffer(HFB_STREAM_HANDLE );
+HFB_FILE_HANDLE lHFB_GetStreamParentFile(HFB_STREAM_HANDLE);
+
+/* used to precisely calculate rational frame rates
+ for a specific stream */
+void lHFB_GetStreamRateAndScale(
+ HFB_STREAM_HANDLE xStream,
+ int *rate, int *scale
+ );
+
+/* get stream type and handler fourCC codes,
+ returns type (not handler) */
+unsigned int lHFB_GetStreamFCCs(
+ HFB_STREAM_HANDLE xStream,
+ unsigned int *type,
+ unsigned int *handler
+ );
+
+/* get the last error that occured in HFB */
+int lHFB_GetLastError(
+ HFB_BUFFER_HANDLE bfHnd,
+ int* lastErrorCode,
+ char errorString[],
+ size_t maxLen
+ );
+
+/* get streamSampleSize, <= 0 means variable */
+int lHFB_GetStreamSampleSize(HFB_STREAM_HANDLE xStream);
+
+int lHFB_WhatsAhead(HFB_STREAM_HANDLE ,int ,int *);
+
+/* windows 95 dll system abstraction functions */
+
+void lHFB_Setmalloc(
+ void *(*mallocFuncPtr)(unsigned int size)
+ );
+
+void lHFB_Setcalloc(
+ void *(*callocFuncPtr)(unsigned int size, unsigned int number)
+ );
+
+void lHFB_Setfree(
+ void (*freeFuncPtr)(void *)
+ );
+
+void lHFB_Setopen(
+ int (*openFuncPtr)(const char *, int,...)
+ );
+
+void lHFB_Setclose(
+ int (*closeFuncPtr)(int)
+ );
+
+void lHFB_Setread(
+ int (*readFuncPtr)(int,void *, unsigned int)
+ );
+
+void lHFB_Setseek(
+ int (*seekFuncPtr)(int,int,int)
+ );
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif
+
+#endif
diff --git a/Src/libvp6/corelibs/include/testresults.h b/Src/libvp6/corelibs/include/testresults.h
new file mode 100644
index 00000000..81b92013
--- /dev/null
+++ b/Src/libvp6/corelibs/include/testresults.h
@@ -0,0 +1,24 @@
+#if !defined(_TestResults_h)
+#define _TestResults_h
+#include <string.h>
+#if defined(__cplusplus)
+extern "C" {
+#endif
+typedef struct TestResults_T
+{
+ char * results;
+ int testResultMaxLength;
+} TestResults;
+int GetTestResults( TestResults *T ,int argc, char *argv[]);
+const char * GetTestHelp(void);
+inline void StoreTestResult(TestResults *p, char *msg)
+{
+ if (p)
+ {
+ sprintf(&(p->results[strlen(p->results)]),"%s",msg);
+ }
+}
+#if defined(__cplusplus)
+}
+#endif
+#endif /* include guards */
diff --git a/Src/libvp6/corelibs/include/toolvox.h b/Src/libvp6/corelibs/include/toolvox.h
new file mode 100644
index 00000000..bdb83086
--- /dev/null
+++ b/Src/libvp6/corelibs/include/toolvox.h
@@ -0,0 +1,1188 @@
+/*****************************************************************************
+
+ Module ToolVox.H
+ The defines and prototypes for the Voxware voice compression
+ system.
+
+
+ Version 1.1.8.192
+ For MacOS, Windows 3.1, Windows95, and Solaris
+
+
+ Voxware Inc.
+ 305 College Road East
+ Princeton, New Jersey 08540
+ http://www.voxware.com
+
+
+ Voxware Proprietary Material
+ Copyright 1996, Voxware, Inc.
+ All Rights Resrved
+
+ DISTRIBUTION PROHIBITED without written authorization from Voxware
+
+*****************************************************************************/
+
+
+
+/*
+ !!! All reserved, padding, and optional fields should be set to zero if
+ !!! you are not using them. Please memset() all structures before using
+ !!! them.
+*/
+
+
+
+/*
+ You must "#define VOXWARE_xxx" for the environment you
+ are generating code for.
+
+ Valid types are:
+ VOXWARE_WIN16 <-- Windows 3.x
+ VOXWARE_WIN32 <-- Windows 95 or Windows NT
+ VOXWARE_DOS <-- MS-DOS
+ VOXWARE_MAC <-- MacOS
+ VOXWARE_SUN <-- SunOS/Solaris
+ VOXWARE_HP <-- HPUX (Version 9.xx)
+ VOXWARE_AIX <-- IBM's AIX
+*/
+
+
+
+
+#ifndef __TOOLVOX_H_
+#define __TOOLVOX_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+#ifndef VOXWARE_SUN
+ #ifdef VOXWARE_MAC
+ #include <ConditionalMacros.h>
+ #endif
+ #if PRAGMA_ALIGN_SUPPORTED
+ #pragma options align=mac68k
+ #elif VOXWARE_HP
+ #pragma HP_ALIGN HPUX_WORD
+ #else
+ #pragma pack(2)
+ #endif
+#endif
+
+
+
+// DAVE: THIS SHOULD PROBABLY BE IN THIS FILE INSTEAD OF ITS OWN HDR. -GEO
+#include "voxchunk.h"
+
+/* Value returned from a ToolVox function call. See ToolVox manual for a */
+/* list of specific return codes for each function. */
+typedef unsigned short VOXWARE_RETCODE;
+
+
+
+/* We support VOXWARE_WIN for backwards compatibility. Use VOXWARE_WIN16. */
+#if defined (VOXWARE_WIN)
+ #define VOXWARE_WIN16
+#endif
+
+#if defined (VOXWARE_WIN16)
+ #define VOX_FAR __far
+ #define VOX_EXPORT __export
+ #define VOX_PASCAL __pascal
+ #define VOXAPI VOX_FAR VOX_PASCAL
+
+ #ifdef __cplusplus
+ #define VOXAPI_CALLBACK VOX_FAR __pascal
+ #else
+ #define VOXAPI_CALLBACK VOX_FAR __pascal __loadds
+ #endif
+
+
+#elif defined(VOXWARE_WIN32)
+ #define VOX_FAR
+ #define VOX_EXPORT
+ #define VOX_PASCAL __stdcall
+ #define VOXAPI VOX_PASCAL
+ #define VOXAPI_CALLBACK __stdcall
+
+
+#elif defined(VOXWARE_MAC)
+ #define VOX_FAR
+ #define VOX_EXPORT
+ #define VOX_PASCAL pascal
+ #define VOXAPI VOX_PASCAL
+ #define VOXAPI_CALLBACK VOX_PASCAL
+
+
+#elif defined(VOXWARE_SUN)
+#if defined(VOXWARE_SGI) || defined(VOXWARE_DEC)
+ #define VOX_FAR
+ #define VOX_EXPORT
+ #define VOX_PASCAL
+ #define VOXAPI
+ #define VOXAPI_CALLBACK short
+#else
+ #define VOX_FAR
+ #define VOX_EXPORT
+ #define VOX_PASCAL
+ #define VOXAPI
+ #define VOXAPI_CALLBACK
+#endif
+
+#elif defined(VOXWARE_DOS)
+ #define VOX_FAR __far
+ #define VOX_EXPORT
+ #define VOX_PASCAL pascal
+ #define VOXAPI VOX_PASCAL
+ #define VOXAPI_CALLBACK VOX_PASCAL
+
+#else
+ #pragma message ("TOOLVOX.H: Platform indicator #define not setup.")
+ #pragma message ("TOOLVOX.H: One of the following must be initialized:")
+ #pragma message ("TOOLVOX.H: #define VOXWARE_WIN16")
+ #pragma message ("TOOLVOX.H: #define VOXWARE_WIN32")
+ #pragma message ("TOOLVOX.H: #define VOXWARE_MAC")
+ #pragma message ("TOOLVOX.H: #define VOXWARE_SUN")
+ #pragma message ("TOOLVOX.H: #define VOXWARE_DOS")
+ #pragma message ("TOOLVOX.H: Check the Voxware manual for more information.")
+
+#endif
+
+
+
+/*****************************************************************************
+** **
+** The data structures that will be passed to the ToolVox functions. **
+** **
+*****************************************************************************/
+
+
+
+typedef struct tagVOX_ENVIRONMENT
+{
+ unsigned short wSizeofVoxEnvironment; /* --> Fill this in for us */
+ unsigned short wCompatibility; /* <-- versioning */
+ unsigned long dwAPIVersionNumber; /* <-- Version of API */
+ unsigned long dwAPIMaintanceNumber; /* <-- Maint Rel of API */
+ unsigned short wNumCodecs; /* <-- Number of CODECS avail. */
+ unsigned short wNumVoiceFonts; /* <-- Number of VoiceFonts */
+ char szAPIName[32]; /* <-- ToolVox For MacOS 1.1.5 */
+} VOX_ENVIRONMENT;
+
+typedef VOX_ENVIRONMENT VOX_FAR * LPVOX_ENVIRONMENT;
+
+
+
+
+
+typedef struct tagVOXWARE_DATA
+{
+ unsigned short wSizeOfVoxwareData; /* The size of this structure */
+
+ unsigned short wUserData; /* Application dependent data */
+ /* ...(16 bit). */
+ unsigned long dwUserData; /* Application dependent data */
+ /* (32 bit). */
+
+ /* Buffer information required for (de)compressing between buffers <-> */
+ /* disk. */
+ unsigned long dwInputType; /* What is stored in the */
+ /* ...'lpInputLocation' field. */
+ void VOX_FAR *lpInputLocation; /* Pointer to a filename or */
+ /* ...buffer. */
+
+ unsigned long dwInputSize; /* Inform Voxware about the */
+ /* ...buffer size. */
+ unsigned long dwInputPosition; /* Input data offset info. */
+
+ unsigned long dwInputSamplingRate; /* Number of samples per second.*/
+ unsigned short wInputBytesPerSample; /* Number of bytes per sample. */
+
+
+ unsigned long dwOutputType; /* What is stored in the */
+ /* ...'lpOutputLocation' field. */
+ void VOX_FAR *lpOutputLocation; /* Pointer to filename, buffer, */
+ /* ...or empty for playback. */
+
+ unsigned long dwOutputSize; /* Inform Voxware about the */
+ /* ...buffer size. */
+ unsigned long dwOutputPosition; /* Output data offset info. */
+
+ unsigned long dwOutputSamplingRate; /* Number of samples per second.*/
+ unsigned short wOutputBytesPerSample;/* Number of bytes per sample. */
+
+
+ /* The decompression routines will use the following for voice effects: */
+ unsigned short bUseAbsolutePitchFlag;/* TRUE if fPitchChange is to */
+ /* ...be used; FALSE is for */
+ /* ...fPitchShift usage. */
+ float fRelativePitch; /* Relative PitchShift factor. */
+ float fAbsolutePitch; /* Absolute PitchShift value. */
+ float fWarpedLengthFactor; /* Warping factor */
+ /* ...0.2<factor<5.0 (a value */
+ /* ...of 1.0 = normal time) */
+ void VOX_FAR *lpVoiceFont; /* VoiceFont used for playback. */
+
+ unsigned long dwVoiceFontEnum; /* Data used for enumeration of */
+ /* ...VoiceFonts. */
+
+ /* This is a more detailed value that can help track down errors. */
+ signed long dwSecondaryReturnCode;
+
+ unsigned long dwDataLeft; /* Amount of data to process. */
+
+ /* A callback function that the effects routines will call. */
+ void VOX_FAR *lpCallbackFunc;
+
+ void VOX_FAR *lpvControlBlock; /* Private control block used */
+ /* ...by Voxware. */
+
+ /* New fields for ToolVox version 1.1.0. */
+
+ unsigned long dwCompressionSettings;/* Choose the compression codec.*/
+
+ unsigned long dwStatus; /* Status of ToolVox engine. */
+
+ unsigned short wVoiceFontType; /* Unused. Set to zero. */
+
+ unsigned short bUseAbsoluteGainFlag; /* true if fGainControl is used */
+ float fRelativeGain; /* decompression only */
+ /* Multimedia Codecs Only */
+ /* 1.0 is normal */
+ /* greater than 1 is louder */
+ /* less than 1 is softer */
+ float fAbsoluteGain; /* decompression only */
+ signed short wCurrentEnergyLevel; /* 0..255; > 200 = clipping */
+
+ unsigned short padding3; /* Unused. Set to zero. */
+
+ void VOX_FAR *lpReservedFunction; /* reserved 1 */
+ void VOX_FAR *lpReservedVars; /* reserved 2 */
+
+ void VOX_FAR *lpMarkerRecord; /* reserved */
+
+//###GTT - Added support for communication of info chunks - 5/30/96
+ VOX_CHUNK_INFO VOX_FAR *lpInfoChunks;
+ short wNumInfoChunks;
+ short bV1Compatible;
+
+ unsigned short wVoiceFontID; /* Used to activate a VoiceFont */
+
+ void VOX_FAR * lpPlaybackWindow;
+
+ unsigned short wNumBitsPerFrame;
+
+} VOXWARE_DATA;
+
+typedef VOXWARE_DATA VOX_FAR * LPVOXWARE_DATA;
+
+
+
+
+
+typedef struct tagVOX_VERSION
+{
+ /* The version and internal name for the ToolVox Compression DLL. */
+ unsigned char szCompressVersion[64];
+ unsigned char szCompressInternal[32];
+
+ /* The version and maintenance for the ToolVox Compression DLL. */
+ /* For example: 1.30.46.01 */
+ unsigned long dwCompressVersion; /* e.g. 0x00010030 = "01.30" */
+ unsigned long dwCompressMaint; /* e.g. 0x00460001 = "46.01" */
+
+
+ /* The version and internal name for the ToolVox Decompression DLL. */
+ unsigned char szDecompressVersion[64];
+ unsigned char szDecompressInternal[32];
+
+ /* The version and maintenance for the ToolVox Decompression DLL. */
+ /* For example: 1.30.46.01 */
+ unsigned long dwDecompressVersion; /* e.g. 0x00010030 = "01.30" */
+ unsigned long dwDecompressMaint; /* e.g. 0x00460001 = "46.01" */
+
+
+ /* The version and internal name for the ToolVox VoiceFont DLL. */
+ unsigned char szVoiceFontVersion[64];
+ unsigned char szVoiceFontInternal[32];
+
+ /* The version and maintenance for the ToolVox VoiceFont DLL. */
+ /* For example: 1.30.46.01 */
+ unsigned long dwVoiceFontVersion; /* e.g. 0x00010030 = "01.30" */
+ unsigned long dwVoiceFontMaint; /* e.g. 0x00460001 = "46.01" */
+
+
+ /* The version and internal name for the ToolVox Utility DLL. */
+ unsigned char szUtilityVersion[64];
+ unsigned char szUtilityInternal[32];
+
+ /* The version and maintenance for the ToolVox Utility DLL. */
+ /* For example: 1.30.46.01 */
+ unsigned long dwUtilityVersion; /* e.g. 0x00010030 = "01.30" */
+ unsigned long dwUtilityMaint; /* e.g. 0x00460001 = "46.01" */
+
+
+ /* The version and internal name for the ToolVox RT24 Compression DLL. */
+ unsigned char szRT24CompressVersion[64];
+ unsigned char szRT24CompressInternal[32];
+
+ /* The version and maintenance for the ToolVox RT24 Compression DLL. */
+ /* For example: 1.30.46.01 */
+ unsigned long dwRT24CompressVersion; /* e.g. 0x00010030 = "01.30" */
+ unsigned long dwRT24CompressMaint; /* e.g. 0x00460001 = "46.01" */
+
+
+ /* The version and internal name for the ToolVox RT24 Decompression DLL.*/
+ unsigned char szRT24DecompressVersion[64];
+ unsigned char szRT24DecompressInternal[32];
+
+ /* The version and maintenance for the ToolVox RT24 Decompression DLL. */
+ /* For example: 1.30.46.01 */
+ unsigned long dwRT24DecompressVersion; /* e.g. 0x00010030 = "01.30" */
+ unsigned long dwRT24DecompressMaint; /* e.g. 0x00460001 = "46.01" */
+
+} VOX_VERSION;
+
+typedef VOX_VERSION VOX_FAR * LPVOX_VERSION;
+
+
+
+typedef struct tagVOX_FILE_INFO
+{
+ /* Some standard WAV, AIFF, and VOX file data. */
+ unsigned short wFormatTag; /* WAVE_FORMAT_VOXWARE for com- */
+ /* ...pressed or WAVE_FORMAT_PCM */
+ /* ...for standard files. */
+ unsigned short nChannels; /* Set to the value */
+ /* ...VOXWARE_WAVE_FILE_MONO or */
+ /* ...VOXWARE_WAVE_FILE_STEREO. */
+ unsigned long nAvgBitsPerSec; /* The bit rate of this file. */
+ unsigned long dwSamplingRate;
+ unsigned short wBytesPerSample;
+ unsigned long dwNumSamplesInFile; /* The total number of samples in */
+ /* ...the file. */
+
+ float fMeanPitch; /* Weighted average pitch of the */
+ /* ...Vox file. */
+ float fMinPitch; /* Lowest pitch value of the file. */
+ float fMaxPitch; /* Highest pitch value of the file. */
+
+//###lee - split this out into a new structure:
+ unsigned long dwCompressedSize; /* One is estimated, and the other */
+ unsigned long dwDecompressedSize; /* ...is the current size. */
+
+ unsigned short bVariableRate; /* TRUE if codec is variable rate. */
+
+} VOX_FILE_INFO;
+
+typedef VOX_FILE_INFO VOX_FAR * LPVOX_FILE_INFO;
+
+
+
+typedef struct tagVFONT_IDENTIFIER
+{
+ /* Used for vfontEnumerate calls. */
+ char szFontName[32];
+ char szFontFile[128];
+
+} VFONT_IDENTIFIER;
+
+typedef VFONT_IDENTIFIER VOX_FAR * LPVFONT_IDENTIFIER;
+
+
+
+typedef struct tagCODEC_DESCRIPTION
+{
+ unsigned long dwCodecID;
+ char szCodecInternalName[44];
+ char szCodecListBoxName[44];
+ char szCodecDescription[256];
+} CODEC_DESCRIPTION;
+
+typedef CODEC_DESCRIPTION VOX_FAR * LPCODEC_DESCRIPTION;
+
+
+
+typedef struct tagVOICE_FONT_DESCRIPTION
+{
+ unsigned short wFontID;
+ char szFontFamily[44];
+ char szFontName[44];
+ char szFontDescription[256];
+ unsigned short bHasDecodeEffect;
+ unsigned short wSizeofDecodeChunk;
+} VOICE_FONT_DESCRIPTION;
+
+typedef VOICE_FONT_DESCRIPTION VOX_FAR * LPVOICE_FONT_DESCRIPTION;
+
+
+
+typedef struct tagVOX_FUNCTION_VARS
+{
+ unsigned short wSizeOfFunctionVars; /* The size of this structure */
+
+ void VOX_FAR *lpBuffer; /* Pointer to a the data buffer.*/
+ unsigned long dwBufferSize; /* The size of the buffer. */
+
+ unsigned long dwUserData; /* Application dependent data */
+ /* (32 bit). */
+
+ LPVOXWARE_DATA lpVoxwareData; /* The original VoxawareData */
+ /* used to start processing. */
+
+} VOX_FUNCTION_VARS;
+
+
+typedef VOX_FUNCTION_VARS VOX_FAR * LPVOX_FUNCTION_VARS;
+
+
+/*
+ For use with BitStreams
+*/
+
+typedef struct tagVOX_STREAM_HEADER
+{
+ unsigned long dwHeaderID;
+ unsigned short wSizeOfVoxStreamHeader;
+ unsigned char voxStreamHeaderData[1]; // variable length
+} VOX_STREAM_HEADER;
+
+typedef VOX_STREAM_HEADER VOX_FAR * LPVOX_STREAM_HEADER;
+
+
+
+typedef struct tagFIRST_BITSTREAM_BUFFER
+{
+ unsigned short wSizeOfFirstBitStreamStruct;
+ unsigned short wNumBitsPerFrame;
+ unsigned short wNumSamplesPerFrame;
+ unsigned short wPadding;
+ VOX_STREAM_HEADER voxStreamHeader; /* Send this to the decoder */
+} FIRST_BITSTREAM_BUFFER;
+
+
+typedef FIRST_BITSTREAM_BUFFER VOX_FAR * LPFIRST_BITSTREAM_BUFFER;
+
+
+
+/*
+ VOX_CALLBACK is a typedef for the user function that is called by the
+ ToolVox compression and decompression routines.
+
+ Special Note for Macintosh Developers:
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ Do >> NOT << give us a Universal Procedure Pointer.
+ We make our own so you don't have to... (your welcome)
+ Sooo just give us the functions name:
+ yourVoxData->lpCallbackFunc = myCallbackProc;
+*/
+#ifdef VOXWARE_MAC
+ typedef VOXAPI_CALLBACK VOXWARE_RETCODE (* VOX_CALLBACK)
+ (unsigned short wVox, unsigned short wMessage,
+ LPVOXWARE_DATA lpVoxData);
+#else
+#if defined(VOXWARE_SGI) || defined(VOXWARE_DEC)
+ typedef VOXWARE_RETCODE ( * VOX_CALLBACK) (unsigned short , unsigned short , LPVOXWARE_DATA );
+
+#else
+ typedef VOXWARE_RETCODE (VOXAPI_CALLBACK * VOX_CALLBACK)
+ (unsigned short wVox, unsigned short wMessage,
+ LPVOXWARE_DATA lpVoxData);
+#endif
+#endif
+
+
+typedef struct tagVOX_COMMAND
+{
+ unsigned long dwAttribute; /* Attribute to act on? */
+ float fFloatParam; /* Use this for float attributes. */
+ unsigned long dwLongParam; /* Use this for long attributes. */
+
+} VOX_COMMAND;
+
+typedef VOX_COMMAND VOX_FAR * LPVOX_COMMAND;
+
+
+#define ATTRIBUTE_WARPED_LENGTH_FACTOR 1L // get and set
+#define ATTRIBUTE_RELATIVE_PITCH 2L // get and set
+#define ATTRIBUTE_ABSOLUTE_PITCH 3L // get and set
+#define ATTRIBUTE_PLAY_TIME 5L // not yet supported
+#define ATTRIBUTE_VOICE_FONT 6L // set only
+#define ATTRIBUTE_GAIN_CONTROL 7L // get and set
+#define ATTRIBUTE_BITS_PER_SECOND 8L // not yet supported
+#define ATTRIBUTE_FIXED_RATE_CODEC 9L // not yet supported
+
+
+
+#define ATTRIBUTE_DUMP_BUFFERS 0x80000 + 1L // RESERVED: bit bit offset is param
+#define ATTRIBUTE_SILENT_WINDOW 0x80000 + 2L // RESERVED: get set dwLongParam = WORD ms
+#define ATTRIBUTE_INDICATE_LOST_FRAME 0x80000 + 3L // RESERVED: set dwLongParam = BOOL
+#define ATTRIBUTE_VOICE_LEVEL 0x80000 + 4L // RESERVED: get set dwLongParam = WORD Value
+#define ATTRIBUTE_VOICE_STATE 0x80000 + 5L // RESERVED: get dwLongParam = int Value
+//#define ATTRIBUTE_VOICE_FONT_II 0x80000 + 6L // RESERVED: set dwLongParam = short EffectSelection - fFloatParam = short SliderValue
+//#define ATTRIBUTE_VOICE_EFFECT 0x80000 + 7L // RESERVED: set dwLongParam = short EffectSelection - fFloatParam = short SliderValue
+#define ATTRIBUTE_BIT_OFFSET 0x80000 + 8L // RESERVED: set
+#define ATTRIBUTE_GAIN_CONTROL_ADJUST 0x80000 + 6L // RESERVED: get dwLongParam = signed short Value
+#define ATTRIBUTE_AGC_REFERENCE_LEVEL 0x80000 + 7L // RESERVED: set dwLongParam = unsigned short Value
+
+
+
+
+
+
+/*****************************************************************************
+**
+** lpVoxwareData->dwCompressionSettings = VOXWARE_CODEC_xxx
+**
+** Not filling in the dwCompressionSettings field, or setting it to default
+** tells ToolVox to compress what you gave it using the best codec for the
+** job. If you give us a 11k-16k file, we will chose the MM_11k codec, if
+** you give us a 22k or better file, we will choose the MM_22k codec, etc...
+**
+** If you assign one of the values below to the dwCompressionSettings field,
+** then we will send your file through the codec you asked us to.
+**
+** Refer to page ###Maija: of the manual for more.
+**
+*****************************************************************************/
+
+#define VOXWARE_CODEC_RT_8K 0x01000001
+#define VOXWARE_CODEC_RT_8K_HQ29 0x01000010
+
+#define VOXWARE_CODEC_RT_8K_HQ24 0x01000004 // Do not use - unavailable for this release.
+#define VOXWARE_CODEC_RT_8K_VR12 0x01000008 // Do not use - unavailable for this release.
+#define VOXWARE_CODEC_RT_8K_VR15 0x01000009 // Do not use - unavailable for this release.
+#define VOXWARE_CODEC_RT_8K_UQ 0x0100000C // Do not use - unavailable for this release.
+#define VOXWARE_CODEC_MM_11K 0x02000002 // Do not use - unavailable for this release.
+#define VOXWARE_CODEC_MM_22K 0x04000002 // Do not use - unavailable for this release.
+
+#define VOXWARE_CODEC_DEFAULT 0x00000000
+#define VOXWARE_CODEC_RT24 VOXWARE_CODEC_RT_8K // obs spelling
+
+/*Add for AUDIO codec*/
+#define VOXWARE_CODEC_AC_8K 0X08000001
+#define VOXWARE_CODEC_AC_11K 0X08000002
+#define VOXWARE_CODEC_AC_16K 0X08000003
+#define VOXWARE_CODEC_AC_22K 0X08000004
+
+/* These are provided for backwards compatibility The #define's above should be used. */
+#define VOXWARE_AUDIO_CODEC_08 VOXWARE_CODEC_AC_8K
+#define VOXWARE_AUDIO_CODEC_11 VOXWARE_CODEC_AC_11K
+#define VOXWARE_AUDIO_CODEC_16 VOXWARE_CODEC_AC_16K
+#define VOXWARE_AUDIO_CODEC_22 VOXWARE_CODEC_AC_22K
+
+/*****************************************************************************
+**
+** These are used to define the input and output types. They should be ORed
+** together to create the type that is needed. For example compressing
+** a Windows Wave file would use VOXTYPE_FORMAT_WAVE|VOXTYPE_LOCATION_FILE.
+** To specify the compressed output Wave file, use: VOXTYPE_FORMAT_WAVE|
+** VOXTYPE_LOCATION_FILE|VOXTYPE_QUALIFIER_VOX.
+**
+*****************************************************************************/
+
+//#define VOXTYPE_FORMAT_IRRELEVENT (unsigned long)(0x00000000L)
+#define VOXTYPE_FORMAT_WAVE (unsigned long)(0x00010000L)
+#define VOXTYPE_FORMAT_RAW (unsigned long)(0x00020000L)
+#define VOXTYPE_FORMAT_AIFF (unsigned long)(0x00030000L)
+#define VOXTYPE_FORMAT_VFONT (unsigned long)(0x00040000L)
+#define VOXTYPE_FORMAT_PITCH (unsigned long)(0x00050000L)
+
+#define VOXTYPE_LOCATION_FILE (unsigned long)(0x00000100L)
+#define VOXTYPE_LOCATION_BUFFER (unsigned long)(0x00000200L)
+#define VOXTYPE_LOCATION_FSSPEC (unsigned long)(0x00000300L)
+#define VOXTYPE_LOCATION_SOUND (unsigned long)(0x00000400L)
+#define VOXTYPE_LOCATION_FUNCTION (unsigned long)(0x00000800L)
+#define VOXTYPE_LOCATION_STRING (unsigned long)(0x00001000L)
+#define VOXTYPE_LOCATION_BITSTREAM (unsigned long)(0x00001100L)
+#define VOXTYPE_LOCATION_VOICE_FONT_ID (unsigned long)(0x00001200L)
+
+#define VOXTYPE_QUALIFIER_PCM (unsigned long)(0x00000000L)
+#define VOXTYPE_QUALIFIER_VOX (unsigned long)(0x00000001L)
+#define VOXTYPE_QUALIFIER_PITCH (unsigned long)(0x00000002L)
+//#define VOXTYPE_QUALIFIER_ASYNC (unsigned long)(0x00000004L)
+
+#define VOXTYPE_CONST_FILE_INFO (unsigned long)(0x10000000L)
+#define VOXTYPE_CONST_VERSION (unsigned long)(0x20000000L)
+#define VOXTYPE_CONST_BENCHMARK (unsigned long)(0x40000000L)
+
+#define VOXTYPE_FORMAT_MASK (unsigned long)(0x000F0000L)
+#define VOXTYPE_LOCATION_MASK (unsigned long)(0x0000FF00L)
+
+#define VOXTYPE_VFONT_FILENAME (unsigned long)(VOXTYPE_FORMAT_VFONT|VOXTYPE_LOCATION_FILE)
+#define VOXTYPE_VFONT_DESCRIPTION (unsigned long)(VOXTYPE_FORMAT_VFONT|VOXTYPE_LOCATION_STRING)
+#define VOXTYPE_VFONT_IDENTIFIER (unsigned long)(VOXTYPE_FORMAT_VFONT|VOXTYPE_LOCATION_BUFFER)
+
+
+
+/*
+ The following constants can be used in the dwOutputType and dwInputType
+ fields of the VoxwareData structure instead of ORing the flags above...
+*/
+#define TYPE_WAVE_PCM_FILE (unsigned long)(VOXTYPE_FORMAT_WAVE|VOXTYPE_LOCATION_FILE|VOXTYPE_QUALIFIER_PCM)
+#define TYPE_AIFF_PCM_FILE (unsigned long)(VOXTYPE_FORMAT_AIFF|VOXTYPE_LOCATION_FILE|VOXTYPE_QUALIFIER_PCM)
+#define TYPE_RAW_PCM_FILE (unsigned long)(VOXTYPE_FORMAT_RAW|VOXTYPE_LOCATION_FILE|VOXTYPE_QUALIFIER_PCM)
+
+#define TYPE_WAVE_PCM_FSSPEC (unsigned long)(VOXTYPE_FORMAT_WAVE|VOXTYPE_LOCATION_FSSPEC|VOXTYPE_QUALIFIER_PCM)
+#define TYPE_AIFF_PCM_FSSPEC (unsigned long)(VOXTYPE_FORMAT_AIFF|VOXTYPE_LOCATION_FSSPEC|VOXTYPE_QUALIFIER_PCM)
+#define TYPE_RAW_PCM_FSSPEC (unsigned long)(VOXTYPE_FORMAT_RAW|VOXTYPE_LOCATION_FSSPEC|VOXTYPE_QUALIFIER_PCM)
+
+#define TYPE_WAVE_PCM_BUFFER (unsigned long)(VOXTYPE_FORMAT_WAVE|VOXTYPE_LOCATION_BUFFER|VOXTYPE_QUALIFIER_PCM)
+#define TYPE_AIFF_PCM_BUFFER (unsigned long)(VOXTYPE_FORMAT_AIFF|VOXTYPE_LOCATION_BUFFER|VOXTYPE_QUALIFIER_PCM)
+#define TYPE_RAW_PCM_BUFFER (unsigned long)(VOXTYPE_FORMAT_RAW|VOXTYPE_LOCATION_BUFFER|VOXTYPE_QUALIFIER_PCM)
+
+#define TYPE_WAVE_PCM_FUNCTION (unsigned long)(VOXTYPE_FORMAT_WAVE|VOXTYPE_LOCATION_FUNCTION|VOXTYPE_QUALIFIER_PCM)
+#define TYPE_AIFF_PCM_FUNCTION (unsigned long)(VOXTYPE_FORMAT_AIFF|VOXTYPE_LOCATION_FUNCTION|VOXTYPE_QUALIFIER_PCM)
+#define TYPE_RAW_PCM_FUNCTION (unsigned long)(VOXTYPE_FORMAT_RAW|VOXTYPE_LOCATION_FUNCTION|VOXTYPE_QUALIFIER_PCM)
+
+
+#define TYPE_WAVE_VOX_FILE (unsigned long)(VOXTYPE_FORMAT_WAVE|VOXTYPE_LOCATION_FILE|VOXTYPE_QUALIFIER_VOX)
+//#define TYPE_AIFF_VOX_FILE (unsigned long)(VOXTYPE_FORMAT_AIFF|VOXTYPE_LOCATION_FILE|VOXTYPE_QUALIFIER_VOX)
+#define TYPE_RAW_VOX_FILE (unsigned long)(VOXTYPE_FORMAT_RAW|VOXTYPE_LOCATION_FILE|VOXTYPE_QUALIFIER_VOX)
+
+#define TYPE_WAVE_VOX_FSSPEC (unsigned long)(VOXTYPE_FORMAT_WAVE|VOXTYPE_LOCATION_FSSPEC|VOXTYPE_QUALIFIER_VOX)
+//#define TYPE_AIFF_VOX_FSSPEC (unsigned long)(VOXTYPE_FORMAT_AIFF|VOXTYPE_LOCATION_FSSPEC|VOXTYPE_QUALIFIER_VOX)
+#define TYPE_RAW_VOX_FSSPEC (unsigned long)(VOXTYPE_FORMAT_RAW|VOXTYPE_LOCATION_FSSPEC|VOXTYPE_QUALIFIER_VOX)
+
+#define TYPE_WAVE_VOX_BUFFER (unsigned long)(VOXTYPE_FORMAT_WAVE|VOXTYPE_LOCATION_BUFFER|VOXTYPE_QUALIFIER_VOX)
+#define TYPE_AIFF_VOX_BUFFER (unsigned long)(VOXTYPE_FORMAT_AIFF|VOXTYPE_LOCATION_BUFFER|VOXTYPE_QUALIFIER_VOX)
+#define TYPE_RAW_VOX_BUFFER (unsigned long)(VOXTYPE_FORMAT_RAW|VOXTYPE_LOCATION_BUFFER|VOXTYPE_QUALIFIER_VOX)
+
+#define TYPE_WAVE_VOX_FUNCTION (unsigned long)(VOXTYPE_FORMAT_WAVE|VOXTYPE_LOCATION_FUNCTION|VOXTYPE_QUALIFIER_VOX)
+#define TYPE_AIFF_VOX_FUNCTION (unsigned long)(VOXTYPE_FORMAT_AIFF|VOXTYPE_LOCATION_FUNCTION|VOXTYPE_QUALIFIER_VOX)
+#define TYPE_RAW_VOX_FUNCTION (unsigned long)(VOXTYPE_FORMAT_RAW|VOXTYPE_LOCATION_FUNCTION|VOXTYPE_QUALIFIER_VOX)
+
+#define TYPE_PLAY_WINMM (unsigned long)(VOXTYPE_LOCATION_SOUND|VOXTYPE_QUALIFIER_PCM)
+#define TYPE_PLAY_MAC (unsigned long)(VOXTYPE_LOCATION_SOUND|VOXTYPE_QUALIFIER_PCM)
+
+#define VOXTYPE_RECORD_PCM (unsigned long)(VOXTYPE_LOCATION_SOUND|VOXTYPE_QUALIFIER_PCM) // ###dave 03/25/96: added this
+
+#define TYPE_RAW_VOX_BITSTREAM (unsigned long)(VOXTYPE_FORMAT_RAW|VOXTYPE_LOCATION_BITSTREAM|VOXTYPE_QUALIFIER_VOX)
+
+#define VOX_VOICE_FONT_PREVIEW_ID (unsigned long)(VOXTYPE_FORMAT_WAVE|VOXTYPE_LOCATION_VOICE_FONT_ID|VOXTYPE_QUALIFIER_VOX)
+
+
+
+
+/*****************************************************************************
+**
+** Some defines that can be used with the ToolVox routines.
+**
+*****************************************************************************/
+
+/* This is the maximum filename size that can be used with the ToolVox */
+/* routines. Does not include the space for the NULL. */
+#define MAX_FILENAMESIZE 255 /* char szFile[MAX_FILENAMESIZE+1]; */
+
+#define WAVE_FORMAT_VOXWARE 0x0062
+// ###dave -lee we need to define _WAVE & _AIFF, and friends... (raw)
+
+#define VOXWARE_WAVE_FILE_MONO 1
+#define VOXWARE_WAVE_FILE_STEREO 2
+
+#define VOXWARE_SAMPLING_RATE_8K 8000L
+#define VOXWARE_SAMPLING_RATE_11K 11025L
+#define VOXWARE_SAMPLING_RATE_11127K 0x2B7745D1L /*11127.27273 khz */
+#define VOXWARE_SAMPLING_RATE_16K 16000L
+#define VOXWARE_SAMPLING_RATE_22K 22050L
+#define VOXWARE_SAMPLING_RATE_22254K 0x56EE8BA3L /*22254.54545 khz */
+#define VOXWARE_SAMPLING_RATE_32K 32000L
+#define VOXWARE_SAMPLING_RATE_44K 44100L
+
+#define VOXWARE_SAMPLING_INDEX_8K 0
+#define VOXWARE_SAMPLING_INDEX_11k 1
+#define VOXWARE_SAMPLING_INDEX_16K 2
+#define VOXWARE_SAMPLING_INDEX_22K 3
+#define VOXWARE_SAMPLING_INDEX_32K 4
+#define VOXWARE_SAMPLING_INDEX_44K 5
+#define VOXWARE_SAMPLING_INDEX_11127K 6
+#define VOXWARE_SAMPLING_INDEX_22254K 7
+
+
+#define VOXWARE_SAMPLING_INDEX_END (VOXWARE_SAMPLING_INDEX_22254K+1)
+#define VOXWARE_NUM_SAMPLING_RATES (VOXWARE_SAMPLING_INDEX_22254K+1)
+
+#define VOXWARE_SAMPLING_RATE_ARRAY {VOXWARE_SAMPLING_RATE_8K, \
+ VOXWARE_SAMPLING_RATE_11K, \
+ VOXWARE_SAMPLING_RATE_16K, \
+ VOXWARE_SAMPLING_RATE_22K, \
+ VOXWARE_SAMPLING_RATE_32K, \
+ VOXWARE_SAMPLING_RATE_44K, \
+ VOXWARE_SAMPLING_RATE_11127K,\
+ VOXWARE_SAMPLING_RATE_22254K,\
+ 0L}
+
+#define VOXWARE_SAMPLE_SIZE_8BIT 1
+#define VOXWARE_SAMPLE_SIZE_16BIT 2
+
+#define VOXWARE_SAMPLE_INDEX_8BIT 0
+#define VOXWARE_SAMPLE_INDEX_16BIT 1
+
+#define VOXWARE_SAMPLE_INDEX_END (VOXWARE_SAMPLE_INDEX_16BIT+1)
+#define VOXWARE_NUM_SAMPLE_SIZES (VOXWARE_SAMPLE_INDEX_16BIT+1)
+
+#define VOXWARE_SAMPLE_SIZE_ARRAY {VOXWARE_SAMPLE_SIZE_8BIT, \
+ VOXWARE_SAMPLE_SIZE_16BIT, \
+ 0L}
+
+
+
+/*****************************************************************************
+**
+** Some consts so you don't hard-coding anything!
+**
+*****************************************************************************/
+
+#define GAIN_ENERGY_LEVEL_CLIPPING (char) 200 /* You may be clipping if > */
+ /* ...this level. */
+#define GAIN_ENERGY_LEVEL_TOO_LOW (char) 150 /* Speaker should not go */
+ /* below this for very long.*/
+
+
+#define MAX_WARPED_LENGTH_FACTOR (float) 5.0
+#define MIN_WARPED_LENGTH_FACTOR (float) 0.2
+#define DEFAULT_WARPED_LENGTH_FACTOR (float) 1.0
+
+
+#define USE_ABSOLUTE_PITCH TRUE
+#define USE_RELATIVE_PITCH FALSE /* Default for bAbsolutePitchFlag */
+
+#define MAX_RELATIVE_PITCH (float) +24.0
+#define MIN_RELATIVE_PITCH (float) -24.0
+#define DEFAULT_RELATIVE_PITCH (float) 0.0
+
+#define MAX_ABSOLUTE_PITCH (float) 400.0
+#define MIN_ABSOLUTE_PITCH (float) 70.0
+
+
+#define USE_ABSOLUTE_GAIN TRUE
+#define USE_RELATIVE_GAIN FALSE /* Default for bUseAbsoluteGainFlag */
+
+#define MAX_RELATIVE_GAIN (float) +100.0
+#define MIN_RELATIVE_GAIN (float) -100.0
+#define DEFAULT_RELATIVE_GAIN (float) 0.0
+
+#define MAX_ABSOLUTE_GAIN (float) 255.0
+#define MIN_ABSOLUTE_GAIN (float) 0.0
+
+#define NO_VOICE_FONT NULL
+
+
+/* Assign the wVoiceFontType field to one of the following */
+#define VOICE_FONT_VERSION_ONE_POINTER (short) 0
+#define VOICE_FONT_BETA_2_STRUCT (short) 1
+
+
+
+/*
+ The manual say's that the minimum size buffer you should ever
+ pass in is 512 bytes. (Truth is, we don't need that much,
+ but since I haven't called by psychic friend yet... I don't
+ know what the future will hold -- :)
+*/
+#define VOX_MINIMUM_BUFFER_SIZE (unsigned long) 512
+
+
+
+/* Version format: vers.rel.maint.patch - this is version 1.1.8.192 */
+#define TOOLVOX_VERSION_NUMBER 0x00010001L
+#define TOOLVOX_MAINTENANCE_LEVEL 0x000800C0L
+
+/* The following are obsolete spellings - use the constants #defined above. */
+#define VOXWARE_VERSION TOOLVOX_VERSION_NUMBER
+#define VOXWARE_MAINT TOOLVOX_MAINTENANCE_LEVEL
+
+
+
+
+/*****************************************************************************
+**
+** Message values that are passed to the callback & the dwStatus field
+**
+*****************************************************************************/
+
+#define VOXWARE_PLAYBACKERROR 10
+#define VOXWARE_STARTCOMPRESS 11
+#define VOXWARE_ENDCOMPRESS 12
+#define VOXWARE_STARTDECOMPRESS 13
+#define VOXWARE_ENDDECOMPRESS 14
+#define VOXWARE_STARTPLAY 15
+#define VOXWARE_ENDPLAY 16
+//#define VOXWARE_STARTPITCH 17
+//#define VOXWARE_ENDPITCH 18
+#define VOXWARE_GETINFO 19
+#define VOXWARE_STARTRECORD 20 /* Added in Version 1.1 */
+#define VOXWARE_ENDRECORD 21 /* Added in Version 1.1 */
+#define VOXWARE_RECORDERROR 22 /* Added in Version 1.1 */
+#define VOXWARE_WAITING_TO_CLEANUP 23 /* Added in Version 1.1 */
+#define VOXWARE_PAUSED 24 /* Added in Version 1.2 */
+// ###lee: where is SOUNDOUT ??
+
+
+#define VOXWARE_FUNCTION_INIT 40 /* Added in Version 1.1 */
+#define VOXWARE_FUNCTION_READ 41 /* Added in Version 1.1 */
+#define VOXWARE_FUNCTION_WRITE 42 /* Added in Version 1.1 */
+#define VOXWARE_FUNCTION_CLEANUP 43 /* Added in Version 1.1 */
+
+
+
+/*****************************************************************************
+**
+** Messages that are sent to the FILTER function
+**
+*****************************************************************************/
+
+#define VOXWARE_FILTER_INIT 50
+#define VOXWARE_FILTER_PCM 51
+#define VOXWARE_FILTER_CLEANUP 52
+
+
+
+/*****************************************************************************
+**
+** Messages that are returned from the low level compress and decompress
+** functions.
+**
+*****************************************************************************/
+
+#define VOXWARE_NEED_MORE_INPUT_DATA 91
+#define VOXWARE_OUTPUT_BUFFER_FULL 92
+#define VOXWARE_USER_ABORTED 93
+#define VOXWARE_USER_PAUSED 94
+
+
+
+/*****************************************************************************
+**
+** Error return values.
+** All the errors are described in more detail in the file: tvgetstr.c
+**
+*****************************************************************************/
+
+/* This is the return code for successful functions that work. */
+#define VOX_NO_ERROR 00000
+
+#define obsERR_BITS_PER_SAMPLE 101
+#define obsERR_SAMPLE_RATE 102
+#define VOXERR_FORMAT_PCM 103
+#define VOXERR_NOT_MONO 104
+#define VOXERR_VOXWARE_DATA_POINTER_NULL 105
+#define VOXERR_VOXWARE_DATA_SIZE 106
+#define VOXERR_VOX_FILE_INFO_POINTER_NULL 107
+#define VOXERR_VOX_FILE_INFO_SIZE 108
+#define VOXERR_VOX_VERSION_POINTER_NULL 109
+#define VOXERR_VOX_VERSION_SIZE 110
+#define VOXERR_VOX_VOICE_POINTER_NULL 111
+#define VOXERR_VOX_VOICE_NAME_NULL 112
+#define VOXERR_MORPHIO_POINTER_BAD 113
+#define VOXERR_INVALID_INPUT_TYPE 114
+#define VOXERR_INVALID_OUTPUT_TYPE 115
+#define VOXERR_INPUT_HANDLER 116
+#define VOXERR_OUTPUT_HANDLER 117
+#define VOXERR_PRIME_TIME 118
+#define VOXERR_WARP_2_BIG 119
+#define VOXERR_WARP_2_SMALL 120
+#define VOXERR_ABS_PITCH_2_BIG 121
+#define VOXERR_ABS_PITCH_2_SMALL 122
+#define VOXERR_REL_PITCH_2_BIG 123
+#define VOXERR_REL_PITCH_2_SMALL 124
+#define VOXERR_CODEC_UNKNOWN 125
+#define VOXERR_INPUT_BYTES_PER_SAMPLE 126
+#define VOXERR_OUTPUT_BYTES_PER_SAMPLE 127
+#define VOXERR_FORMAT_VOX 128
+#define VOXERR_UNKNOWN_ATTRIBUTE 129
+#define VOXERR_VWD_OR_VCB_IS_NULL 130
+#define VOXERR_NO_MARKERS_IN_INPUT_FILE 131
+#define VOXERR_BAD_SRC_4_MARKER_INPUT 132
+#define VOXERR_UNSUPPORTED_MARKER_CHUNK 133
+#define VOXERR_INVALID_MARKER_SELECTOR 134
+#define VOXERR_NO_INPUT_SAMPLE_SIZE 135
+#define VOXERR_NO_INPUT_SAMPLING_RATE 136
+#define VOXERR_BAD_INPUT_SAMPLING_RATE 137
+#define VOXERR_BAD_OUTPUT_SAMPLING_RATE 138
+
+/* A spot check of your machine and system software revealed a slight problem. */
+/* These are MacOS ONLY errors: */
+#define VOXERR_VALIDATE_NO_GESTALT 139
+#define VOXERR_VALIDATE_CPU_OLD_AS_DIRT 140
+#define VOXERR_VALIDATE_NO_FPU 141
+#define VOXERR_VALIDATE_FILE_MGR_TOO_OLD 142
+#define VOXERR_VALIDATE_NO_NOTIFICATION_MGR 143
+#define VOXERR_VALIDATE_YIKES_NO_SOUND_MGR 144
+#define VOXERR_VALIDATE_U_LACK_16BIT_SND 145
+#define VOXERR_VALIDATE_SND_MGR_NOT_CURRENT 146
+
+#define VOXERR_DONT_GIVE_INPUT_SAMPLE_RATE 147
+#define VOXERR_DONT_GIVE_INPUT_SAMPLE_SIZE 148
+#define VOXERR_NO_SAMPLE_RATE_FOR_VOX 149
+#define VOXERR_NO_SAMPLE_SIZE_FOR_VOX 150
+#define VOXERR_EFFECTS_ARE_NOT_SUPPORTED 151
+#define VOXERR_FX_R_4_DECOMPRESSION_ONLY 152
+#define VOXERR_ONLY_RT_8K_CODEC_AVAILABLE 153
+#define VOXERR_INVALID_MARKER_SIZEOF 154
+#define VOXERR_INVALID_VCB 155
+#define VOXERR_INVALID_OUTPUT_VARS 156
+#define VOXERR_INVALID_INPUT_VARS 157
+#define VOXERR_ABS_GAIN_2_BIG 158
+#define VOXERR_ABS_GAIN_2_SMALL 159
+#define VOXERR_REL_GAIN_2_BIG 160
+#define VOXERR_REL_GAIN_2_SMALL 161
+#define VOXERR_VOXWARE_ALREADY_INITIALIZED 162
+#define VOXERR_MUST_PLAY_TO_LOCATION_SOUND 163 // new, not yet in manual
+#define VOXERR_MUST_CALL_DCMP_TOOLVOX_PLAY 164 // new, not yet in manual
+#define VOXERR_FPU_DETECT 165 // new, not yet in manual
+#define VOXERR_IDENTIFYING_THE_CPU 166 // new, not yet in manual
+#define obsERR_IDENTIFYING_THE_OS 167 // bozo sabotage error... never use this.
+#define VOXERR_CODEC_NOT_AVAILABLE 168 // new, not yet in manual
+#define obsERR_DONT_GIVE_CODEC 169 // bozo sabotage error... never use this.
+#define VOXERR_DONT_GIVE_CMP_SETTINGS 170 // new, not yet in manual
+#define VOXERR_LINK_WITH_NATIVE_CODE 171 // mac only: new, not yet in manual
+
+
+/* File I/O error codes. */
+#define obsERR_DATA_CHUNK_SEEK 201
+#define obsERR_FMT_CHUNK_READ 202
+#define VOXERR_FMT_CHUNK_SIZE 203
+#define VOXERR_RIFF_CHUNK_READ 204
+#define VOXERR_VOX_HEADER_FLAG 205
+#define VOXERR_VOX_HEADER_SIZE 206
+#define obsERR_VOX_INIT_READ 207
+#define obsERR_VOX_INIT_WRITE 208
+#define obsERR_VOX_OPEN 209
+#define obsERR_VOX_READ 210
+#define obsERR_VOX_WRITE 211
+#define obsERR_WAVE_CKID 212
+#define obsERR_WAVE_INIT_READ 213
+#define obsERR_WAVE_INIT_WRITE 214
+#define obsERR_WAVE_OPEN 215
+#define obsERR_WAVE_READ 216
+#define obsERR_WAVE_WRITE 217
+#define VOXERR_VFONT_OPEN 218
+#define VOXERR_VFONT_READ 219
+#define VOXERR_VFONT_WRITE 220
+#define VOXERR_ENDOFFILE_REACHED 221
+#define VOXERR_READING_FROM_FILE 222
+#define VOXERR_WRITING_TO_FILE 223
+#define VOXERR_BAD_PATH_TO_FILE 224
+#define VOXERR_SET_FPOS 225
+#define VOXERR_OPENING_INPUT_FILE 226
+#define VOXERR_OPENING_OUTPUT_FILE 227
+#define VOXERR_CLOSING_INPUT_FILE 228
+#define VOXERR_CLOSING_OUTPUT_FILE 229
+#define VOXERR_READING_MARKER 230
+#define VOXERR_SEEKING_TO_MARKER_CHUNK 231
+#define VOXERR_MARKER_SEEK_RESET 232
+#define VOXERR_FAILED_SEEK_TO_MARKER 233
+#define VOXERR_REOPENING_MARKER_LOG 234
+#define VOXERR_OPENING_MARKER_LOG 235
+#define VOXERR_FAILED_TO_GET_EOF 236
+#define VOXERR_SEEKING_PAST_HEADER 237
+#define VOXERR_ENDOFBUFFER_REACHED 238
+
+
+/* Format/Header error codes */
+#define WheReIsErOrNuMbErThReEoOnE 301 //###lee
+#define VOXERR_UNKNOWN_HEADER_FORMAT 302
+#define VOXERR_WE_DONT_SUPPORT_RIFX 303
+#define VOXERR_WAVE_DOESNT_START_RIFF 304
+#define VOXERR_CANT_SURF_THIS_WAVE 305
+#define VOXERR_AIFF_COULDNT_FIND_ALL_CHUNKS 306
+#define VOXERR_HDR_MISSING_BITS_OF_DATA 307
+#define VOXERR_NOT_A_COMPRESSED_HEADER 308
+#define VOXERR_NO_CODECID_FOR_HEADER 309 // new MJ51
+#define VOXERR_UNKNOWN_CODECID_IN_HEADER 310 // new MJ67
+
+
+/* Memory allocation error codes. */
+#define VOXERR_PLAYBACK_MEMORY 401
+#define VOXERR_VOXSTRUCT_MEMORY 402
+#define obsERR_VOX_DATA_MEMORY 403
+#define obsERR_WAVE_DATA_MEMORY 404
+#define VOXERR_WAVEHDR_MEMORY 405
+#define VOXERR_VER_INFO_MEMORY 406
+#define VOXERR_MORPHIO_MEMORY 407
+#define VOXERR_INPUT_VARS_MEMORY 408
+#define VOXERR_OUTPUT_VARS_MEMORY 409
+#define VOXERR_RECORD_MEMORY 410
+#define VOXERR_MARKERS_MEMORY 411
+#define VOXERR_FILELINK_MEMORY 412
+#define VOXERR_READ_COMPLETION_MEMORY 413
+#define VOXERR_INPUT_DISKIO_MEMORY 414
+#define VOXERR_OUTPUT_DISKIO_MEMORY 415
+#define VOXERR_FLUSH_BUFFER_MEMORY 416
+#define VOXERR_FUNCIN_BUFFER_MEMORY 417
+#define VOXERR_FUNCOUT_BUFFER_MEMORY 418
+#define VOXERR_DEFERRED_TASK_PROC_MEMORY 419
+#define VOXERR_DEFERRED_TASK_MEMORY 420
+#define VOXERR_SOUND_CALLBACK_PROC_MEMORY 421
+#define VOXERR_NOTIFICATION_REC_MEMORY 422
+#define VOXERR_PLAYBACK_VARS_MEMORY 423
+#define VOXERR_PLAYBACK_BUFFER_MEMORY 424
+#define VOXERR_ORD_MARKERS_MEMORY 425
+#define VOXERR_MARKERS_TEMP_CHUNK_MEMORY 426
+#define VOXERR_WAVE_MARKER_CHUNK_MEMORY 427
+#define VOXERR_GENERIC_MARKERS_MEMORY 428
+#define VOXERR_TEMP_INPUT_BUFFER_MEMORY 429
+
+
+/* General system error codes. */
+#define VOXERR_BREW_BLACK_ART 501
+#define VOXERR_COMPRESSION 502
+#define VOXERR_CREATE_WINDOW 503
+#define VOXERR_DECOMPRESSION 504
+#define VOXERR_WAVEOUT_OPEN 505
+#define VOXERR_PREPARE_HDR 506
+#define VOXERR_WAVEOUT_WRITE 507
+#define VOXERR_WAVEIN_ADD_BUFFER 508
+#define VOXERR_WAVEIN_OPEN 509
+#define VOXERR_WAVEIN_START 510
+#define VOXERR_FUNCTION_EXPIRED 511
+#define VOXERR_NOT_ENOUGH_DATA_TO_COMPRESS 512
+#define VOXERR_COMPRESS_BUFFER 513
+#define VOXERR_PROCESSING_ABORTED 514 // new, not yet in manual
+#define VOXERR_PAUSING 515 // new MJ44 -- not yet in manual
+#define VOXERR_RESUMING 516 // new MJ44 -- not yet in manual
+#define VOXERR_FLUSHCMD 517 // new MJ44 -- not yet in manual
+#define VOXERR_QUIETCMD 518 // new MJ44 -- not yet in manual
+#define VOXERR_BUFFERCMD 519 // new MJ44 -- not yet in manual
+#define VOXERR_CALLBACKCMD 520 // new MJ44 -- not yet in manual
+#define VOXERR_DTINSTALL_FAILED 521 // new MJ44 -- not yet in manual
+
+
+/* Errors that occur using the VoiceFonts API. */
+#define VOXERR_VFONT_FILE_NOT_FOUND 601
+#define VOXERR_VFONT_WRONGNAME 602
+#define VOXERR_VFONT_DELETE 603
+#define VOXERR_VFONT_FILE_FORMAT 604
+#define VOXERR_MORPHIO_HANDLE_INVALID 605
+#define VOXERR_VFII_UNKNOWN_VOICE_FONT 606 // new MJ50 -- not yet in manual
+#define VOXERR_VFII_UNKNOWN_VF_CHUNK_SIZE 607 // new MJ50 -- not yet in manual
+
+
+
+
+
+
+
+/*****************************************************************************
+**
+** Header routines to convert from digitized speech to VOX data. They all
+** take PCM data as input and output compressed VOX data.
+**
+*****************************************************************************/
+
+
+/* New calls that have the properties of all of the other calls. The routine
+** use the dwInputType and dwOutputType fields to tell how to process the data.
+** This makes the older calls obsolete (yet still supported).
+*/
+VOXWARE_RETCODE VOXAPI cmpToolVoxRecord(LPVOXWARE_DATA lpVoxwareData);
+VOXWARE_RETCODE VOXAPI cmpToolVoxCompress(LPVOXWARE_DATA lpVoxwareData);
+
+
+/* These routines are used for low-level compression. */
+VOXWARE_RETCODE VOXAPI cmpVoxInit(LPVOXWARE_DATA lpVoxwareData);
+VOXWARE_RETCODE VOXAPI cmpVoxConvert(LPVOXWARE_DATA lpVoxwareData);
+VOXWARE_RETCODE VOXAPI cmpVoxFree(LPVOXWARE_DATA lpVoxwareData);
+
+
+/* Older functions that are only here for backwards compatibility. */
+VOXWARE_RETCODE VOXAPI cmpFileToVoxFile(LPVOXWARE_DATA lpVoxwareData);
+VOXWARE_RETCODE VOXAPI cmpFileToVoxBuffer(LPVOXWARE_DATA lpVoxwareData);
+VOXWARE_RETCODE VOXAPI cmpBufferToVoxFile(LPVOXWARE_DATA lpVoxwareData);
+
+
+
+
+/*****************************************************************************
+**
+** Header routines to convert from VOX data to digitized speech. They all
+** take VOX data as input (either as VOX file or a buffer of VOX data) and
+** output decompressed PCM data. There is also a routine to play VOX or PCM
+** data.
+**
+*****************************************************************************/
+
+VOXWARE_RETCODE VOXAPI dcmpToolVoxPlay(LPVOXWARE_DATA lpVoxwareData);
+VOXWARE_RETCODE VOXAPI dcmpToolVoxDecompress(LPVOXWARE_DATA lpVoxwareData);
+VOXWARE_RETCODE VOXAPI dcmpToolVoxStop(LPVOXWARE_DATA lpVoxwareData); // MacOS only
+VOXWARE_RETCODE VOXAPI dcmpToolVoxPause(LPVOXWARE_DATA lpVoxwareData); // Hidden API don't use.
+VOXWARE_RETCODE VOXAPI dcmpToolVoxResume(LPVOXWARE_DATA lpVoxwareData); // Hidden API don't use.
+VOXWARE_RETCODE VOXAPI dcmpSetBitOffset(LPVOXWARE_DATA lpVoxwareData, short newOffset); // Hidden API don't use.
+
+
+/* These routines are used for low-level decompression. */
+VOXWARE_RETCODE VOXAPI dcmpVoxInit(LPVOXWARE_DATA lpVoxwareData);
+VOXWARE_RETCODE VOXAPI dcmpVoxConvert(LPVOXWARE_DATA lpVoxwareData);
+VOXWARE_RETCODE VOXAPI dcmpVoxFree(LPVOXWARE_DATA lpVoxwareData);
+
+
+/* Older functions that are only here for backwards compatibility. */
+VOXWARE_RETCODE VOXAPI dcmpVoxFileToFile(LPVOXWARE_DATA lpVoxwareData);
+VOXWARE_RETCODE VOXAPI dcmpVoxFileToBuffer(LPVOXWARE_DATA lpVoxwareData);
+VOXWARE_RETCODE VOXAPI dcmpVoxBufferToFile(LPVOXWARE_DATA lpVoxwareData);
+VOXWARE_RETCODE VOXAPI dcmpPlayVoxFile(LPVOXWARE_DATA lpVoxwareData);
+VOXWARE_RETCODE VOXAPI dcmpPlayVoxBuffer(LPVOXWARE_DATA lpVoxwareData);
+
+
+
+
+/*****************************************************************************
+**
+** These utility routines can be used to get information about the speed of
+** the ToolVox compression or to get file information about an AIFF or VOX
+** file. There are also routines to get and set different attributes of the
+** ToolVox API.
+**
+*****************************************************************************/
+
+VOXWARE_RETCODE VOXAPI utilGetFileInfo(LPVOXWARE_DATA lpVoxwareData);
+VOXWARE_RETCODE VOXAPI utilGetVersionInfo(LPVOXWARE_DATA lpVoxwareData);
+VOXWARE_RETCODE VOXAPI utilToolVoxGetAttribute(
+ LPVOXWARE_DATA lpVoxwareData,
+ LPVOX_COMMAND lpCommand);
+VOXWARE_RETCODE VOXAPI utilToolVoxSetAttribute(
+ LPVOXWARE_DATA lpVoxwareData,
+ LPVOX_COMMAND lpCommand);
+
+
+
+
+/*****************************************************************************
+**
+** This prototype is for the callback function that can be passed to ToolVox
+** in the VOXWARE_DATA structure. If you create this function, it must be
+** in a FIXED/Locked segment!
+**
+*****************************************************************************/
+
+VOXAPI_CALLBACK VoxFunc(
+ unsigned short wVox,
+ unsigned short wMessage,
+ LPVOXWARE_DATA lpVoxwareData);
+
+
+
+
+#ifndef VOXWARE_SUN
+ #if PRAGMA_ALIGN_SUPPORTED
+ #pragma options align=reset
+ #elif VOXWARE_HP
+ #pragma HP_ALIGN HPUX_NATURAL
+ #else
+ #pragma pack()
+ #endif
+#endif
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+
+#endif /*__TOOLVOX_H_*/
diff --git a/Src/libvp6/corelibs/include/tvgetstr.h b/Src/libvp6/corelibs/include/tvgetstr.h
new file mode 100644
index 00000000..e0a2c751
--- /dev/null
+++ b/Src/libvp6/corelibs/include/tvgetstr.h
@@ -0,0 +1,148 @@
+/*****************************************************************************
+
+ *
+
+ * Module tvGetStr.H
+
+ * The defines and prototypes for the ToolVox error string
+
+ * reporting module.
+
+ *
+
+ * Voxware Proprietary Material
+
+ * Copyright 1996, Voxware, Inc.
+
+ * All Rights Resrved
+
+ *
+
+ * DISTRIBUTION PROHIBITED without
+
+ * written authorization from Voxware
+
+ *
+
+ ****************************************************************************/
+
+
+
+
+
+#if (_DEBUG_MESSAGES == 1) || defined(_DEBUG)
+
+
+
+#ifndef __TVGETSTR_H_
+
+#define __TVGETSTR_H_
+
+
+
+#ifdef __cplusplus
+
+extern "C" {
+
+#endif
+
+
+
+/* Windows users must define VOXWARE_??? as a compiler option. This will */
+
+/* enable system specific code. */
+
+#if defined (VOXWARE_WIN16) || (VOXWARE_WIN32)
+
+ #define STRING_FORMAT wsprintf
+
+
+
+#elif defined(VOXWARE_MAC)
+
+ #define STRING_FORMAT sprintf
+
+
+
+#elif defined(VOXWARE_HP)
+
+ #define STRING_FORMAT sprintf
+
+
+
+#elif defined(VOXWARE_SUN)
+
+ #define STRING_FORMAT sprintf
+
+
+
+#elif defined(VOXWARE_DOS)
+
+ #define STRING_FORMAT sprintf
+
+
+
+#else
+
+
+
+#pragma message ("TVGETSTR.H: Platform indicator #define not setup.")
+
+#pragma message ("TVGETSTR.H: One of the following must be initialized:")
+
+#pragma message ("TVGETSTR.H: #define VOXWARE_WIN16")
+
+#pragma message ("TVGETSTR.H: #define VOXWARE_WIN32")
+
+#pragma message ("TVGETSTR.H: #define VOXWARE_MAC")
+
+#pragma message ("TVGETSTR.H: #define VOXWARE_SUN")
+
+#pragma message ("TVGETSTR.H: #define VOXWARE_HP")
+
+#pragma message ("TVGETSTR.H: #define VOXWARE_AIX")
+
+#pragma message ("TVGETSTR.H: #define VOXWARE_DOS")
+
+#pragma message ("TVGETSTR.H: Check the Voxware manual for more information.")
+
+
+
+#endif
+
+
+
+
+
+#define TVGETSTR_MAX_STRING_LENGTH 512
+
+
+
+
+
+void tvGetStringFromError(VOXWARE_RETCODE wVoxwareError, signed long dwReturnCode,
+
+ char VOX_FAR *lpMessage);
+
+
+
+
+
+
+
+
+
+#ifdef __cplusplus
+
+}
+
+#endif
+
+
+
+#endif /*__TVGETSTR_H_*/
+
+
+
+#endif /* _DEBUG_MESSAGES */
+
diff --git a/Src/libvp6/corelibs/include/voxchunk.h b/Src/libvp6/corelibs/include/voxchunk.h
new file mode 100644
index 00000000..b8daeee4
--- /dev/null
+++ b/Src/libvp6/corelibs/include/voxchunk.h
@@ -0,0 +1,127 @@
+/**********************************************************************
+
+ * (c) 1996 Voxware, Inc. All Rights Reserved. This file contains
+
+ * proprietary information of trade secrets of Voxware, Inc. and may
+
+ * not be distributed without the authorization of Voxware, Inc.
+
+ **********************************************************************
+
+ *
+
+ * File: VOXCHUNK.H
+
+ * Purpose: Types and #defines which describe the handling of
+
+ * the INFO chunks in the vox files.
+
+ * Created: 5/29/96 - George T. Talbot
+
+ * Modified: 6/17/96 - GTT - Added code to set lengths to -1 on
+
+ * the VOXCHUNK_SET() macro so that
+
+ * the default behaviour is to read
+
+ * existing info data.
+
+ * Notes:
+
+ *
+
+ **********************************************************************/
+
+
+
+#ifndef _VOXCHUNK_H_
+
+#define _VOXCHUNK_H_
+
+typedef struct tagVox_Chunk_Info
+
+{
+
+ unsigned long id;
+
+ long length;
+
+ char info[256];
+
+} VOX_CHUNK_INFO;
+
+
+
+// Important note: When adding a new VOXCHUNK_xxx, make sure to add
+
+// the cooresponding elements to the gRIFF_VoxChunk_IDs[] and
+
+// gAIFF_VoxChunk_IDs[] arrays in INFOCHNK.C
+
+
+
+#define VOXCHUNK_NONE 0
+
+#define VOXCHUNK_URL 1
+
+#define VOXCHUNK_COPYRIGHT 2
+
+#define VOXCHUNK_TITLE 3
+
+#define VOXCHUNK_SOFTWARE 4
+
+#define VOXCHUNK_AUTHOR 5
+
+#define VOXCHUNK_COMMENT 6
+
+
+
+#define VOXCHUNK_NUM_KINDS 7
+
+
+
+// Convenience macros...
+
+
+
+// Clear out a set of VOX_CHUNK_INFO records for use...
+
+//
+
+// Parameters are: _zz1 - Pointer to array of VOX_CHUNK_INFO.
+
+// _zz2 - Number of elements in the array.
+
+
+
+#define VOXCHUNK_SET(_zz1, _zz2) { \
+ memset((_zz1), 0, (_zz2) * sizeof(VOX_CHUNK_INFO)); \
+ for (short i=0; i<(_zz2); ++i) \
+ { \
+ (_zz1)[i].length = -1; \
+ } \
+ }
+
+
+
+// Write a C string into a VOX_CHUNK_INFO record...
+
+//
+
+// Parameters are: _zz1 - VOX_CHUNK_INFO record
+
+// _zz2 - Chunk ID from above list
+
+// _zz3 - A C string
+
+
+
+#define VOXCHUNK_INFO(_zz1, _zz2, _zz3) \
+ { \
+ (_zz1).id = (_zz2); \
+ (_zz1).length = strlen(_zz3)+1; \
+ memcpy((_zz1).info, (_zz3), (_zz1).length); \
+ }
+
+#endif
+
diff --git a/Src/libvp6/corelibs/on2_common/src/on2_mem/build/win32/on2_mem.plg b/Src/libvp6/corelibs/on2_common/src/on2_mem/build/win32/on2_mem.plg
new file mode 100644
index 00000000..83ce8fbe
--- /dev/null
+++ b/Src/libvp6/corelibs/on2_common/src/on2_mem/build/win32/on2_mem.plg
@@ -0,0 +1,1786 @@
+<html>
+<body>
+<pre>
+<h1>Build Log</h1>
+<h3>
+--------------------Configuration: CPUIdLib - Win32 Release--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\tmp\RSPB01.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\ObjectCode\cpuID\release\VerifyXMMReg.lst /Fo .\..\..\..\ObjectCode\cpuID\release\VerifyXMMReg.obj .\Win32\VerifyXMMReg.asm
+]
+Creating command line "C:\tmp\RSPB01.bat"
+Creating temporary file "C:\tmp\RSPB02.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\ObjectCode\cpuID\release\TrashXMMreg.lst /Fo .\..\..\..\ObjectCode\cpuID\release\TrashXMMreg.obj .\Win32\TrashXMMreg.asm
+]
+Creating command line "C:\tmp\RSPB02.bat"
+Creating temporary file "C:\tmp\RSPB03.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\ObjectCode\cpuID\release\InitXMMReg.lst /Fo .\..\..\..\ObjectCode\cpuID\release\InitXMMReg.obj .\Win32\InitXMMReg.asm
+]
+Creating command line "C:\tmp\RSPB03.bat"
+Creating temporary file "C:\tmp\RSPB04.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\ObjectCode\cpuID\release\D9xOSSupXMM.lst /Fo .\..\..\..\ObjectCode\cpuID\release\D9xOSSupXMM.obj .\Win32\D9xOSSupXMM.asm
+]
+Creating command line "C:\tmp\RSPB04.bat"
+Creating temporary file "C:\tmp\RSPB05.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\ObjectCode\cpuID\release\cpuid.lst /Fo .\..\..\..\ObjectCode\cpuID\release\cpuid.obj .\Win32\cpuid.asm
+]
+Creating command line "C:\tmp\RSPB05.bat"
+Creating temporary file "C:\tmp\RSPB06.tmp" with contents
+[
+/nologo /G6 /MT /W3 /GX /O2 /I "..\include" /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /Fo"..\..\..\ObjectCode\cpuID\release/" /Fd"..\..\..\ObjectCode\cpuID\release/" /FD /c
+"C:\NEWZIP\VP6\corelibs\CpuID\Win32\cid.c"
+"C:\NEWZIP\VP6\corelibs\CpuID\Win32\Wmt_CpuID.cpp"
+]
+Creating command line "cl.exe @C:\tmp\RSPB06.tmp"
+Performing Custom Build Step on .\Win32\VerifyXMMReg.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\Win32\VerifyXMMReg.asm
+Performing Custom Build Step on .\Win32\TrashXMMreg.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\Win32\TrashXMMreg.asm
+Performing Custom Build Step on .\Win32\InitXMMReg.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\Win32\InitXMMReg.asm
+Performing Custom Build Step on .\Win32\D9xOSSupXMM.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\Win32\D9xOSSupXMM.asm
+Performing Custom Build Step on .\Win32\cpuid.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\Win32\cpuid.asm
+Creating temporary file "C:\tmp\RSPB07.tmp" with contents
+[
+/nologo /out:"..\..\lib\win32\Release\s_cpuid.lib"
+\NEWZIP\ObjectCode\cpuID\release\cid.obj
+\NEWZIP\ObjectCode\cpuID\release\Wmt_CpuID.obj
+\NEWZIP\ObjectCode\cpuID\release\cpuid.obj
+\NEWZIP\ObjectCode\cpuID\release\D9xOSSupXMM.obj
+\NEWZIP\ObjectCode\cpuID\release\InitXMMReg.obj
+\NEWZIP\ObjectCode\cpuID\release\TrashXMMreg.obj
+\NEWZIP\ObjectCode\cpuID\release\VerifyXMMReg.obj
+]
+Creating command line "link.exe -lib @C:\tmp\RSPB07.tmp"
+<h3>Output Window</h3>
+Compiling...
+cid.c
+Generating Code...
+Compiling...
+Wmt_CpuID.cpp
+Generating Code...
+Creating library...
+
+
+
+<h3>Results</h3>
+s_cpuid.lib - 0 error(s), 0 warning(s)
+<h3>
+--------------------Configuration: CPUIdLib - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\tmp\RSPB08.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\ObjectCode\cpuID\debug\VerifyXMMReg.lst /Fo .\..\..\..\ObjectCode\cpuID\debug\VerifyXMMReg.obj .\Win32\VerifyXMMReg.asm
+]
+Creating command line "C:\tmp\RSPB08.bat"
+Creating temporary file "C:\tmp\RSPB09.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\ObjectCode\cpuID\debug\TrashXMMreg.lst /Fo .\..\..\..\ObjectCode\cpuID\debug\TrashXMMreg.obj .\Win32\TrashXMMreg.asm
+]
+Creating command line "C:\tmp\RSPB09.bat"
+Creating temporary file "C:\tmp\RSPB0A.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\ObjectCode\cpuID\debug\InitXMMReg.lst /Fo .\..\..\..\ObjectCode\cpuID\debug\InitXMMReg.obj .\Win32\InitXMMReg.asm
+]
+Creating command line "C:\tmp\RSPB0A.bat"
+Creating temporary file "C:\tmp\RSPB0B.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\ObjectCode\cpuID\debug\D9xOSSupXMM.lst /Fo .\..\..\..\ObjectCode\cpuID\debug\D9xOSSupXMM.obj .\Win32\D9xOSSupXMM.asm
+]
+Creating command line "C:\tmp\RSPB0B.bat"
+Creating temporary file "C:\tmp\RSPB0C.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\ObjectCode\cpuID\debug\cpuid.lst /Fo .\..\..\..\ObjectCode\cpuID\debug\cpuid.obj .\Win32\cpuid.asm
+]
+Creating command line "C:\tmp\RSPB0C.bat"
+Creating temporary file "C:\tmp\RSPB0D.tmp" with contents
+[
+/nologo /G6 /MTd /W3 /GX /Z7 /Od /I "..\..\include" /I "..\include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /Fp"..\..\..\ObjectCode\cpuID\debug/CPUIdLib.pch" /YX /Fo"..\..\..\ObjectCode\cpuID\debug/" /Fd"..\..\..\ObjectCode\cpuID\debug/" /FD /GZ /c
+"C:\NEWZIP\VP6\corelibs\CpuID\Win32\cid.c"
+"C:\NEWZIP\VP6\corelibs\CpuID\Win32\Wmt_CpuID.cpp"
+]
+Creating command line "cl.exe @C:\tmp\RSPB0D.tmp"
+Performing Custom Build Step on .\Win32\VerifyXMMReg.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\Win32\VerifyXMMReg.asm
+Performing Custom Build Step on .\Win32\TrashXMMreg.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\Win32\TrashXMMreg.asm
+Performing Custom Build Step on .\Win32\InitXMMReg.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\Win32\InitXMMReg.asm
+Performing Custom Build Step on .\Win32\D9xOSSupXMM.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\Win32\D9xOSSupXMM.asm
+Performing Custom Build Step on .\Win32\cpuid.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\Win32\cpuid.asm
+Creating temporary file "C:\tmp\RSPB0E.tmp" with contents
+[
+/nologo /out:"..\..\lib\win32\debug\s_cpuid.lib"
+\NEWZIP\ObjectCode\cpuID\debug\cid.obj
+\NEWZIP\ObjectCode\cpuID\debug\Wmt_CpuID.obj
+\NEWZIP\ObjectCode\cpuID\debug\cpuid.obj
+\NEWZIP\ObjectCode\cpuID\debug\D9xOSSupXMM.obj
+\NEWZIP\ObjectCode\cpuID\debug\InitXMMReg.obj
+\NEWZIP\ObjectCode\cpuID\debug\TrashXMMreg.obj
+\NEWZIP\ObjectCode\cpuID\debug\VerifyXMMReg.obj
+]
+Creating command line "link.exe -lib @C:\tmp\RSPB0E.tmp"
+<h3>Output Window</h3>
+Compiling...
+cid.c
+Wmt_CpuID.cpp
+Creating library...
+
+
+
+<h3>Results</h3>
+s_cpuid.lib - 0 error(s), 0 warning(s)
+<h3>
+--------------------Configuration: colorconversions - Win32 Release--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\tmp\RSPB0F.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\ObjectCode\ColorSpaces\Release\rgb32toyv12_xmm.lst /Fo .\..\..\..\ObjectCode\ColorSpaces\Release\rgb32toyv12_xmm.obj .\Win32\rgb32toyv12_xmm.asm
+]
+Creating command line "C:\tmp\RSPB0F.bat"
+Creating temporary file "C:\tmp\RSPB10.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\ObjectCode\ColorSpaces\Release\rgb32toyv12_mmx.lst /Fo .\..\..\..\ObjectCode\ColorSpaces\Release\rgb32toyv12_mmx.obj .\Win32\rgb32toyv12_mmx.asm
+]
+Creating command line "C:\tmp\RSPB10.bat"
+Creating temporary file "C:\tmp\RSPB11.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\ObjectCode\ColorSpaces\Release\rgb24toyv12_xmm.lst /Fo .\..\..\..\ObjectCode\ColorSpaces\Release\rgb24toyv12_xmm.obj .\Win32\rgb24toyv12_xmm.asm
+]
+Creating command line "C:\tmp\RSPB11.bat"
+Creating temporary file "C:\tmp\RSPB12.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\ObjectCode\ColorSpaces\Release\rgb24toyv12_mmx.lst /Fo .\..\..\..\ObjectCode\ColorSpaces\Release\rgb24toyv12_mmx.obj .\Win32\rgb24toyv12_mmx.asm
+]
+Creating command line "C:\tmp\RSPB12.bat"
+Creating temporary file "C:\tmp\RSPB13.tmp" with contents
+[
+/nologo /G6 /MT /W3 /GX /O2 /I "..\..\include" /I "..\include" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /Fp"..\..\..\ObjectCode\ColorSpaces\Release/colorconversions.pch" /YX /Fo"..\..\..\ObjectCode\ColorSpaces\Release/" /Fd"..\..\..\ObjectCode\ColorSpaces\Release/" /FD /c
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\Win32\uyvytoyv12_mmx.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\Win32\yuy2toyv12_mmx.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\Win32\yvyutoyv12_mmx.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\ColorConversions.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\lutbl.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\rgb24toyv12.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\rgb24toyv12f.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\rgb32toyv12.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\rgb32toyv12f.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\rgbtorgb.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\rgbtoyuv.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\rgbtoyuvi.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\uyvytoyv12.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\uyvytoyv12f.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\yuvitorgb.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\yuvitoyuv.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\yuvtorgb.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\yuvtoyuv.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\yuvtoyuvi.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\yuy2toyv12.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\yuy2toyv12f.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\yvyutoyv12.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\yvyutoyv12f.c"
+]
+Creating command line "cl.exe @C:\tmp\RSPB13.tmp"
+Performing Custom Build Step on .\Win32\rgb32toyv12_xmm.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\Win32\rgb32toyv12_xmm.asm
+Performing Custom Build Step on .\Win32\rgb32toyv12_mmx.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\Win32\rgb32toyv12_mmx.asm
+Performing Custom Build Step on .\Win32\rgb24toyv12_xmm.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\Win32\rgb24toyv12_xmm.asm
+Performing Custom Build Step on .\Win32\rgb24toyv12_mmx.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\Win32\rgb24toyv12_mmx.asm
+Creating temporary file "C:\tmp\RSPB14.tmp" with contents
+[
+/nologo /out:"..\..\lib\win32\release\s_cconv.lib"
+\NEWZIP\ObjectCode\ColorSpaces\Release\uyvytoyv12_mmx.obj
+\NEWZIP\ObjectCode\ColorSpaces\Release\yuy2toyv12_mmx.obj
+\NEWZIP\ObjectCode\ColorSpaces\Release\yvyutoyv12_mmx.obj
+\NEWZIP\ObjectCode\ColorSpaces\Release\ColorConversions.obj
+\NEWZIP\ObjectCode\ColorSpaces\Release\lutbl.obj
+\NEWZIP\ObjectCode\ColorSpaces\Release\rgb24toyv12.obj
+\NEWZIP\ObjectCode\ColorSpaces\Release\rgb24toyv12f.obj
+\NEWZIP\ObjectCode\ColorSpaces\Release\rgb32toyv12.obj
+\NEWZIP\ObjectCode\ColorSpaces\Release\rgb32toyv12f.obj
+\NEWZIP\ObjectCode\ColorSpaces\Release\rgbtorgb.obj
+\NEWZIP\ObjectCode\ColorSpaces\Release\rgbtoyuv.obj
+\NEWZIP\ObjectCode\ColorSpaces\Release\rgbtoyuvi.obj
+\NEWZIP\ObjectCode\ColorSpaces\Release\uyvytoyv12.obj
+\NEWZIP\ObjectCode\ColorSpaces\Release\uyvytoyv12f.obj
+\NEWZIP\ObjectCode\ColorSpaces\Release\yuvitorgb.obj
+\NEWZIP\ObjectCode\ColorSpaces\Release\yuvitoyuv.obj
+\NEWZIP\ObjectCode\ColorSpaces\Release\yuvtorgb.obj
+\NEWZIP\ObjectCode\ColorSpaces\Release\yuvtoyuv.obj
+\NEWZIP\ObjectCode\ColorSpaces\Release\yuvtoyuvi.obj
+\NEWZIP\ObjectCode\ColorSpaces\Release\yuy2toyv12.obj
+\NEWZIP\ObjectCode\ColorSpaces\Release\yuy2toyv12f.obj
+\NEWZIP\ObjectCode\ColorSpaces\Release\yvyutoyv12.obj
+\NEWZIP\ObjectCode\ColorSpaces\Release\yvyutoyv12f.obj
+\NEWZIP\ObjectCode\ColorSpaces\Release\rgb24toyv12_mmx.obj
+\NEWZIP\ObjectCode\ColorSpaces\Release\rgb24toyv12_xmm.obj
+\NEWZIP\ObjectCode\ColorSpaces\Release\rgb32toyv12_mmx.obj
+\NEWZIP\ObjectCode\ColorSpaces\Release\rgb32toyv12_xmm.obj
+]
+Creating command line "link.exe -lib @C:\tmp\RSPB14.tmp"
+<h3>Output Window</h3>
+Compiling...
+uyvytoyv12_mmx.c
+yuy2toyv12_mmx.c
+yvyutoyv12_mmx.c
+ColorConversions.c
+lutbl.c
+rgb24toyv12.c
+rgb24toyv12f.c
+rgb32toyv12.c
+rgb32toyv12f.c
+rgbtorgb.c
+rgbtoyuv.c
+rgbtoyuvi.c
+uyvytoyv12.c
+uyvytoyv12f.c
+yuvitorgb.c
+yuvitoyuv.c
+yuvtorgb.c
+yuvtoyuv.c
+yuvtoyuvi.c
+yuy2toyv12.c
+yuy2toyv12f.c
+yvyutoyv12.c
+yvyutoyv12f.c
+Creating library...
+
+
+
+<h3>Results</h3>
+s_cconv.lib - 0 error(s), 0 warning(s)
+<h3>
+--------------------Configuration: colorconversions - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\tmp\RSPB15.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\ObjectCode\ColorSpaces\Debug\rgb32toyv12_xmm.lst /Fo .\..\..\..\ObjectCode\ColorSpaces\Debug\rgb32toyv12_xmm.obj .\Win32\rgb32toyv12_xmm.asm
+]
+Creating command line "C:\tmp\RSPB15.bat"
+Creating temporary file "C:\tmp\RSPB16.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\ObjectCode\ColorSpaces\Debug\rgb32toyv12_mmx.lst /Fo .\..\..\..\ObjectCode\ColorSpaces\Debug\rgb32toyv12_mmx.obj .\Win32\rgb32toyv12_mmx.asm
+]
+Creating command line "C:\tmp\RSPB16.bat"
+Creating temporary file "C:\tmp\RSPB17.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\ObjectCode\ColorSpaces\Debug\rgb24toyv12_xmm.lst /Fo .\..\..\..\ObjectCode\ColorSpaces\Debug\rgb24toyv12_xmm.obj .\Win32\rgb24toyv12_xmm.asm
+]
+Creating command line "C:\tmp\RSPB17.bat"
+Creating temporary file "C:\tmp\RSPB18.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\ObjectCode\ColorSpaces\Debug\rgb24toyv12_mmx.lst /Fo .\..\..\..\ObjectCode\ColorSpaces\Debug\rgb24toyv12_mmx.obj .\Win32\rgb24toyv12_mmx.asm
+]
+Creating command line "C:\tmp\RSPB18.bat"
+Creating temporary file "C:\tmp\RSPB19.tmp" with contents
+[
+/nologo /G6 /MTd /W3 /GX /Z7 /Od /I "..\..\include" /I "..\include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /Fp"..\..\..\ObjectCode\ColorSpaces\Debug/colorconversions.pch" /YX /Fo"..\..\..\ObjectCode\ColorSpaces\Debug/" /Fd"..\..\..\ObjectCode\ColorSpaces\Debug/" /FD /GZ /c
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\Win32\uyvytoyv12_mmx.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\Win32\yuy2toyv12_mmx.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\Win32\yvyutoyv12_mmx.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\ColorConversions.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\lutbl.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\rgb24toyv12.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\rgb24toyv12f.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\rgb32toyv12.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\rgb32toyv12f.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\rgbtorgb.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\rgbtoyuv.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\rgbtoyuvi.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\uyvytoyv12.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\uyvytoyv12f.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\yuvitorgb.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\yuvitoyuv.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\yuvtorgb.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\yuvtoyuv.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\yuvtoyuvi.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\yuy2toyv12.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\yuy2toyv12f.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\yvyutoyv12.c"
+"C:\NEWZIP\VP6\corelibs\ColorSpaces\yvyutoyv12f.c"
+]
+Creating command line "cl.exe @C:\tmp\RSPB19.tmp"
+Performing Custom Build Step on .\Win32\rgb32toyv12_xmm.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\Win32\rgb32toyv12_xmm.asm
+Performing Custom Build Step on .\Win32\rgb32toyv12_mmx.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\Win32\rgb32toyv12_mmx.asm
+Performing Custom Build Step on .\Win32\rgb24toyv12_xmm.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\Win32\rgb24toyv12_xmm.asm
+Performing Custom Build Step on .\Win32\rgb24toyv12_mmx.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\Win32\rgb24toyv12_mmx.asm
+Creating temporary file "C:\tmp\RSPB1A.tmp" with contents
+[
+/nologo /out:"..\..\lib\win32\debug\s_cconv.lib"
+\NEWZIP\ObjectCode\ColorSpaces\Debug\uyvytoyv12_mmx.obj
+\NEWZIP\ObjectCode\ColorSpaces\Debug\yuy2toyv12_mmx.obj
+\NEWZIP\ObjectCode\ColorSpaces\Debug\yvyutoyv12_mmx.obj
+\NEWZIP\ObjectCode\ColorSpaces\Debug\ColorConversions.obj
+\NEWZIP\ObjectCode\ColorSpaces\Debug\lutbl.obj
+\NEWZIP\ObjectCode\ColorSpaces\Debug\rgb24toyv12.obj
+\NEWZIP\ObjectCode\ColorSpaces\Debug\rgb24toyv12f.obj
+\NEWZIP\ObjectCode\ColorSpaces\Debug\rgb32toyv12.obj
+\NEWZIP\ObjectCode\ColorSpaces\Debug\rgb32toyv12f.obj
+\NEWZIP\ObjectCode\ColorSpaces\Debug\rgbtorgb.obj
+\NEWZIP\ObjectCode\ColorSpaces\Debug\rgbtoyuv.obj
+\NEWZIP\ObjectCode\ColorSpaces\Debug\rgbtoyuvi.obj
+\NEWZIP\ObjectCode\ColorSpaces\Debug\uyvytoyv12.obj
+\NEWZIP\ObjectCode\ColorSpaces\Debug\uyvytoyv12f.obj
+\NEWZIP\ObjectCode\ColorSpaces\Debug\yuvitorgb.obj
+\NEWZIP\ObjectCode\ColorSpaces\Debug\yuvitoyuv.obj
+\NEWZIP\ObjectCode\ColorSpaces\Debug\yuvtorgb.obj
+\NEWZIP\ObjectCode\ColorSpaces\Debug\yuvtoyuv.obj
+\NEWZIP\ObjectCode\ColorSpaces\Debug\yuvtoyuvi.obj
+\NEWZIP\ObjectCode\ColorSpaces\Debug\yuy2toyv12.obj
+\NEWZIP\ObjectCode\ColorSpaces\Debug\yuy2toyv12f.obj
+\NEWZIP\ObjectCode\ColorSpaces\Debug\yvyutoyv12.obj
+\NEWZIP\ObjectCode\ColorSpaces\Debug\yvyutoyv12f.obj
+\NEWZIP\ObjectCode\ColorSpaces\Debug\rgb24toyv12_mmx.obj
+\NEWZIP\ObjectCode\ColorSpaces\Debug\rgb24toyv12_xmm.obj
+\NEWZIP\ObjectCode\ColorSpaces\Debug\rgb32toyv12_mmx.obj
+\NEWZIP\ObjectCode\ColorSpaces\Debug\rgb32toyv12_xmm.obj
+]
+Creating command line "link.exe -lib @C:\tmp\RSPB1A.tmp"
+<h3>Output Window</h3>
+Compiling...
+uyvytoyv12_mmx.c
+yuy2toyv12_mmx.c
+yvyutoyv12_mmx.c
+ColorConversions.c
+lutbl.c
+rgb24toyv12.c
+rgb24toyv12f.c
+rgb32toyv12.c
+rgb32toyv12f.c
+rgbtorgb.c
+rgbtoyuv.c
+rgbtoyuvi.c
+uyvytoyv12.c
+uyvytoyv12f.c
+yuvitorgb.c
+yuvitoyuv.c
+yuvtorgb.c
+yuvtoyuv.c
+yuvtoyuvi.c
+yuy2toyv12.c
+yuy2toyv12f.c
+yvyutoyv12.c
+yvyutoyv12f.c
+Creating library...
+
+
+
+<h3>Results</h3>
+s_cconv.lib - 0 error(s), 0 warning(s)
+<h3>
+--------------------Configuration: dxv - Win32 Release--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\tmp\RSPB1B.tmp" with contents
+[
+/nologo /G6 /MT /W3 /GX /O2 /I "..\include" /I "..\..\include" /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /Fp"..\..\..\..\ObjectCode\dxv\Release/dxv.pch" /YX /Fo"..\..\..\..\ObjectCode\dxv\Release/" /Fd"..\..\..\..\ObjectCode\dxv\Release/" /FD /c
+"C:\NEWZIP\VP6\corelibs\cdxv\dxv\generic\vscreen.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\dxv\generic\ximage.c"
+]
+Creating command line "cl.exe @C:\tmp\RSPB1B.tmp"
+Creating command line "link.exe -lib /nologo /out:"..\..\..\Lib\Win32\Release\s_dxv.lib" \NEWZIP\ObjectCode\dxv\Release\vscreen.obj \NEWZIP\ObjectCode\dxv\Release\ximage.obj "
+<h3>Output Window</h3>
+Compiling...
+vscreen.c
+ximage.c
+Creating library...
+
+
+
+<h3>Results</h3>
+s_dxv.lib - 0 error(s), 0 warning(s)
+<h3>
+--------------------Configuration: dxv - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\tmp\RSPB1C.tmp" with contents
+[
+/nologo /G6 /MTd /W3 /Gm /GX /ZI /Od /I "..\include" /I "..\..\include\win32" /I "..\..\include" /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /Fp"..\..\..\..\ObjectCode\dxv\debug/dxv.pch" /YX /Fo"..\..\..\..\ObjectCode\dxv\debug/" /Fd"..\..\..\..\ObjectCode\dxv\debug/" /FD /GZ /c
+"C:\NEWZIP\VP6\corelibs\cdxv\dxv\generic\vscreen.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\dxv\generic\ximage.c"
+]
+Creating command line "cl.exe @C:\tmp\RSPB1C.tmp"
+Creating command line "link.exe -lib /nologo /out:"..\..\..\Lib\Win32\Debug\s_dxv.lib" \NEWZIP\ObjectCode\dxv\debug\vscreen.obj \NEWZIP\ObjectCode\dxv\debug\ximage.obj "
+<h3>Output Window</h3>
+Compiling...
+vscreen.c
+ximage.c
+Creating library...
+
+
+
+<h3>Results</h3>
+s_dxv.lib - 0 error(s), 0 warning(s)
+<h3>
+--------------------Configuration: on2_mem - Win32 Release--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\tmp\RSPB1D.tmp" with contents
+[
+/nologo /MT /W3 /GX /O2 /I "..\..\include" /I "..\..\..\common\include" /I "..\..\memory_manager\include" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /Fp"..\..\..\..\obj\on2_mem\win32\release/on2_mem.pch" /YX /Fo"..\..\..\..\obj\on2_mem\win32\release/" /Fd"..\..\..\..\obj\on2_mem\win32\release/" /FD /c
+"C:\NEWZIP\VP6\corelibs\on2_common\src\on2_mem\memory_manager\hmm_alloc.c"
+"C:\NEWZIP\VP6\corelibs\on2_common\src\on2_mem\memory_manager\hmm_base.c"
+"C:\NEWZIP\VP6\corelibs\on2_common\src\on2_mem\memory_manager\hmm_dflt_abort.c"
+"C:\NEWZIP\VP6\corelibs\on2_common\src\on2_mem\memory_manager\hmm_grow.c"
+"C:\NEWZIP\VP6\corelibs\on2_common\src\on2_mem\memory_manager\hmm_largest.c"
+"C:\NEWZIP\VP6\corelibs\on2_common\src\on2_mem\memory_manager\hmm_resize.c"
+"C:\NEWZIP\VP6\corelibs\on2_common\src\on2_mem\memory_manager\hmm_shrink.c"
+"C:\NEWZIP\VP6\corelibs\on2_common\src\on2_mem\memory_manager\hmm_true.c"
+"C:\NEWZIP\VP6\corelibs\on2_common\src\on2_mem\on2_mem.c"
+"C:\NEWZIP\VP6\corelibs\on2_common\src\on2_mem\on2_mem_tracker.c"
+]
+Creating command line "cl.exe @C:\tmp\RSPB1D.tmp"
+Creating temporary file "C:\tmp\RSPB1E.tmp" with contents
+[
+/nologo /out:"..\..\..\..\..\..\lib\win32\release\on2_mem.lib"
+\NEWZIP\VP6\corelibs\on2_common\obj\on2_mem\win32\release\hmm_alloc.obj
+\NEWZIP\VP6\corelibs\on2_common\obj\on2_mem\win32\release\hmm_base.obj
+\NEWZIP\VP6\corelibs\on2_common\obj\on2_mem\win32\release\hmm_dflt_abort.obj
+\NEWZIP\VP6\corelibs\on2_common\obj\on2_mem\win32\release\hmm_grow.obj
+\NEWZIP\VP6\corelibs\on2_common\obj\on2_mem\win32\release\hmm_largest.obj
+\NEWZIP\VP6\corelibs\on2_common\obj\on2_mem\win32\release\hmm_resize.obj
+\NEWZIP\VP6\corelibs\on2_common\obj\on2_mem\win32\release\hmm_shrink.obj
+\NEWZIP\VP6\corelibs\on2_common\obj\on2_mem\win32\release\hmm_true.obj
+\NEWZIP\VP6\corelibs\on2_common\obj\on2_mem\win32\release\on2_mem.obj
+\NEWZIP\VP6\corelibs\on2_common\obj\on2_mem\win32\release\on2_mem_tracker.obj
+]
+Creating command line "link.exe -lib @C:\tmp\RSPB1E.tmp"
+<h3>Output Window</h3>
+Compiling...
+hmm_alloc.c
+hmm_base.c
+hmm_dflt_abort.c
+hmm_grow.c
+hmm_largest.c
+hmm_resize.c
+hmm_shrink.c
+hmm_true.c
+on2_mem.c
+on2_mem_tracker.c
+Creating library...
+
+
+
+<h3>Results</h3>
+on2_mem.lib - 0 error(s), 0 warning(s)
+<h3>
+--------------------Configuration: on2_mem - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\tmp\RSPB1F.tmp" with contents
+[
+/nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\include" /I "..\..\..\common\include" /I "..\..\memory_manager\include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /Fp"..\..\..\..\obj\on2_mem\win32\debug/on2_mem.pch" /YX /Fo"..\..\..\..\obj\on2_mem\win32\debug/" /Fd"..\..\..\..\obj\on2_mem\win32\debug/" /FD /GZ /c
+"C:\NEWZIP\VP6\corelibs\on2_common\src\on2_mem\memory_manager\hmm_alloc.c"
+"C:\NEWZIP\VP6\corelibs\on2_common\src\on2_mem\memory_manager\hmm_base.c"
+"C:\NEWZIP\VP6\corelibs\on2_common\src\on2_mem\memory_manager\hmm_dflt_abort.c"
+"C:\NEWZIP\VP6\corelibs\on2_common\src\on2_mem\memory_manager\hmm_grow.c"
+"C:\NEWZIP\VP6\corelibs\on2_common\src\on2_mem\memory_manager\hmm_largest.c"
+"C:\NEWZIP\VP6\corelibs\on2_common\src\on2_mem\memory_manager\hmm_resize.c"
+"C:\NEWZIP\VP6\corelibs\on2_common\src\on2_mem\memory_manager\hmm_shrink.c"
+"C:\NEWZIP\VP6\corelibs\on2_common\src\on2_mem\memory_manager\hmm_true.c"
+"C:\NEWZIP\VP6\corelibs\on2_common\src\on2_mem\on2_mem.c"
+"C:\NEWZIP\VP6\corelibs\on2_common\src\on2_mem\on2_mem_tracker.c"
+]
+Creating command line "cl.exe @C:\tmp\RSPB1F.tmp"
+Creating temporary file "C:\tmp\RSPB20.tmp" with contents
+[
+/nologo /out:"..\..\..\..\..\..\lib\win32\debug\on2_mem.lib"
+\NEWZIP\VP6\corelibs\on2_common\obj\on2_mem\win32\debug\hmm_alloc.obj
+\NEWZIP\VP6\corelibs\on2_common\obj\on2_mem\win32\debug\hmm_base.obj
+\NEWZIP\VP6\corelibs\on2_common\obj\on2_mem\win32\debug\hmm_dflt_abort.obj
+\NEWZIP\VP6\corelibs\on2_common\obj\on2_mem\win32\debug\hmm_grow.obj
+\NEWZIP\VP6\corelibs\on2_common\obj\on2_mem\win32\debug\hmm_largest.obj
+\NEWZIP\VP6\corelibs\on2_common\obj\on2_mem\win32\debug\hmm_resize.obj
+\NEWZIP\VP6\corelibs\on2_common\obj\on2_mem\win32\debug\hmm_shrink.obj
+\NEWZIP\VP6\corelibs\on2_common\obj\on2_mem\win32\debug\hmm_true.obj
+\NEWZIP\VP6\corelibs\on2_common\obj\on2_mem\win32\debug\on2_mem.obj
+\NEWZIP\VP6\corelibs\on2_common\obj\on2_mem\win32\debug\on2_mem_tracker.obj
+]
+Creating command line "link.exe -lib @C:\tmp\RSPB20.tmp"
+<h3>Output Window</h3>
+Compiling...
+hmm_alloc.c
+hmm_base.c
+hmm_dflt_abort.c
+hmm_grow.c
+hmm_largest.c
+hmm_resize.c
+hmm_shrink.c
+hmm_true.c
+on2_mem.c
+on2_mem_tracker.c
+Creating library...
+
+
+
+<h3>Results</h3>
+on2_mem.lib - 0 error(s), 0 warning(s)
+<h3>
+--------------------Configuration: preproc - Win32 Release--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\tmp\RSPB21.tmp" with contents
+[
+/nologo /G6 /MT /W3 /GX /O2 /I "..\vp60\include" /I "..\include" /I "..\..\include" /I ".\include" /I "..\..\..\include" /I "..\..\..\..\include" /I "..\..\..\..\include\vp60" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Fp"Release/preproc.pch" /YX /Fo"Release/" /Fd"Release/" /FD /c
+"C:\NEWZIP\VP6\corelibs\cdxv\preproc\preproc.c"
+]
+Creating command line "cl.exe @C:\tmp\RSPB21.tmp"
+Creating command line "link.exe -lib /nologo /out:"..\..\..\Lib\Win32\Release\s_preproc.lib" .\Release\preproc.obj "
+<h3>Output Window</h3>
+Compiling...
+preproc.c
+Creating library...
+
+
+
+<h3>Results</h3>
+s_preproc.lib - 0 error(s), 0 warning(s)
+<h3>
+--------------------Configuration: preproc - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\tmp\RSPB22.tmp" with contents
+[
+/nologo /G6 /MTd /W3 /Gm /GX /ZI /Od /I "..\vp60\include" /I "..\..\include" /I ".\include" /I "..\include" /I "..\..\..\include" /I "..\..\..\..\include" /I "..\..\..\..\include\vp60" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /Fo"Debug/" /Fd"Debug/" /FD /GZ /c
+"C:\NEWZIP\VP6\corelibs\cdxv\preproc\preproc.c"
+]
+Creating command line "cl.exe @C:\tmp\RSPB22.tmp"
+Creating command line "link.exe -lib /nologo /out:"..\..\..\Lib\Win32\Debug\s_preproc.lib" .\Debug\preproc.obj "
+<h3>Output Window</h3>
+Compiling...
+preproc.c
+Creating library...
+
+
+
+<h3>Results</h3>
+s_preproc.lib - 0 error(s), 0 warning(s)
+<h3>
+--------------------Configuration: vp6d - Win32 Release--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\tmp\RSPB23.tmp" with contents
+[
+/nologo /G6 /MT /W3 /GX /Ox /Ot /Oa /Ow /Og /Oi /Ob2 /I ".\include" /I "..\include" /I "..\..\include" /I "..\..\..\include" /I "..\..\..\..\include" /I "..\..\..\..\include\vp60" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "vp6D_EXPORTS" /D "PREDICT_2D" /D "PBDLL" /D "VFW_PB" /D "USE_DRAWDIB" /D "POSTPROCESS" /D "NORMALIZED" /D INLINE=__forceinline /D FORCEINLINE=__forceinline /Fo"..\..\..\..\ObjectCode\vp6d\Release/" /Fd"..\..\..\..\ObjectCode\vp6d\Release/" /FD /c
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\dx\Generic\boolhuff.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\dx\Generic\debug.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\dx\Generic\decodembs.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\dx\Generic\decodemode.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\dx\Generic\decodemv.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\DX\Generic\DFrameR.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\dx\Generic\FrameIni.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\dx\Generic\Huffman.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\DX\Generic\pb_globals.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\dx\Generic\quantize.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\dx\Generic\recon.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\dx\Generic\TokenEntropy.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\DX\Generic\vfwpbdll_if.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\dx\Win32\dsystemdependant.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\dx\Win32\quantindexmmx.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\dx\Win32\vp60dxv.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\xprintf\xprintf.cpp"
+]
+Creating command line "cl.exe @C:\tmp\RSPB23.tmp"
+Creating temporary file "C:\tmp\RSPB24.tmp" with contents
+[
+/nologo /out:"..\..\..\..\Lib\Win32\Release\s_vp60d.lib"
+\NEWZIP\VP6\ObjectCode\vp6d\Release\boolhuff.obj
+\NEWZIP\VP6\ObjectCode\vp6d\Release\debug.obj
+\NEWZIP\VP6\ObjectCode\vp6d\Release\decodembs.obj
+\NEWZIP\VP6\ObjectCode\vp6d\Release\decodemode.obj
+\NEWZIP\VP6\ObjectCode\vp6d\Release\decodemv.obj
+\NEWZIP\VP6\ObjectCode\vp6d\Release\DFrameR.obj
+\NEWZIP\VP6\ObjectCode\vp6d\Release\FrameIni.obj
+\NEWZIP\VP6\ObjectCode\vp6d\Release\Huffman.obj
+\NEWZIP\VP6\ObjectCode\vp6d\Release\pb_globals.obj
+\NEWZIP\VP6\ObjectCode\vp6d\Release\quantize.obj
+\NEWZIP\VP6\ObjectCode\vp6d\Release\recon.obj
+\NEWZIP\VP6\ObjectCode\vp6d\Release\TokenEntropy.obj
+\NEWZIP\VP6\ObjectCode\vp6d\Release\vfwpbdll_if.obj
+\NEWZIP\VP6\ObjectCode\vp6d\Release\dsystemdependant.obj
+\NEWZIP\VP6\ObjectCode\vp6d\Release\quantindexmmx.obj
+\NEWZIP\VP6\ObjectCode\vp6d\Release\vp60dxv.obj
+\NEWZIP\VP6\ObjectCode\vp6d\Release\xprintf.obj
+]
+Creating command line "link.exe -lib @C:\tmp\RSPB24.tmp"
+<h3>Output Window</h3>
+Compiling...
+boolhuff.c
+debug.c
+decodembs.c
+decodemode.c
+decodemv.c
+DFrameR.c
+FrameIni.c
+Huffman.c
+pb_globals.c
+quantize.c
+recon.c
+TokenEntropy.c
+vfwpbdll_if.c
+dsystemdependant.c
+quantindexmmx.c
+vp60dxv.c
+Generating Code...
+Compiling...
+xprintf.cpp
+Generating Code...
+Creating library...
+
+
+
+<h3>Results</h3>
+s_vp60d.lib - 0 error(s), 0 warning(s)
+<h3>
+--------------------Configuration: vp6d - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\tmp\RSPB25.tmp" with contents
+[
+/nologo /G6 /MTd /W3 /Gm /GX /Zi /Od /I ".\include" /I "..\include" /I "..\..\include" /I "..\..\..\..\include" /I "..\..\..\..\include\vp60" /I "..\..\..\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "vp6D_EXPORTS" /D "PREDICT_2D" /D "PBDLL" /D "VFW_PB" /D "USE_DRAWDIB" /D "POSTPROCESS" /D "NORMALIZED" /D INLINE=__forceinline /D FORCEINLINE=__forceinline /Fo"..\..\..\..\ObjectCode\vp6d\Debug/" /Fd"..\..\..\..\ObjectCode\vp6d\Debug/" /FD /c
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\dx\Generic\boolhuff.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\dx\Generic\debug.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\dx\Generic\decodembs.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\dx\Generic\decodemode.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\dx\Generic\decodemv.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\DX\Generic\DFrameR.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\dx\Generic\FrameIni.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\dx\Generic\Huffman.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\DX\Generic\pb_globals.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\dx\Generic\quantize.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\dx\Generic\recon.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\dx\Generic\TokenEntropy.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\DX\Generic\vfwpbdll_if.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\dx\Win32\dsystemdependant.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\dx\Win32\quantindexmmx.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\dx\Win32\vp60dxv.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\xprintf\xprintf.cpp"
+]
+Creating command line "cl.exe @C:\tmp\RSPB25.tmp"
+Creating temporary file "C:\tmp\RSPB26.tmp" with contents
+[
+/nologo /out:"..\..\..\..\Lib\Win32\Debug\s_vp60d.lib"
+\NEWZIP\VP6\ObjectCode\vp6d\Debug\boolhuff.obj
+\NEWZIP\VP6\ObjectCode\vp6d\Debug\debug.obj
+\NEWZIP\VP6\ObjectCode\vp6d\Debug\decodembs.obj
+\NEWZIP\VP6\ObjectCode\vp6d\Debug\decodemode.obj
+\NEWZIP\VP6\ObjectCode\vp6d\Debug\decodemv.obj
+\NEWZIP\VP6\ObjectCode\vp6d\Debug\DFrameR.obj
+\NEWZIP\VP6\ObjectCode\vp6d\Debug\FrameIni.obj
+\NEWZIP\VP6\ObjectCode\vp6d\Debug\Huffman.obj
+\NEWZIP\VP6\ObjectCode\vp6d\Debug\pb_globals.obj
+\NEWZIP\VP6\ObjectCode\vp6d\Debug\quantize.obj
+\NEWZIP\VP6\ObjectCode\vp6d\Debug\recon.obj
+\NEWZIP\VP6\ObjectCode\vp6d\Debug\TokenEntropy.obj
+\NEWZIP\VP6\ObjectCode\vp6d\Debug\vfwpbdll_if.obj
+\NEWZIP\VP6\ObjectCode\vp6d\Debug\dsystemdependant.obj
+\NEWZIP\VP6\ObjectCode\vp6d\Debug\quantindexmmx.obj
+\NEWZIP\VP6\ObjectCode\vp6d\Debug\vp60dxv.obj
+\NEWZIP\VP6\ObjectCode\vp6d\Debug\xprintf.obj
+]
+Creating command line "link.exe -lib @C:\tmp\RSPB26.tmp"
+<h3>Output Window</h3>
+Compiling...
+boolhuff.c
+debug.c
+decodembs.c
+decodemode.c
+decodemv.c
+DFrameR.c
+FrameIni.c
+Huffman.c
+pb_globals.c
+quantize.c
+recon.c
+TokenEntropy.c
+vfwpbdll_if.c
+dsystemdependant.c
+quantindexmmx.c
+vp60dxv.c
+Generating Code...
+Compiling...
+xprintf.cpp
+Generating Code...
+Creating library...
+
+
+
+<h3>Results</h3>
+s_vp60d.lib - 0 error(s), 0 warning(s)
+<h3>
+--------------------Configuration: vp6e - Win32 Release--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\tmp\RSPB27.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\..\ObjectCode\vp6e\Release\XmmSAD.lst /Fo .\..\..\..\..\ObjectCode\vp6e\Release\XmmSAD.obj .\cx\Win32\XmmSAD.asm
+]
+Creating command line "C:\tmp\RSPB27.bat"
+Creating temporary file "C:\tmp\RSPB28.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\..\ObjectCode\vp6e\Release\XmmGetSAD8.lst /Fo .\..\..\..\..\ObjectCode\vp6e\Release\XmmGetSAD8.obj .\CX\Win32\XmmGetSAD8.asm
+]
+Creating command line "C:\tmp\RSPB28.bat"
+Creating temporary file "C:\tmp\RSPB29.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\..\ObjectCode\vp6e\Release\XmmGetError.lst /Fo .\..\..\..\..\ObjectCode\vp6e\Release\XmmGetError.obj .\cx\Win32\XmmGetError.asm
+]
+Creating command line "C:\tmp\RSPB29.bat"
+Creating temporary file "C:\tmp\RSPB2A.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\..\ObjectCode\vp6e\Release\MmxEncodeMath.lst /Fo .\..\..\..\..\ObjectCode\vp6e\Release\MmxEncodeMath.obj .\cx\Win32\MmxEncodeMath.asm
+]
+Creating command line "C:\tmp\RSPB2A.bat"
+Creating temporary file "C:\tmp\RSPB2B.tmp" with contents
+[
+/nologo /G6 /MT /W3 /GX /O2 /I ".\include" /I "..\include" /I "..\..\include" /I "..\..\..\include" /I "..\..\..\..\include" /I "..\..\..\..\Include\vp60" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "vp6E_EXPORTS" /D "PREDICT_2D" /D "VFW_COMP" /D "COMPDLL" /D "POSTPROCESS" /D "CPUISLITTLEENDIAN" /D "NORMALIZED" /D INLINE=__forceinline /D FORCEINLINE=__forceinline /Fo"..\..\..\..\ObjectCode\vp6e\Release/" /Fd"..\..\..\..\ObjectCode\vp6e\Release/" /FD /c
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\CX\Generic\Comp_Globals.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\cx\Generic\Encode.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\cx\Generic\encodembs.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\cx\Generic\encodemode.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\cx\Generic\encodemv.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\cx\Generic\fullframefdct.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\CX\Generic\mcomp.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\CX\Generic\misc_common.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\cx\Generic\PackVideo.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\cx\Generic\PickModes.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\cx\Generic\RawBuffer.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\cx\Generic\Tokenize.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\cx\Generic\Transform.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\cx\Generic\twopass.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\CX\Generic\vfwcomp.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\CX\Generic\vfwcomp_if.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\cx\Win32\COptFunctions.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\cx\Win32\csystemdependant.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\cx\Win32\CWmtFunctions.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\cx\Win32\WmtTransform.c"
+]
+Creating command line "cl.exe @C:\tmp\RSPB2B.tmp"
+Performing Custom Build Step on .\cx\Win32\XmmSAD.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\cx\Win32\XmmSAD.asm
+Performing Custom Build Step on .\CX\Win32\XmmGetSAD8.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\CX\Win32\XmmGetSAD8.asm
+Performing Custom Build Step on .\cx\Win32\XmmGetError.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\cx\Win32\XmmGetError.asm
+Performing Custom Build Step on .\cx\Win32\MmxEncodeMath.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\cx\Win32\MmxEncodeMath.asm
+Creating temporary file "C:\tmp\RSPB2C.tmp" with contents
+[
+/nologo /out:"..\..\..\..\Lib\Win32\Release\s_vp60e.lib"
+\NEWZIP\VP6\ObjectCode\vp6e\Release\Comp_Globals.obj
+\NEWZIP\VP6\ObjectCode\vp6e\Release\Encode.obj
+\NEWZIP\VP6\ObjectCode\vp6e\Release\encodembs.obj
+\NEWZIP\VP6\ObjectCode\vp6e\Release\encodemode.obj
+\NEWZIP\VP6\ObjectCode\vp6e\Release\encodemv.obj
+\NEWZIP\VP6\ObjectCode\vp6e\Release\fullframefdct.obj
+\NEWZIP\VP6\ObjectCode\vp6e\Release\mcomp.obj
+\NEWZIP\VP6\ObjectCode\vp6e\Release\misc_common.obj
+\NEWZIP\VP6\ObjectCode\vp6e\Release\PackVideo.obj
+\NEWZIP\VP6\ObjectCode\vp6e\Release\PickModes.obj
+\NEWZIP\VP6\ObjectCode\vp6e\Release\RawBuffer.obj
+\NEWZIP\VP6\ObjectCode\vp6e\Release\Tokenize.obj
+\NEWZIP\VP6\ObjectCode\vp6e\Release\Transform.obj
+\NEWZIP\VP6\ObjectCode\vp6e\Release\twopass.obj
+\NEWZIP\VP6\ObjectCode\vp6e\Release\vfwcomp.obj
+\NEWZIP\VP6\ObjectCode\vp6e\Release\vfwcomp_if.obj
+\NEWZIP\VP6\ObjectCode\vp6e\Release\COptFunctions.obj
+\NEWZIP\VP6\ObjectCode\vp6e\Release\csystemdependant.obj
+\NEWZIP\VP6\ObjectCode\vp6e\Release\CWmtFunctions.obj
+\NEWZIP\VP6\ObjectCode\vp6e\Release\WmtTransform.obj
+\NEWZIP\VP6\ObjectCode\vp6e\Release\MmxEncodeMath.obj
+\NEWZIP\VP6\ObjectCode\vp6e\Release\XmmGetError.obj
+\NEWZIP\VP6\ObjectCode\vp6e\Release\XmmGetSAD8.obj
+\NEWZIP\VP6\ObjectCode\vp6e\Release\XmmSAD.obj
+]
+Creating command line "link.exe -lib @C:\tmp\RSPB2C.tmp"
+<h3>Output Window</h3>
+Compiling...
+Comp_Globals.c
+Encode.c
+encodembs.c
+encodemode.c
+encodemv.c
+fullframefdct.c
+mcomp.c
+misc_common.c
+PackVideo.c
+PickModes.c
+RawBuffer.c
+Tokenize.c
+Transform.c
+twopass.c
+vfwcomp.c
+vfwcomp_if.c
+COptFunctions.c
+csystemdependant.c
+CWmtFunctions.c
+WmtTransform.c
+Generating Code...
+Creating library...
+
+
+
+<h3>Results</h3>
+s_vp60e.lib - 0 error(s), 0 warning(s)
+<h3>
+--------------------Configuration: vp6e - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\tmp\RSPB2D.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\..\ObjectCode\vp6e\debug\XmmSAD.lst /Fo .\..\..\..\..\ObjectCode\vp6e\debug\XmmSAD.obj .\cx\Win32\XmmSAD.asm
+]
+Creating command line "C:\tmp\RSPB2D.bat"
+Creating temporary file "C:\tmp\RSPB2E.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\..\ObjectCode\vp6e\debug\XmmGetSAD8.lst /Fo .\..\..\..\..\ObjectCode\vp6e\debug\XmmGetSAD8.obj .\CX\Win32\XmmGetSAD8.asm
+]
+Creating command line "C:\tmp\RSPB2E.bat"
+Creating temporary file "C:\tmp\RSPB2F.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\..\ObjectCode\vp6e\debug\XmmGetError.lst /Fo .\..\..\..\..\ObjectCode\vp6e\debug\XmmGetError.obj .\cx\Win32\XmmGetError.asm
+]
+Creating command line "C:\tmp\RSPB2F.bat"
+Creating temporary file "C:\tmp\RSPB30.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\..\ObjectCode\vp6e\debug\MmxEncodeMath.lst /Fo .\..\..\..\..\ObjectCode\vp6e\debug\MmxEncodeMath.obj .\cx\Win32\MmxEncodeMath.asm
+]
+Creating command line "C:\tmp\RSPB30.bat"
+Creating temporary file "C:\tmp\RSPB31.tmp" with contents
+[
+/nologo /G6 /MTd /W3 /Gm /GX /Zi /Od /I ".\include" /I "..\include" /I "..\..\include" /I "..\..\..\include" /I "..\..\..\..\include" /I "..\..\..\..\Include\vp60" /I "..\..\..\..\include\vp60" /D "vp6E_EXPORTS" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PREDICT_2D" /D "VFW_COMP" /D "COMPDLL" /D "POSTPROCESS" /D "CPUISLITTLEENDIAN" /D "NORMALIZED" /D INLINE=__forceinline /D FORCEINLINE=__forceinline /Fo"..\..\..\..\ObjectCode\vp6e\debug/" /Fd"..\..\..\..\ObjectCode\vp6e\debug/" /FD /GZ /c
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\CX\Generic\Comp_Globals.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\cx\Generic\Encode.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\cx\Generic\encodembs.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\cx\Generic\encodemode.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\cx\Generic\encodemv.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\cx\Generic\fullframefdct.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\CX\Generic\mcomp.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\CX\Generic\misc_common.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\cx\Generic\PackVideo.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\cx\Generic\PickModes.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\cx\Generic\RawBuffer.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\cx\Generic\Tokenize.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\cx\Generic\Transform.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\cx\Generic\twopass.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\CX\Generic\vfwcomp.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\CX\Generic\vfwcomp_if.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\cx\Win32\COptFunctions.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\cx\Win32\csystemdependant.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\cx\Win32\CWmtFunctions.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\VP60\vp60\cx\Win32\WmtTransform.c"
+]
+Creating command line "cl.exe @C:\tmp\RSPB31.tmp"
+Performing Custom Build Step on .\cx\Win32\XmmSAD.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\cx\Win32\XmmSAD.asm
+Performing Custom Build Step on .\CX\Win32\XmmGetSAD8.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\CX\Win32\XmmGetSAD8.asm
+Performing Custom Build Step on .\cx\Win32\XmmGetError.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\cx\Win32\XmmGetError.asm
+Performing Custom Build Step on .\cx\Win32\MmxEncodeMath.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\cx\Win32\MmxEncodeMath.asm
+Creating temporary file "C:\tmp\RSPB32.tmp" with contents
+[
+/nologo /out:"..\..\..\..\Lib\Win32\Debug\s_vp60e.lib"
+\NEWZIP\VP6\ObjectCode\vp6e\debug\Comp_Globals.obj
+\NEWZIP\VP6\ObjectCode\vp6e\debug\Encode.obj
+\NEWZIP\VP6\ObjectCode\vp6e\debug\encodembs.obj
+\NEWZIP\VP6\ObjectCode\vp6e\debug\encodemode.obj
+\NEWZIP\VP6\ObjectCode\vp6e\debug\encodemv.obj
+\NEWZIP\VP6\ObjectCode\vp6e\debug\fullframefdct.obj
+\NEWZIP\VP6\ObjectCode\vp6e\debug\mcomp.obj
+\NEWZIP\VP6\ObjectCode\vp6e\debug\misc_common.obj
+\NEWZIP\VP6\ObjectCode\vp6e\debug\PackVideo.obj
+\NEWZIP\VP6\ObjectCode\vp6e\debug\PickModes.obj
+\NEWZIP\VP6\ObjectCode\vp6e\debug\RawBuffer.obj
+\NEWZIP\VP6\ObjectCode\vp6e\debug\Tokenize.obj
+\NEWZIP\VP6\ObjectCode\vp6e\debug\Transform.obj
+\NEWZIP\VP6\ObjectCode\vp6e\debug\twopass.obj
+\NEWZIP\VP6\ObjectCode\vp6e\debug\vfwcomp.obj
+\NEWZIP\VP6\ObjectCode\vp6e\debug\vfwcomp_if.obj
+\NEWZIP\VP6\ObjectCode\vp6e\debug\COptFunctions.obj
+\NEWZIP\VP6\ObjectCode\vp6e\debug\csystemdependant.obj
+\NEWZIP\VP6\ObjectCode\vp6e\debug\CWmtFunctions.obj
+\NEWZIP\VP6\ObjectCode\vp6e\debug\WmtTransform.obj
+\NEWZIP\VP6\ObjectCode\vp6e\debug\MmxEncodeMath.obj
+\NEWZIP\VP6\ObjectCode\vp6e\debug\XmmGetError.obj
+\NEWZIP\VP6\ObjectCode\vp6e\debug\XmmGetSAD8.obj
+\NEWZIP\VP6\ObjectCode\vp6e\debug\XmmSAD.obj
+]
+Creating command line "link.exe -lib @C:\tmp\RSPB32.tmp"
+<h3>Output Window</h3>
+Compiling...
+Comp_Globals.c
+Encode.c
+encodembs.c
+encodemode.c
+encodemv.c
+fullframefdct.c
+mcomp.c
+misc_common.c
+PackVideo.c
+PickModes.c
+RawBuffer.c
+Tokenize.c
+Transform.c
+twopass.c
+vfwcomp.c
+vfwcomp_if.c
+COptFunctions.c
+csystemdependant.c
+CWmtFunctions.c
+WmtTransform.c
+Generating Code...
+Creating library...
+
+
+
+<h3>Results</h3>
+s_vp60e.lib - 0 error(s), 0 warning(s)
+<h3>
+--------------------Configuration: vppp - Win32 Release--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\tmp\RSPB33.tmp" with contents
+[
+/nologo /G6 /MT /W3 /GX /Zi /O2 /Ob2 /I ".\include" /I "..\include" /I "..\vp60\include" /I "..\..\..\include" /I "..\..\include" /D "_MBCS" /D "_LIB" /D "NDEBUG" /D INLINE=__inline /D "WIN32" /Fo"..\..\..\..\ObjectCode\vpppd6\Release/" /Fd"..\..\..\..\ObjectCode\vpppd6\Release/" /FD /c
+"C:\NEWZIP\VP6\corelibs\cdxv\vppp\generic\borders.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vppp\generic\clamp.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vppp\generic\deblock.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vppp\generic\DeInterlace.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vppp\generic\dering.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vppp\generic\loopfilter.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vppp\generic\postproc.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vppp\generic\scale.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vppp\generic\simpledeblocker.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vppp\win32\clamp_asm.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vppp\win32\deblockopt.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vppp\win32\deblockwmtopt.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vppp\win32\DeInterlaceMmx.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vppp\win32\DeInterlaceWmt.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vppp\win32\deringopt.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vppp\win32\deringwmtopt.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vppp\win32\doptsystemdependant.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vppp\win32\loopf_asm.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vppp\win32\newlooptest_asm.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vppp\win32\scaleopt.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vppp\win32\simpledeblock_asm.c"
+]
+Creating command line "cl.exe @C:\tmp\RSPB33.tmp"
+Creating temporary file "C:\tmp\RSPB34.tmp" with contents
+[
+/nologo /out:"..\..\..\Lib\Win32\release\s_vpppd.lib"
+\NEWZIP\ObjectCode\vpppd6\Release\borders.obj
+\NEWZIP\ObjectCode\vpppd6\Release\clamp.obj
+\NEWZIP\ObjectCode\vpppd6\Release\deblock.obj
+\NEWZIP\ObjectCode\vpppd6\Release\DeInterlace.obj
+\NEWZIP\ObjectCode\vpppd6\Release\dering.obj
+\NEWZIP\ObjectCode\vpppd6\Release\loopfilter.obj
+\NEWZIP\ObjectCode\vpppd6\Release\postproc.obj
+\NEWZIP\ObjectCode\vpppd6\Release\scale.obj
+\NEWZIP\ObjectCode\vpppd6\Release\simpledeblocker.obj
+\NEWZIP\ObjectCode\vpppd6\Release\clamp_asm.obj
+\NEWZIP\ObjectCode\vpppd6\Release\deblockopt.obj
+\NEWZIP\ObjectCode\vpppd6\Release\deblockwmtopt.obj
+\NEWZIP\ObjectCode\vpppd6\Release\DeInterlaceMmx.obj
+\NEWZIP\ObjectCode\vpppd6\Release\DeInterlaceWmt.obj
+\NEWZIP\ObjectCode\vpppd6\Release\deringopt.obj
+\NEWZIP\ObjectCode\vpppd6\Release\deringwmtopt.obj
+\NEWZIP\ObjectCode\vpppd6\Release\doptsystemdependant.obj
+\NEWZIP\ObjectCode\vpppd6\Release\loopf_asm.obj
+\NEWZIP\ObjectCode\vpppd6\Release\newlooptest_asm.obj
+\NEWZIP\ObjectCode\vpppd6\Release\scaleopt.obj
+\NEWZIP\ObjectCode\vpppd6\Release\simpledeblock_asm.obj
+]
+Creating command line "link.exe -lib @C:\tmp\RSPB34.tmp"
+<h3>Output Window</h3>
+Compiling...
+borders.c
+clamp.c
+deblock.c
+DeInterlace.c
+dering.c
+loopfilter.c
+postproc.c
+scale.c
+simpledeblocker.c
+clamp_asm.c
+deblockopt.c
+deblockwmtopt.c
+DeInterlaceMmx.c
+DeInterlaceWmt.c
+deringopt.c
+deringwmtopt.c
+doptsystemdependant.c
+loopf_asm.c
+newlooptest_asm.c
+scaleopt.c
+Generating Code...
+Compiling...
+simpledeblock_asm.c
+Generating Code...
+Creating library...
+
+
+
+<h3>Results</h3>
+s_vpppd.lib - 0 error(s), 0 warning(s)
+<h3>
+--------------------Configuration: vppp - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\tmp\RSPB35.tmp" with contents
+[
+/nologo /G6 /MTd /W3 /Gm /GX /Zi /Od /I ".\include" /I "..\include" /I "..\vp60\include" /I "..\..\..\include" /I "..\..\include" /D "_MBCS" /D "_LIB" /D "_DEBUG" /D INLINE=__inline /D "WIN32" /Fp"..\..\..\..\ObjectCode\vppp\Debug/vppp.pch" /YX /Fo"..\..\..\..\ObjectCode\vppp\Debug/" /Fd"..\..\..\..\ObjectCode\vppp\Debug/" /FD /GZ /c
+"C:\NEWZIP\VP6\corelibs\cdxv\vppp\generic\borders.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vppp\generic\clamp.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vppp\generic\deblock.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vppp\generic\DeInterlace.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vppp\generic\dering.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vppp\generic\loopfilter.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vppp\generic\postproc.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vppp\generic\scale.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vppp\generic\simpledeblocker.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vppp\win32\clamp_asm.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vppp\win32\deblockopt.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vppp\win32\deblockwmtopt.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vppp\win32\DeInterlaceMmx.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vppp\win32\DeInterlaceWmt.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vppp\win32\deringopt.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vppp\win32\deringwmtopt.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vppp\win32\doptsystemdependant.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vppp\win32\loopf_asm.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vppp\win32\newlooptest_asm.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vppp\win32\scaleopt.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vppp\win32\simpledeblock_asm.c"
+]
+Creating command line "cl.exe @C:\tmp\RSPB35.tmp"
+Creating temporary file "C:\tmp\RSPB36.tmp" with contents
+[
+/nologo /out:"..\..\..\Lib\Win32\Debug\s_vpppd.lib"
+\NEWZIP\ObjectCode\vppp\Debug\borders.obj
+\NEWZIP\ObjectCode\vppp\Debug\clamp.obj
+\NEWZIP\ObjectCode\vppp\Debug\deblock.obj
+\NEWZIP\ObjectCode\vppp\Debug\DeInterlace.obj
+\NEWZIP\ObjectCode\vppp\Debug\dering.obj
+\NEWZIP\ObjectCode\vppp\Debug\loopfilter.obj
+\NEWZIP\ObjectCode\vppp\Debug\postproc.obj
+\NEWZIP\ObjectCode\vppp\Debug\scale.obj
+\NEWZIP\ObjectCode\vppp\Debug\simpledeblocker.obj
+\NEWZIP\ObjectCode\vppp\Debug\clamp_asm.obj
+\NEWZIP\ObjectCode\vppp\Debug\deblockopt.obj
+\NEWZIP\ObjectCode\vppp\Debug\deblockwmtopt.obj
+\NEWZIP\ObjectCode\vppp\Debug\DeInterlaceMmx.obj
+\NEWZIP\ObjectCode\vppp\Debug\DeInterlaceWmt.obj
+\NEWZIP\ObjectCode\vppp\Debug\deringopt.obj
+\NEWZIP\ObjectCode\vppp\Debug\deringwmtopt.obj
+\NEWZIP\ObjectCode\vppp\Debug\doptsystemdependant.obj
+\NEWZIP\ObjectCode\vppp\Debug\loopf_asm.obj
+\NEWZIP\ObjectCode\vppp\Debug\newlooptest_asm.obj
+\NEWZIP\ObjectCode\vppp\Debug\scaleopt.obj
+\NEWZIP\ObjectCode\vppp\Debug\simpledeblock_asm.obj
+]
+Creating command line "link.exe -lib @C:\tmp\RSPB36.tmp"
+<h3>Output Window</h3>
+Compiling...
+borders.c
+clamp.c
+deblock.c
+DeInterlace.c
+dering.c
+loopfilter.c
+postproc.c
+scale.c
+simpledeblocker.c
+clamp_asm.c
+deblockopt.c
+deblockwmtopt.c
+DeInterlaceMmx.c
+DeInterlaceWmt.c
+deringopt.c
+deringwmtopt.c
+doptsystemdependant.c
+loopf_asm.c
+newlooptest_asm.c
+scaleopt.c
+simpledeblock_asm.c
+Creating library...
+
+
+
+<h3>Results</h3>
+s_vpppd.lib - 0 error(s), 0 warning(s)
+<h3>
+--------------------Configuration: vputil - Win32 Release--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\tmp\RSPB37.tmp" with contents
+[
+/nologo /G6 /MT /W3 /GX /O2 /I ".\include" /I "..\include" /I "..\..\..\include" /I "..\vp60\include" /I "..\..\include" /I "..\..\..\..\include" /I "..\..\..\..\include\vp60" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /Fo"..\..\..\..\ObjectCode\vputil\Release/" /Fd"..\..\..\..\ObjectCode\vputil\Release/" /FD /c
+"C:\NEWZIP\VP6\corelibs\cdxv\vputil\generic\fdct.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vputil\generic\idctpart.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vputil\generic\reconstruct.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vputil\generic\vputil.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vputil\win32\fdctmmx.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vputil\win32\fdctwmt.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vputil\win32\filtmmx.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vputil\win32\filtwmt.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vputil\win32\mmxidct.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vputil\win32\mmxrecon.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vputil\win32\uoptsystemdependant.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vputil\win32\vputilasm.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vputil\win32\wmtidct.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vputil\win32\wmtrecon.c"
+]
+Creating command line "cl.exe @C:\tmp\RSPB37.tmp"
+Creating temporary file "C:\tmp\RSPB38.tmp" with contents
+[
+/nologo /out:"..\..\..\Lib\Win32\Release\s_vputil.lib"
+\NEWZIP\ObjectCode\vputil\Release\fdct.obj
+\NEWZIP\ObjectCode\vputil\Release\idctpart.obj
+\NEWZIP\ObjectCode\vputil\Release\reconstruct.obj
+\NEWZIP\ObjectCode\vputil\Release\vputil.obj
+\NEWZIP\ObjectCode\vputil\Release\fdctmmx.obj
+\NEWZIP\ObjectCode\vputil\Release\fdctwmt.obj
+\NEWZIP\ObjectCode\vputil\Release\filtmmx.obj
+\NEWZIP\ObjectCode\vputil\Release\filtwmt.obj
+\NEWZIP\ObjectCode\vputil\Release\mmxidct.obj
+\NEWZIP\ObjectCode\vputil\Release\mmxrecon.obj
+\NEWZIP\ObjectCode\vputil\Release\uoptsystemdependant.obj
+\NEWZIP\ObjectCode\vputil\Release\vputilasm.obj
+\NEWZIP\ObjectCode\vputil\Release\wmtidct.obj
+\NEWZIP\ObjectCode\vputil\Release\wmtrecon.obj
+]
+Creating command line "link.exe -lib @C:\tmp\RSPB38.tmp"
+<h3>Output Window</h3>
+Compiling...
+fdct.c
+idctpart.c
+reconstruct.c
+vputil.c
+fdctmmx.c
+fdctwmt.c
+filtmmx.c
+filtwmt.c
+mmxidct.c
+mmxrecon.c
+uoptsystemdependant.c
+vputilasm.c
+wmtidct.c
+wmtrecon.c
+Generating Code...
+Creating library...
+
+
+
+<h3>Results</h3>
+s_vputil.lib - 0 error(s), 0 warning(s)
+<h3>
+--------------------Configuration: vputil - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\tmp\RSPB39.tmp" with contents
+[
+/nologo /G6 /MTd /W3 /Gm /GX /ZI /Od /I ".\include" /I "..\include" /I "..\..\..\include" /I "..\vp60\include" /I "..\..\include" /I "..\..\..\..\include" /I "..\..\..\..\include\vp60" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /Fp"..\..\..\..\..\ObjectCode\vputil\Debug/vputil.pch" /YX /Fo"..\..\..\..\..\ObjectCode\vputil\Debug/" /Fd"..\..\..\..\..\ObjectCode\vputil\Debug/" /FD /GZ /c
+"C:\NEWZIP\VP6\corelibs\cdxv\vputil\generic\fdct.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vputil\generic\idctpart.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vputil\generic\reconstruct.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vputil\generic\vputil.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vputil\win32\fdctmmx.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vputil\win32\fdctwmt.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vputil\win32\filtmmx.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vputil\win32\filtwmt.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vputil\win32\mmxidct.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vputil\win32\mmxrecon.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vputil\win32\uoptsystemdependant.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vputil\win32\vputilasm.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vputil\win32\wmtidct.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vputil\win32\wmtrecon.c"
+]
+Creating command line "cl.exe @C:\tmp\RSPB39.tmp"
+Creating temporary file "C:\tmp\RSPB3A.tmp" with contents
+[
+/nologo /out:"..\..\..\Lib\Win32\Debug\s_vputil.lib"
+\ObjectCode\vputil\Debug\fdct.obj
+\ObjectCode\vputil\Debug\idctpart.obj
+\ObjectCode\vputil\Debug\reconstruct.obj
+\ObjectCode\vputil\Debug\vputil.obj
+\ObjectCode\vputil\Debug\fdctmmx.obj
+\ObjectCode\vputil\Debug\fdctwmt.obj
+\ObjectCode\vputil\Debug\filtmmx.obj
+\ObjectCode\vputil\Debug\filtwmt.obj
+\ObjectCode\vputil\Debug\mmxidct.obj
+\ObjectCode\vputil\Debug\mmxrecon.obj
+\ObjectCode\vputil\Debug\uoptsystemdependant.obj
+\ObjectCode\vputil\Debug\vputilasm.obj
+\ObjectCode\vputil\Debug\wmtidct.obj
+\ObjectCode\vputil\Debug\wmtrecon.obj
+]
+Creating command line "link.exe -lib @C:\tmp\RSPB3A.tmp"
+<h3>Output Window</h3>
+Compiling...
+fdct.c
+idctpart.c
+reconstruct.c
+vputil.c
+fdctmmx.c
+fdctwmt.c
+filtmmx.c
+filtwmt.c
+mmxidct.c
+mmxrecon.c
+uoptsystemdependant.c
+vputilasm.c
+wmtidct.c
+wmtrecon.c
+Creating library...
+
+
+
+<h3>Results</h3>
+s_vputil.lib - 0 error(s), 0 warning(s)
+<h3>
+--------------------Configuration: vpxblit - Win32 Release--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\tmp\RSPB3B.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\..\..\ObjectCode\vpxblit\Release\const.lst /Fo .\..\..\..\..\..\ObjectCode\vpxblit\Release\const.obj .\wx86\const.asm
+]
+Creating command line "C:\tmp\RSPB3B.bat"
+Creating temporary file "C:\tmp\RSPB3C.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\..\..\ObjectCode\vpxblit\Release\bcy00.lst /Fo .\..\..\..\..\..\ObjectCode\vpxblit\Release\bcy00.obj .\wx86\bcy00.asm
+]
+Creating command line "C:\tmp\RSPB3C.bat"
+Creating temporary file "C:\tmp\RSPB3D.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\..\..\ObjectCode\vpxblit\Release\bcu00.lst /Fo .\..\..\..\..\..\ObjectCode\vpxblit\Release\bcu00.obj .\wx86\bcu00.asm
+]
+Creating command line "C:\tmp\RSPB3D.bat"
+Creating temporary file "C:\tmp\RSPB3E.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\..\..\ObjectCode\vpxblit\Release\bct10.lst /Fo .\..\..\..\..\..\ObjectCode\vpxblit\Release\bct10.obj .\wx86\bct10.asm
+]
+Creating command line "C:\tmp\RSPB3E.bat"
+Creating temporary file "C:\tmp\RSPB3F.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\..\..\ObjectCode\vpxblit\Release\bct00.lst /Fo .\..\..\..\..\..\ObjectCode\vpxblit\Release\bct00.obj .\wx86\bct00.asm
+]
+Creating command line "C:\tmp\RSPB3F.bat"
+Creating temporary file "C:\tmp\RSPB40.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\..\..\ObjectCode\vpxblit\Release\bcs10.lst /Fo .\..\..\..\..\..\ObjectCode\vpxblit\Release\bcs10.obj .\wx86\bcs10.asm
+]
+Creating command line "C:\tmp\RSPB40.bat"
+Creating temporary file "C:\tmp\RSPB41.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\..\..\ObjectCode\vpxblit\Release\bcs00.lst /Fo .\..\..\..\..\..\ObjectCode\vpxblit\Release\bcs00.obj .\wx86\bcs00.asm
+]
+Creating command line "C:\tmp\RSPB41.bat"
+Creating temporary file "C:\tmp\RSPB42.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\..\..\ObjectCode\vpxblit\Release\bcf10.lst /Fo .\..\..\..\..\..\ObjectCode\vpxblit\Release\bcf10.obj .\wx86\bcf10.asm
+]
+Creating command line "C:\tmp\RSPB42.bat"
+Creating temporary file "C:\tmp\RSPB43.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\..\..\ObjectCode\vpxblit\Release\bcf00.lst /Fo .\..\..\..\..\..\ObjectCode\vpxblit\Release\bcf00.obj .\wx86\bcf00.asm
+]
+Creating command line "C:\tmp\RSPB43.bat"
+Creating temporary file "C:\tmp\RSPB44.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\..\..\ObjectCode\vpxblit\Release\bcd00.lst /Fo .\..\..\..\..\..\ObjectCode\vpxblit\Release\bcd00.obj .\wx86\bcd00.asm
+]
+Creating command line "C:\tmp\RSPB44.bat"
+Creating temporary file "C:\tmp\RSPB45.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\..\..\ObjectCode\vpxblit\Release\bcc10.lst /Fo .\..\..\..\..\..\ObjectCode\vpxblit\Release\bcc10.obj .\wx86\bcc10.asm
+]
+Creating command line "C:\tmp\RSPB45.bat"
+Creating temporary file "C:\tmp\RSPB46.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\..\..\ObjectCode\vpxblit\Release\bcc00.lst /Fo .\..\..\..\..\..\ObjectCode\vpxblit\Release\bcc00.obj .\wx86\bcc00.asm
+]
+Creating command line "C:\tmp\RSPB46.bat"
+Creating temporary file "C:\tmp\RSPB47.tmp" with contents
+[
+/nologo /G6 /MT /W3 /GX /Zi /O2 /I "..\..\include" /I "..\..\..\include\vp31" /I "..\..\..\include" /I ".\generic" /D "_WINDOWS" /D "NDEBUG" /D INLINE=__inline /D "WIN32" /Fo"..\..\..\..\..\ObjectCode\vpxblit\Release/" /Fd"..\..\..\..\..\ObjectCode\vpxblit\Release/" /FD /c
+"C:\NEWZIP\VP6\corelibs\cdxv\vpxblit\win32\ctables.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vpxblit\win32\wksetblt.c"
+]
+Creating command line "cl.exe @C:\tmp\RSPB47.tmp"
+Creating temporary file "C:\tmp\RSPB48.tmp" with contents
+[
+/nologo /G6 /MT /W3 /GX /Zi /O2 /I "..\..\include" /I "..\..\..\include\vp31" /I "..\..\..\include" /D "_WINDOWS" /D "NDEBUG" /D INLINE=__inline /D "WIN32" /Fo"..\..\..\..\..\ObjectCode\vpxblit\Release/" /Fd"..\..\..\..\..\ObjectCode\vpxblit\Release/" /FD /c
+"C:\NEWZIP\VP6\corelibs\cdxv\vpxblit\generic\bcf00_c.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vpxblit\generic\bcf10_c.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vpxblit\generic\bcs00_c.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vpxblit\generic\bcs10_c.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vpxblit\generic\bct00_c.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vpxblit\generic\bct10_c.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vpxblit\generic\bcu00_c.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vpxblit\generic\bcy00_c.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vpxblit\generic\vpx_reg.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vpxblit\generic\bct00_targa_c.c"
+]
+Creating command line "cl.exe @C:\tmp\RSPB48.tmp"
+Performing Custom Build Step on .\wx86\const.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\wx86\const.asm
+Performing Custom Build Step on .\wx86\bcy00.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\wx86\bcy00.asm
+Performing Custom Build Step on .\wx86\bcu00.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\wx86\bcu00.asm
+Performing Custom Build Step on .\wx86\bct10.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\wx86\bct10.asm
+Performing Custom Build Step on .\wx86\bct00.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\wx86\bct00.asm
+Performing Custom Build Step on .\wx86\bcs10.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\wx86\bcs10.asm
+Performing Custom Build Step on .\wx86\bcs00.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\wx86\bcs00.asm
+Performing Custom Build Step on .\wx86\bcf10.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\wx86\bcf10.asm
+Performing Custom Build Step on .\wx86\bcf00.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\wx86\bcf00.asm
+Performing Custom Build Step on .\wx86\bcd00.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\wx86\bcd00.asm
+Performing Custom Build Step on .\wx86\bcc10.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\wx86\bcc10.asm
+Performing Custom Build Step on .\wx86\bcc00.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\wx86\bcc00.asm
+Creating temporary file "C:\tmp\RSPB49.tmp" with contents
+[
+/nologo /out:"..\..\..\Lib\Win32\Release\s_vpxblit.lib"
+\ObjectCode\vpxblit\Release\ctables.obj
+\ObjectCode\vpxblit\Release\wksetblt.obj
+\ObjectCode\vpxblit\Release\bcf00_c.obj
+\ObjectCode\vpxblit\Release\bcf10_c.obj
+\ObjectCode\vpxblit\Release\bcs00_c.obj
+\ObjectCode\vpxblit\Release\bcs10_c.obj
+\ObjectCode\vpxblit\Release\bct00_c.obj
+\ObjectCode\vpxblit\Release\bct10_c.obj
+\ObjectCode\vpxblit\Release\bcu00_c.obj
+\ObjectCode\vpxblit\Release\bcy00_c.obj
+\ObjectCode\vpxblit\Release\vpx_reg.obj
+\ObjectCode\vpxblit\Release\bct00_targa_c.obj
+\ObjectCode\vpxblit\Release\bcc00.obj
+\ObjectCode\vpxblit\Release\bcc10.obj
+\ObjectCode\vpxblit\Release\bcd00.obj
+\ObjectCode\vpxblit\Release\bcf00.obj
+\ObjectCode\vpxblit\Release\bcf10.obj
+\ObjectCode\vpxblit\Release\bcs00.obj
+\ObjectCode\vpxblit\Release\bcs10.obj
+\ObjectCode\vpxblit\Release\bct00.obj
+\ObjectCode\vpxblit\Release\bct10.obj
+\ObjectCode\vpxblit\Release\bcu00.obj
+\ObjectCode\vpxblit\Release\bcy00.obj
+\ObjectCode\vpxblit\Release\const.obj
+]
+Creating command line "link.exe -lib @C:\tmp\RSPB49.tmp"
+<h3>Output Window</h3>
+Compiling...
+ctables.c
+wksetblt.c
+Generating Code...
+Compiling...
+bcf00_c.c
+bcf10_c.c
+bcs00_c.c
+bcs10_c.c
+bct00_c.c
+bct10_c.c
+bcu00_c.c
+bcy00_c.c
+vpx_reg.c
+bct00_targa_c.c
+Generating Code...
+Creating library...
+
+
+
+<h3>Results</h3>
+s_vpxblit.lib - 0 error(s), 0 warning(s)
+<h3>
+--------------------Configuration: vpxblit - Win32 Debug--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "C:\tmp\RSPB4A.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\..\..\ObjectCode\vpxblit\Debug\const.lst /Fo .\..\..\..\..\..\ObjectCode\vpxblit\Debug\const.obj .\wx86\const.asm
+]
+Creating command line "C:\tmp\RSPB4A.bat"
+Creating temporary file "C:\tmp\RSPB4B.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\..\..\ObjectCode\vpxblit\Debug\bcy00.lst /Fo .\..\..\..\..\..\ObjectCode\vpxblit\Debug\bcy00.obj .\wx86\bcy00.asm
+]
+Creating command line "C:\tmp\RSPB4B.bat"
+Creating temporary file "C:\tmp\RSPB4C.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\..\..\ObjectCode\vpxblit\Debug\bcu00.lst /Fo .\..\..\..\..\..\ObjectCode\vpxblit\Debug\bcu00.obj .\wx86\bcu00.asm
+]
+Creating command line "C:\tmp\RSPB4C.bat"
+Creating temporary file "C:\tmp\RSPB4D.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\..\..\ObjectCode\vpxblit\Debug\bct10.lst /Fo .\..\..\..\..\..\ObjectCode\vpxblit\Debug\bct10.obj .\wx86\bct10.asm
+]
+Creating command line "C:\tmp\RSPB4D.bat"
+Creating temporary file "C:\tmp\RSPB4E.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\..\..\ObjectCode\vpxblit\Debug\bct00.lst /Fo .\..\..\..\..\..\ObjectCode\vpxblit\Debug\bct00.obj .\wx86\bct00.asm
+]
+Creating command line "C:\tmp\RSPB4E.bat"
+Creating temporary file "C:\tmp\RSPB4F.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\..\..\ObjectCode\vpxblit\Debug\bcs10.lst /Fo .\..\..\..\..\..\ObjectCode\vpxblit\Debug\bcs10.obj .\wx86\bcs10.asm
+]
+Creating command line "C:\tmp\RSPB4F.bat"
+Creating temporary file "C:\tmp\RSPB50.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\..\..\ObjectCode\vpxblit\Debug\bcs00.lst /Fo .\..\..\..\..\..\ObjectCode\vpxblit\Debug\bcs00.obj .\wx86\bcs00.asm
+]
+Creating command line "C:\tmp\RSPB50.bat"
+Creating temporary file "C:\tmp\RSPB51.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\..\..\ObjectCode\vpxblit\Debug\bcf10.lst /Fo .\..\..\..\..\..\ObjectCode\vpxblit\Debug\bcf10.obj .\wx86\bcf10.asm
+]
+Creating command line "C:\tmp\RSPB51.bat"
+Creating temporary file "C:\tmp\RSPB52.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\..\..\ObjectCode\vpxblit\Debug\bcf00.lst /Fo .\..\..\..\..\..\ObjectCode\vpxblit\Debug\bcf00.obj .\wx86\bcf00.asm
+]
+Creating command line "C:\tmp\RSPB52.bat"
+Creating temporary file "C:\tmp\RSPB53.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\..\..\ObjectCode\vpxblit\Debug\bcd00.lst /Fo .\..\..\..\..\..\ObjectCode\vpxblit\Debug\bcd00.obj .\wx86\bcd00.asm
+]
+Creating command line "C:\tmp\RSPB53.bat"
+Creating temporary file "C:\tmp\RSPB54.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\..\..\ObjectCode\vpxblit\Debug\bcc10.lst /Fo .\..\..\..\..\..\ObjectCode\vpxblit\Debug\bcc10.obj .\wx86\bcc10.asm
+]
+Creating command line "C:\tmp\RSPB54.bat"
+Creating temporary file "C:\tmp\RSPB55.bat" with contents
+[
+@echo off
+ml /Zi /Zm /Cx /c /coff /Fl.\..\..\..\..\..\ObjectCode\vpxblit\Debug\bcc00.lst /Fo .\..\..\..\..\..\ObjectCode\vpxblit\Debug\bcc00.obj .\wx86\bcc00.asm
+]
+Creating command line "C:\tmp\RSPB55.bat"
+Creating temporary file "C:\tmp\RSPB56.tmp" with contents
+[
+/nologo /G6 /MTd /W3 /Gm /GX /ZI /Od /I "..\..\include" /I "..\..\..\include\vp31" /I "..\..\..\include" /I ".\generic" /D "_WINDOWS" /D "_DEBUG" /D INLINE=__inline /D "WIN32" /Fp"..\..\..\..\..\ObjectCode\vpxblit\Debug/vpxblit.pch" /YX /Fo"..\..\..\..\..\ObjectCode\vpxblit\Debug/" /Fd"..\..\..\..\..\ObjectCode\vpxblit\Debug/" /FD /GZ /c
+"C:\NEWZIP\VP6\corelibs\cdxv\vpxblit\win32\ctables.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vpxblit\win32\wksetblt.c"
+]
+Creating command line "cl.exe @C:\tmp\RSPB56.tmp"
+Creating temporary file "C:\tmp\RSPB57.tmp" with contents
+[
+/nologo /G6 /MTd /W3 /Gm /GX /ZI /Od /I "..\..\include" /I "..\..\..\include\vp31" /I "..\..\..\include" /D "_WINDOWS" /D "_DEBUG" /D INLINE=__inline /D "WIN32" /Fp"..\..\..\..\..\ObjectCode\vpxblit\Debug/vpxblit.pch" /YX /Fo"..\..\..\..\..\ObjectCode\vpxblit\Debug/" /Fd"..\..\..\..\..\ObjectCode\vpxblit\Debug/" /FD /GZ /c
+"C:\NEWZIP\VP6\corelibs\cdxv\vpxblit\generic\bcf00_c.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vpxblit\generic\bcf10_c.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vpxblit\generic\bcs00_c.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vpxblit\generic\bcs10_c.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vpxblit\generic\bct00_c.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vpxblit\generic\bct10_c.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vpxblit\generic\bcu00_c.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vpxblit\generic\bcy00_c.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vpxblit\generic\vpx_reg.c"
+"C:\NEWZIP\VP6\corelibs\cdxv\vpxblit\generic\bct00_targa_c.c"
+]
+Creating command line "cl.exe @C:\tmp\RSPB57.tmp"
+Performing Custom Build Step on .\wx86\const.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\wx86\const.asm
+Performing Custom Build Step on .\wx86\bcy00.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\wx86\bcy00.asm
+Performing Custom Build Step on .\wx86\bcu00.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\wx86\bcu00.asm
+Performing Custom Build Step on .\wx86\bct10.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\wx86\bct10.asm
+Performing Custom Build Step on .\wx86\bct00.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\wx86\bct00.asm
+Performing Custom Build Step on .\wx86\bcs10.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\wx86\bcs10.asm
+Performing Custom Build Step on .\wx86\bcs00.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\wx86\bcs00.asm
+Performing Custom Build Step on .\wx86\bcf10.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\wx86\bcf10.asm
+Performing Custom Build Step on .\wx86\bcf00.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\wx86\bcf00.asm
+Performing Custom Build Step on .\wx86\bcd00.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\wx86\bcd00.asm
+Performing Custom Build Step on .\wx86\bcc10.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\wx86\bcc10.asm
+Performing Custom Build Step on .\wx86\bcc00.asm
+Microsoft (R) Macro Assembler Version 6.15.8803
+Copyright (C) Microsoft Corp 1981-2000. All rights reserved.
+
+ Assembling: .\wx86\bcc00.asm
+Creating temporary file "C:\tmp\RSPB58.tmp" with contents
+[
+/nologo /out:"..\..\..\Lib\Win32\Debug\s_vpxblit.lib"
+\ObjectCode\vpxblit\Debug\ctables.obj
+\ObjectCode\vpxblit\Debug\wksetblt.obj
+\ObjectCode\vpxblit\Debug\bcf00_c.obj
+\ObjectCode\vpxblit\Debug\bcf10_c.obj
+\ObjectCode\vpxblit\Debug\bcs00_c.obj
+\ObjectCode\vpxblit\Debug\bcs10_c.obj
+\ObjectCode\vpxblit\Debug\bct00_c.obj
+\ObjectCode\vpxblit\Debug\bct10_c.obj
+\ObjectCode\vpxblit\Debug\bcu00_c.obj
+\ObjectCode\vpxblit\Debug\bcy00_c.obj
+\ObjectCode\vpxblit\Debug\vpx_reg.obj
+\ObjectCode\vpxblit\Debug\bct00_targa_c.obj
+\ObjectCode\vpxblit\Debug\bcc00.obj
+\ObjectCode\vpxblit\Debug\bcc10.obj
+\ObjectCode\vpxblit\Debug\bcd00.obj
+\ObjectCode\vpxblit\Debug\bcf00.obj
+\ObjectCode\vpxblit\Debug\bcf10.obj
+\ObjectCode\vpxblit\Debug\bcs00.obj
+\ObjectCode\vpxblit\Debug\bcs10.obj
+\ObjectCode\vpxblit\Debug\bct00.obj
+\ObjectCode\vpxblit\Debug\bct10.obj
+\ObjectCode\vpxblit\Debug\bcu00.obj
+\ObjectCode\vpxblit\Debug\bcy00.obj
+\ObjectCode\vpxblit\Debug\const.obj
+]
+Creating command line "link.exe -lib @C:\tmp\RSPB58.tmp"
+<h3>Output Window</h3>
+Compiling...
+ctables.c
+wksetblt.c
+Compiling...
+bcf00_c.c
+bcf10_c.c
+bcs00_c.c
+bcs10_c.c
+bct00_c.c
+bct10_c.c
+bcu00_c.c
+bcy00_c.c
+vpx_reg.c
+bct00_targa_c.c
+Creating library...
+
+
+
+<h3>Results</h3>
+s_vpxblit.lib - 0 error(s), 0 warning(s)
+</pre>
+</body>
+</html>
diff --git a/Src/libvp6/corelibs/on2_common/src/on2_mem/build/win32/on2_mem.vcxproj b/Src/libvp6/corelibs/on2_common/src/on2_mem/build/win32/on2_mem.vcxproj
new file mode 100644
index 00000000..e7376d16
--- /dev/null
+++ b/Src/libvp6/corelibs/on2_common/src/on2_mem/build/win32/on2_mem.vcxproj
@@ -0,0 +1,317 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <VCProjectVersion>17.0</VCProjectVersion>
+ <ProjectGuid>{C3547FC9-A6AC-4706-BED7-D696A8EF9EED}</ProjectGuid>
+ <RootNamespace>on2_mem</RootNamespace>
+ <WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v142</PlatformToolset>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v142</PlatformToolset>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v142</PlatformToolset>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v142</PlatformToolset>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>17.0.32505.173</_ProjectFileVersion>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <OutDir>..\..\..\..\..\..\lib\$(PlatformShortName)_$(Configuration)\</OutDir>
+ <IntDir>..\..\..\..\..\..\obj\on2_mem\$(PlatformShortName)_$(Configuration)\</IntDir>
+ <IncludePath>$(IncludePath)</IncludePath>
+ <LibraryPath>$(LibraryPath)</LibraryPath>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <IncludePath>$(IncludePath)</IncludePath>
+ <LibraryPath>$(LibraryPath)</LibraryPath>
+ <OutDir>..\..\..\..\..\..\lib\$(PlatformShortName)_$(Configuration)\</OutDir>
+ <IntDir>..\..\..\..\..\..\obj\on2_mem\$(PlatformShortName)_$(Configuration)\</IntDir>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <OutDir>..\..\..\..\..\..\lib\$(PlatformShortName)_$(Configuration)\</OutDir>
+ <IntDir>..\..\..\..\..\..\obj\on2_mem\$(PlatformShortName)_$(Configuration)\</IntDir>
+ <IncludePath>$(IncludePath)</IncludePath>
+ <LibraryPath>$(LibraryPath)</LibraryPath>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <IncludePath>$(IncludePath)</IncludePath>
+ <LibraryPath>$(LibraryPath)</LibraryPath>
+ <OutDir>..\..\..\..\..\..\lib\$(PlatformShortName)_$(Configuration)\</OutDir>
+ <IntDir>..\..\..\..\..\..\obj\on2_mem\$(PlatformShortName)_$(Configuration)\</IntDir>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
+ <OmitFramePointers>true</OmitFramePointers>
+ <AdditionalIncludeDirectories>..\..\include;..\..\..\common\include;..\..\memory_manager\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader />
+ <PrecompiledHeaderOutputFile>$(IntDir)on2_mem.pch</PrecompiledHeaderOutputFile>
+ <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
+ <ObjectFileName>$(IntDir)</ObjectFileName>
+ <ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>None</DebugInformationFormat>
+ <CompileAs>Default</CompileAs>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Lib>
+ <OutputFile>$(OutDir)on2_mem.lib</OutputFile>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ </Lib>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <Optimization>MaxSpeed</Optimization>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
+ <OmitFramePointers>true</OmitFramePointers>
+ <AdditionalIncludeDirectories>..\..\include;..\..\..\common\include;..\..\memory_manager\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <PrecompiledHeaderOutputFile>$(IntDir)on2_mem.pch</PrecompiledHeaderOutputFile>
+ <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
+ <ObjectFileName>$(IntDir)</ObjectFileName>
+ <ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>None</DebugInformationFormat>
+ <CompileAs>Default</CompileAs>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Lib>
+ <OutputFile>$(OutDir)on2_mem.lib</OutputFile>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ </Lib>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>..\..\include;..\..\..\common\include;..\..\memory_manager\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader />
+ <PrecompiledHeaderOutputFile>$(IntDir)on2_mem.pch</PrecompiledHeaderOutputFile>
+ <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
+ <ObjectFileName>$(IntDir)</ObjectFileName>
+ <ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+ <CompileAs>Default</CompileAs>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Lib>
+ <OutputFile>$(OutDir)on2_mem.lib</OutputFile>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ </Lib>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>..\..\include;..\..\..\common\include;..\..\memory_manager\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <PrecompiledHeaderOutputFile>$(IntDir)on2_mem.pch</PrecompiledHeaderOutputFile>
+ <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation>
+ <ObjectFileName>$(IntDir)</ObjectFileName>
+ <ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <CompileAs>Default</CompileAs>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Lib>
+ <OutputFile>$(OutDir)on2_mem.lib</OutputFile>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ </Lib>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\memory_manager\hmm_alloc.c">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">EnableFastChecks</BasicRuntimeChecks>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MaxSpeed</Optimization>
+ </ClCompile>
+ <ClCompile Include="..\..\memory_manager\hmm_base.c">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">EnableFastChecks</BasicRuntimeChecks>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MaxSpeed</Optimization>
+ </ClCompile>
+ <ClCompile Include="..\..\memory_manager\hmm_dflt_abort.c">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">EnableFastChecks</BasicRuntimeChecks>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MaxSpeed</Optimization>
+ </ClCompile>
+ <ClCompile Include="..\..\memory_manager\hmm_grow.c">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">EnableFastChecks</BasicRuntimeChecks>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MaxSpeed</Optimization>
+ </ClCompile>
+ <ClCompile Include="..\..\memory_manager\hmm_largest.c">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">EnableFastChecks</BasicRuntimeChecks>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MaxSpeed</Optimization>
+ </ClCompile>
+ <ClCompile Include="..\..\memory_manager\hmm_resize.c">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">EnableFastChecks</BasicRuntimeChecks>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MaxSpeed</Optimization>
+ </ClCompile>
+ <ClCompile Include="..\..\memory_manager\hmm_shrink.c">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">EnableFastChecks</BasicRuntimeChecks>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MaxSpeed</Optimization>
+ </ClCompile>
+ <ClCompile Include="..\..\memory_manager\hmm_true.c">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">EnableFastChecks</BasicRuntimeChecks>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MaxSpeed</Optimization>
+ </ClCompile>
+ <ClCompile Include="..\..\on2_mem.c">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">EnableFastChecks</BasicRuntimeChecks>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MaxSpeed</Optimization>
+ </ClCompile>
+ <ClCompile Include="..\..\on2_mem_tracker.c">
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+ <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">EnableFastChecks</BasicRuntimeChecks>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+ <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MaxSpeed</Optimization>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\include\on2_mem.h" />
+ <ClInclude Include="..\..\include\on2_mem_tracker.h" />
+ <ClInclude Include="..\..\memory_manager\include\cavl_if.h" />
+ <ClInclude Include="..\..\memory_manager\include\cavl_impl.h" />
+ <ClInclude Include="..\..\memory_manager\include\heapmm.h" />
+ <ClInclude Include="..\..\memory_manager\include\hmm_cnfg.h" />
+ <ClInclude Include="..\..\memory_manager\include\hmm_intrnl.h" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/Src/libvp6/corelibs/on2_common/src/on2_mem/build/win32/on2_mem.vcxproj.filters b/Src/libvp6/corelibs/on2_common/src/on2_mem/build/win32/on2_mem.vcxproj.filters
new file mode 100644
index 00000000..517d62e8
--- /dev/null
+++ b/Src/libvp6/corelibs/on2_common/src/on2_mem/build/win32/on2_mem.vcxproj.filters
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{9e1216e0-9418-47c8-8b65-d829ad4b69a5}</UniqueIdentifier>
+ <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
+ </Filter>
+ <Filter Include="Source Files\memory_manager">
+ <UniqueIdentifier>{4c33a825-25eb-47cb-b841-87f800085fba}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{70389f5d-efd2-456e-a0e2-09499eb80192}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl</Extensions>
+ </Filter>
+ <Filter Include="Header Files\memory_manager_hdrs">
+ <UniqueIdentifier>{7deb3717-4ad2-4cdc-8773-cc326f108428}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="..\..\on2_mem.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\on2_mem_tracker.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\memory_manager\hmm_alloc.c">
+ <Filter>Source Files\memory_manager</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\memory_manager\hmm_base.c">
+ <Filter>Source Files\memory_manager</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\memory_manager\hmm_dflt_abort.c">
+ <Filter>Source Files\memory_manager</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\memory_manager\hmm_grow.c">
+ <Filter>Source Files\memory_manager</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\memory_manager\hmm_largest.c">
+ <Filter>Source Files\memory_manager</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\memory_manager\hmm_resize.c">
+ <Filter>Source Files\memory_manager</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\memory_manager\hmm_shrink.c">
+ <Filter>Source Files\memory_manager</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\memory_manager\hmm_true.c">
+ <Filter>Source Files\memory_manager</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="..\..\include\on2_mem.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\on2_mem_tracker.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\memory_manager\include\cavl_if.h">
+ <Filter>Header Files\memory_manager_hdrs</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\memory_manager\include\cavl_impl.h">
+ <Filter>Header Files\memory_manager_hdrs</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\memory_manager\include\heapmm.h">
+ <Filter>Header Files\memory_manager_hdrs</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\memory_manager\include\hmm_cnfg.h">
+ <Filter>Header Files\memory_manager_hdrs</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\memory_manager\include\hmm_intrnl.h">
+ <Filter>Header Files\memory_manager_hdrs</Filter>
+ </ClInclude>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/Src/libvp6/corelibs/on2_common/src/on2_mem/include/on2_mem.h b/Src/libvp6/corelibs/on2_common/src/on2_mem/include/on2_mem.h
new file mode 100644
index 00000000..6a63475c
--- /dev/null
+++ b/Src/libvp6/corelibs/on2_common/src/on2_mem/include/on2_mem.h
@@ -0,0 +1,108 @@
+#ifndef __ON2_MEM_H__
+#define __ON2_MEM_H__
+
+/* on2_mem version info */
+#define on2_mem_version "2.0.1.1"
+
+#define ON2_MEM_VERSION_CHIEF 2
+#define ON2_MEM_VERSION_MAJOR 0
+#define ON2_MEM_VERSION_MINOR 1
+#define ON2_MEM_VERSION_PATCH 1
+/* end - on2_mem version info */
+
+#define ON2_TRACK_MEM_USAGE 0 //enable memory tracking/integrity checks
+#define ON2_CHECK_MEM_FUNCTIONS 0 //enable basic safety checks in _memcpy,
+ //_memset, and _memmove
+#define REPLACE_BUILTIN_FUNCTIONS 0 //replace builtin functions with their
+ //on2_ equivalents
+
+#include <stddef.h>
+#include "on2_mem_tracker.h"
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+/*
+ on2_mem_get_version()
+ provided for runtime version checking. Returns an unsigned int of the form
+ CHIEF | MAJOR | MINOR | PATCH, where the chief version number is the high
+ order byte.
+*/
+unsigned int on2_mem_get_version();
+
+/*
+ on2_mem_set_heap_size(size_t size)
+ size - size in bytes for the memory manager to allocate for its heap
+ Sets the memory manager's initial heap size
+ Return:
+ 0: on success
+ -1: if memory manager calls have not been included in the on2_mem lib
+ -2: if the memory manager has been compiled to use static memory
+ -3: if the memory manager has already allocated its heap
+*/
+int on2_mem_set_heap_size(size_t size);
+
+void* on2_memalign(size_t align, size_t size);
+void* on2_malloc(size_t size);
+void* on2_calloc(size_t num, size_t size);
+void* on2_realloc(void* memblk, size_t size);
+void on2_free(void* memblk);
+
+void* on2_memcpy(void* dest, const void* src, size_t length);
+void* on2_memset(void* dest, int val, size_t length);
+void* on2_memmove(void* dest, const void* src, size_t count);
+
+/* some defines for backward compatibility */
+#define DMEM_GENERAL 0
+
+#define duck_memalign(X,Y,Z) on2_memalign(X,Y)
+#define duck_malloc(X,Y) on2_malloc(X)
+#define duck_calloc(X,Y,Z) on2_calloc(X,Y)
+#define duck_realloc on2_realloc
+#define duck_free on2_free
+#define duck_memcpy on2_memcpy
+#define duck_memmove on2_memmove
+#define duck_memset on2_memset
+
+#if REPLACE_BUILTIN_FUNCTIONS
+#define memalign on2_memalign
+#define malloc on2_malloc
+#define calloc on2_calloc
+#define realloc on2_realloc
+#define free on2_free
+#define memcpy on2_memcpy
+#define memmove on2_memmove
+#define memset on2_memset
+#endif
+
+#if ON2_TRACK_MEM_USAGE
+# ifndef __ON2_MEM_C__
+# define on2_memalign(align, size) xon2_memalign((align), (size), __FILE__, __LINE__)
+# define on2_malloc(size) xon2_malloc((size), __FILE__, __LINE__)
+# define on2_calloc(num, size) xon2_calloc(num, size, __FILE__, __LINE__)
+# define on2_realloc(addr, size) xon2_realloc(addr, size, __FILE__, __LINE__)
+# define on2_free(addr) xon2_free(addr, __FILE__, __LINE__)
+# endif
+
+ void* xon2_memalign(size_t align, size_t size, char* file, int line);
+ void* xon2_malloc(size_t size, char* file, int line);
+ void* xon2_calloc(size_t num, size_t size, char* file, int line);
+ void* xon2_realloc(void* memblk, size_t size, char* file, int line);
+ void xon2_free(void* memblk, char* file, int line);
+#endif
+
+#if !ON2_CHECK_MEM_FUNCTIONS
+# ifndef __ON2_MEM_C__
+# include <string.h>
+# define on2_memcpy memcpy
+# define on2_memset memset
+# define on2_memmove memmove
+# endif
+#endif
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __ON2_MEM_H__ */
diff --git a/Src/libvp6/corelibs/on2_common/src/on2_mem/include/on2_mem_tracker.h b/Src/libvp6/corelibs/on2_common/src/on2_mem/include/on2_mem_tracker.h
new file mode 100644
index 00000000..4c5e6774
--- /dev/null
+++ b/Src/libvp6/corelibs/on2_common/src/on2_mem/include/on2_mem_tracker.h
@@ -0,0 +1,126 @@
+#ifndef __ON2_MEM_TRACKER_H__
+#define __ON2_MEM_TRACKER_H__
+
+/* on2_mem_tracker version info */
+#define on2_mem_tracker_version "2.3.1.2"
+
+#define ON2_MEM_TRACKER_VERSION_CHIEF 2
+#define ON2_MEM_TRACKER_VERSION_MAJOR 3
+#define ON2_MEM_TRACKER_VERSION_MINOR 1
+#define ON2_MEM_TRACKER_VERSION_PATCH 2
+/* END - on2_mem_tracker version info */
+
+struct MemBlock
+{
+ size_t addr;
+ unsigned int size,
+ line;
+ char* file;
+ struct MemBlock* prev,
+ * next;
+};
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+/*
+ on2_MemoryTrackerInit(int padding_size, int pad_value)
+ padding_size - the size of the padding before and after each mem addr.
+ Values > 0 indicate that integrity checks can be performed
+ by inspecting these areas.
+ pad_value - the initial value within the padding area before and after
+ each mem addr.
+
+ Initializes the memory tracker interface. Should be called before any
+ other calls to the memory tracker.
+*/
+int on2_MemoryTrackerInit(int padding_size, int pad_value);
+
+/*
+ on2_MemoryTrackerDestroy()
+ Deinitializes the memory tracker interface
+*/
+void on2_MemoryTrackerDestroy();
+
+/*
+ on2_MemoryTrackerAdd(size_t addr, unsigned int size,
+ char * file, unsigned int line)
+ addr - memory address to be added to list
+ size - size of addr
+ file - the file addr was referenced from
+ line - the line in file addr was referenced from
+ Adds memory address addr, it's size, file and line it came from
+ to the memory tracker allocation table
+*/
+void on2_MemoryTrackerAdd(size_t addr, unsigned int size,
+ char * file, unsigned int line);
+
+/*
+ on2_MemoryTrackerAdd(size_t addr, unsigned int size, char * file, unsigned int line)
+ addr - memory address to be added to be removed
+ Removes the specified address from the memory tracker's allocation
+ table
+ Return:
+ 0: on success
+ -1: if memory allocation table's mutex could not be locked
+ -2: if the addr was not found in the list
+*/
+int on2_MemoryTrackerRemove(size_t addr);
+
+/*
+ on2_MemoryTrackerFind(unsigned int addr)
+ addr - address to be found in the memory tracker's
+ allocation table
+ Return:
+ If found, pointer to the memory block that matches addr
+ NULL otherwise
+*/
+struct MemBlock* on2_MemoryTrackerFind(size_t addr);
+
+/*
+ on2_MemoryTrackerDump()
+ Dumps the current contents of the memory
+ tracker allocation table
+*/
+void on2_MemoryTrackerDump();
+
+/*
+ on2_MemoryTrackerCheckIntegrity()
+ If a padding_size was provided to on2_MemoryTrackerInit()
+ This function will verify that the region before and after each
+ memory address contains the specified pad_value. Should the check
+ fail, the filename and line of the check will be printed out.
+*/
+void on2_MemoryTrackerCheckIntegrity(char* file, unsigned int line);
+
+/*
+ on2_MemoryTrackerSetLogType
+ type - value representing the logging type to use
+ option - type specific option. This will be interpreted differently
+ based on the type.
+ Sets the logging type for the memory tracker.
+ Values currently supported:
+ 0: if option is NULL, log to stderr, otherwise interpret option as a
+ filename and attempt to open it.
+ -1: Use OutputDebugString (WIN32 only), option ignored
+ Return:
+ 0: on success
+ -1: if the logging type could not be set, because the value was invalid
+ or because a file could not be opened
+*/
+int on2_MemoryTrackerSetLogType(int type, char* option);
+
+#if !defined(__ON2_MEM_TRACKER_C__) && !defined(__ON2_MEM_C__)
+#if ON2_TRACK_MEM_USAGE
+#define on2_MemoryTrackerCheckIntegrity() on2_MemoryTrackerCheckIntegrity(__FILE__, __LINE__)
+#else
+#define on2_MemoryTrackerCheckIntegrity()
+#endif
+#endif
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif //__ON2_MEM_TRACKER_H__
diff --git a/Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/hmm_alloc.c b/Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/hmm_alloc.c
new file mode 100644
index 00000000..502f4bd9
--- /dev/null
+++ b/Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/hmm_alloc.c
@@ -0,0 +1,48 @@
+/* This code is in the public domain.
+** Version: 1.1 Author: Walt Karas
+*/
+
+#include "hmm_intrnl.h"
+
+void * U(alloc)(U(descriptor) *desc, U(size_aau) n)
+ {
+ #ifdef HMM_AUDIT_FAIL
+ if (desc->avl_tree_root)
+ AUDIT_BLOCK(PTR_REC_TO_HEAD(desc->avl_tree_root))
+ #endif
+
+ if (desc->last_freed)
+ {
+ #ifdef HMM_AUDIT_FAIL
+ AUDIT_BLOCK(desc->last_freed)
+ #endif
+
+ U(into_free_collection)(desc, (head_record *) (desc->last_freed));
+
+ desc->last_freed = 0;
+ }
+
+ /* Add space for block header. */
+ n += HEAD_AAUS;
+
+ /* Convert n from number of address alignment units to block alignment
+ ** units. */
+ n = DIV_ROUND_UP(n, HMM_BLOCK_ALIGN_UNIT);
+
+ if (n < MIN_BLOCK_BAUS)
+ n = MIN_BLOCK_BAUS;
+
+ {
+ /* Search for the first node of the bin containing the smallest
+ ** block big enough to satisfy request. */
+ ptr_record *ptr_rec_ptr =
+ U(avl_search)(
+ (U(avl_avl) *) &(desc->avl_tree_root), (U(size_bau)) n,
+ AVL_GREATER_EQUAL);
+
+ /* If an approprate bin is found, satisfy the allocation request,
+ ** otherwise return null pointer. */
+ return(ptr_rec_ptr ?
+ U(alloc_from_bin)(desc, ptr_rec_ptr, (U(size_bau)) n) : 0);
+ }
+ }
diff --git a/Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/hmm_base.c b/Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/hmm_base.c
new file mode 100644
index 00000000..cd6317c8
--- /dev/null
+++ b/Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/hmm_base.c
@@ -0,0 +1,418 @@
+/* This code is in the public domain.
+** Version: 1.1 Author: Walt Karas
+*/
+
+#include "hmm_intrnl.h"
+
+void U(init)(U(descriptor) *desc)
+ {
+ desc->avl_tree_root = 0;
+ desc->last_freed = 0;
+ }
+
+/* Remove a free block from a bin's doubly-linked list when it is not,
+** the first block in the bin.
+*/
+void U(dll_remove)(
+ /* Pointer to pointer record in the block to be removed. */
+ ptr_record *to_remove)
+ {
+ to_remove->prev->next = to_remove->next;
+ if (to_remove->next)
+ to_remove->next->prev = to_remove->prev;
+ }
+
+/* Put a block into the free collection of a heap.
+*/
+void U(into_free_collection)(
+ /* Pointer to heap descriptor. */
+ U(descriptor) *desc,
+ /* Pointer to head record of block. */
+ head_record *head_ptr)
+ {
+ ptr_record *ptr_rec_ptr = HEAD_TO_PTR_REC(head_ptr);
+
+ ptr_record *bin_front_ptr =
+ U(avl_insert)((U(avl_avl) *) &(desc->avl_tree_root), ptr_rec_ptr);
+
+ if (bin_front_ptr != ptr_rec_ptr)
+ {
+ /* The block was not inserted into the AVL tree because there is
+ ** already a bin for the size of the block. */
+
+ MARK_SUCCESSIVE_BLOCK_IN_FREE_BIN(head_ptr)
+ ptr_rec_ptr->self = ptr_rec_ptr;
+
+ /* Make the block the new second block in the bin's doubly-linked
+ ** list. */
+ ptr_rec_ptr->prev = bin_front_ptr;
+ ptr_rec_ptr->next = bin_front_ptr->next;
+ bin_front_ptr->next = ptr_rec_ptr;
+ if (ptr_rec_ptr->next)
+ ptr_rec_ptr->next->prev = ptr_rec_ptr;
+ }
+ else
+ /* Block is first block in new bin. */
+ ptr_rec_ptr->next = 0;
+ }
+
+/* Allocate a block from a given bin. Returns a pointer to the payload
+** of the removed block. The "last freed" pointer must be null prior
+** to calling this function.
+*/
+void * U(alloc_from_bin)(
+ /* Pointer to heap descriptor. */
+ U(descriptor) *desc,
+ /* Pointer to pointer record of first block in bin. */
+ ptr_record *bin_front_ptr,
+ /* Number of BAUs needed in the allocated block. If the block taken
+ ** from the bin is significantly larger than the number of BAUs needed,
+ ** the "extra" BAUs are split off to form a new free block. */
+ U(size_bau) n_baus)
+ {
+ head_record *head_ptr;
+ U(size_bau) rem_baus;
+
+ if (bin_front_ptr->next)
+ {
+ /* There are multiple blocks in this bin. Use the 2nd block in
+ ** the bin to avoid needless change to the AVL tree.
+ */
+
+ ptr_record *ptr_rec_ptr = bin_front_ptr->next;
+ head_ptr = PTR_REC_TO_HEAD(ptr_rec_ptr);
+
+ #ifdef AUDIT_FAIL
+ AUDIT_BLOCK(head_ptr)
+ #endif
+
+ U(dll_remove)(ptr_rec_ptr);
+ }
+ else
+ {
+ /* There is only one block in the bin, so it has to be removed
+ ** from the AVL tree.
+ */
+
+ head_ptr = PTR_REC_TO_HEAD(bin_front_ptr);
+
+ U(avl_remove)(
+ (U(avl_avl) *) &(desc->avl_tree_root), BLOCK_BAUS(head_ptr));
+ }
+
+ MARK_BLOCK_ALLOCATED(head_ptr)
+
+ rem_baus = BLOCK_BAUS(head_ptr) - n_baus;
+
+ if (rem_baus >= MIN_BLOCK_BAUS)
+ {
+ /* Since there are enough "extra" BAUs, split them off to form
+ ** a new free block.
+ */
+
+ head_record *rem_head_ptr =
+ (head_record *) BAUS_FORWARD(head_ptr, n_baus);
+
+ /* Change the next block's header to reflect the fact that the
+ ** block preceeding it is now smaller.
+ */
+ SET_PREV_BLOCK_BAUS(
+ BAUS_FORWARD(head_ptr, head_ptr->block_size), rem_baus)
+
+ head_ptr->block_size = n_baus;
+
+ rem_head_ptr->previous_block_size = n_baus;
+ rem_head_ptr->block_size = rem_baus;
+
+ desc->last_freed = rem_head_ptr;
+ }
+
+ return(HEAD_TO_PTR_REC(head_ptr));
+ }
+
+/* Take a block out of the free collection.
+*/
+void U(out_of_free_collection)(
+ /* Descriptor of heap that block is in. */
+ U(descriptor) *desc,
+ /* Pointer to head of block to take out of free collection. */
+ head_record *head_ptr)
+ {
+ ptr_record *ptr_rec_ptr = HEAD_TO_PTR_REC(head_ptr);
+
+ if (ptr_rec_ptr->self == ptr_rec_ptr)
+ /* Block is not the front block in its bin, so all we have to
+ ** do is take it out of the bin's doubly-linked list. */
+ U(dll_remove)(ptr_rec_ptr);
+ else
+ {
+ ptr_record *next = ptr_rec_ptr->next;
+
+ if (next)
+ /* Block is the front block in its bin, and there is at least
+ ** one other block in the bin. Substitute the next block for
+ ** the front block. */
+ U(avl_subst)((U(avl_avl) *) &(desc->avl_tree_root), next);
+ else
+ /* Block is the front block in its bin, but there is no other
+ ** block in the bin. Eliminate the bin. */
+ U(avl_remove)(
+ (U(avl_avl) *) &(desc->avl_tree_root), BLOCK_BAUS(head_ptr));
+ }
+ }
+
+void U(free)(U(descriptor) *desc, void *payload_ptr)
+ {
+ /* Flags if coalesce with adjacent block. */
+ int coalesce;
+
+ head_record *fwd_head_ptr;
+ head_record *free_head_ptr = PTR_REC_TO_HEAD(payload_ptr);
+
+ desc->num_baus_can_shrink = 0;
+
+ #ifdef HMM_AUDIT_FAIL
+
+ AUDIT_BLOCK(free_head_ptr)
+
+ /* Make sure not freeing an already free block. */
+ if (!IS_BLOCK_ALLOCATED(free_head_ptr))
+ HMM_AUDIT_FAIL
+
+ if (desc->avl_tree_root)
+ /* Audit root block in AVL tree. */
+ AUDIT_BLOCK(PTR_REC_TO_HEAD(desc->avl_tree_root))
+
+ #endif
+
+ fwd_head_ptr =
+ (head_record *) BAUS_FORWARD(free_head_ptr, free_head_ptr->block_size);
+
+ if (free_head_ptr->previous_block_size)
+ {
+ /* Coalesce with backward block if possible. */
+
+ head_record *bkwd_head_ptr =
+ (head_record *) BAUS_BACKWARD(
+ free_head_ptr, free_head_ptr->previous_block_size);
+
+ #ifdef HMM_AUDIT_FAIL
+ AUDIT_BLOCK(bkwd_head_ptr)
+ #endif
+
+ if (bkwd_head_ptr == (head_record *) (desc->last_freed))
+ {
+ desc->last_freed = 0;
+ coalesce = 1;
+ }
+ else if (IS_BLOCK_ALLOCATED(bkwd_head_ptr))
+ coalesce = 0;
+ else
+ {
+ U(out_of_free_collection)(desc, bkwd_head_ptr);
+ coalesce = 1;
+ }
+
+ if (coalesce)
+ {
+ bkwd_head_ptr->block_size += free_head_ptr->block_size;
+ SET_PREV_BLOCK_BAUS(fwd_head_ptr, BLOCK_BAUS(bkwd_head_ptr))
+ free_head_ptr = bkwd_head_ptr;
+ }
+ }
+
+ if (fwd_head_ptr->block_size == 0)
+ {
+ /* Block to be freed is last block before dummy end-of-chunk block. */
+ desc->end_of_shrinkable_chunk =
+ BAUS_FORWARD(fwd_head_ptr, DUMMY_END_BLOCK_BAUS);
+ desc->num_baus_can_shrink = BLOCK_BAUS(free_head_ptr);
+ if (PREV_BLOCK_BAUS(free_head_ptr) == 0)
+ /* Free block is the entire chunk, so shrinking can eliminate
+ ** entire chunk including dummy end block. */
+ desc->num_baus_can_shrink += DUMMY_END_BLOCK_BAUS;
+ }
+ else
+ {
+ /* Coalesce with forward block if possible. */
+
+ #ifdef HMM_AUDIT_FAIL
+ AUDIT_BLOCK(fwd_head_ptr)
+ #endif
+
+ if (fwd_head_ptr == (head_record *) (desc->last_freed))
+ {
+ desc->last_freed = 0;
+ coalesce = 1;
+ }
+ else if (IS_BLOCK_ALLOCATED(fwd_head_ptr))
+ coalesce = 0;
+ else
+ {
+ U(out_of_free_collection)(desc, fwd_head_ptr);
+ coalesce = 1;
+ }
+
+ if (coalesce)
+ {
+ free_head_ptr->block_size += fwd_head_ptr->block_size;
+
+ fwd_head_ptr =
+ (head_record *) BAUS_FORWARD(
+ fwd_head_ptr, BLOCK_BAUS(fwd_head_ptr));
+
+ SET_PREV_BLOCK_BAUS(fwd_head_ptr, BLOCK_BAUS(free_head_ptr))
+
+ if (fwd_head_ptr->block_size == 0)
+ {
+ /* Coalesced block to be freed is last block before dummy
+ ** end-of-chunk block. */
+ desc->end_of_shrinkable_chunk =
+ BAUS_FORWARD(fwd_head_ptr, DUMMY_END_BLOCK_BAUS);
+ desc->num_baus_can_shrink = BLOCK_BAUS(free_head_ptr);
+ if (PREV_BLOCK_BAUS(free_head_ptr) == 0)
+ /* Free block is the entire chunk, so shrinking can
+ ** eliminate entire chunk including dummy end block. */
+ desc->num_baus_can_shrink += DUMMY_END_BLOCK_BAUS;
+ }
+ }
+ }
+
+ if (desc->last_freed)
+ {
+ /* There is a last freed block, but it is not adjacent to the
+ ** block being freed by this call to free, so put the last
+ ** freed block into the free collection.
+ */
+
+ #ifdef HMM_AUDIT_FAIL
+ AUDIT_BLOCK(desc->last_freed)
+ #endif
+
+ U(into_free_collection)(desc, (head_record *) (desc->last_freed));
+ }
+
+ desc->last_freed = free_head_ptr;
+ }
+
+void U(new_chunk)(U(descriptor) *desc, void *start, U(size_bau) n_baus)
+ {
+ #ifdef HMM_AUDIT_FAIL
+ if (desc->avl_tree_root)
+ /* Audit root block in AVL tree. */
+ AUDIT_BLOCK(PTR_REC_TO_HEAD(desc->avl_tree_root))
+ #endif
+
+ #undef HEAD_PTR
+ #define HEAD_PTR ((head_record *) start)
+
+ /* Make the chunk one big free block followed by a dummy end block.
+ */
+
+ n_baus -= DUMMY_END_BLOCK_BAUS;
+
+ HEAD_PTR->previous_block_size = 0;
+ HEAD_PTR->block_size = n_baus;
+
+ U(into_free_collection)(desc, HEAD_PTR);
+
+ /* Set up the dummy end block. */
+ start = BAUS_FORWARD(start, n_baus);
+ HEAD_PTR->previous_block_size = n_baus;
+ HEAD_PTR->block_size = 0;
+
+ #undef HEAD_PTR
+ }
+
+#ifdef HMM_AUDIT_FAIL
+
+/* Function that does audit fail actions defined my preprocessor symbol,
+** and returns a dummy integer value.
+*/
+int U(audit_block_fail_dummy_return)(void)
+ {
+ HMM_AUDIT_FAIL
+
+ /* Dummy return. */
+ return(0);
+ }
+
+#endif
+
+/* AVL Tree instantiation. */
+
+#ifdef HMM_AUDIT_FAIL
+
+/* The AVL tree generic package passes an ACCESS of 1 when it "touches"
+** a child node for the first time during a particular operation. I use
+** this feature to audit only one time (per operation) the free blocks
+** that are tree nodes. Since the root node is not a child node, it has
+** to be audited directly.
+*/
+
+/* The pain you feel while reading these macros will not be in vain. It
+** will remove all doubt from you mind that C++ inline functions are
+** a very good thing.
+*/
+
+#define AVL_GET_LESS(H, ACCESS) \
+ (((ACCESS) ? AUDIT_BLOCK_AS_EXPR(PTR_REC_TO_HEAD(H)) : 0), (H)->self)
+#define AVL_GET_GREATER(H, ACCESS) \
+ (((ACCESS) ? AUDIT_BLOCK_AS_EXPR(PTR_REC_TO_HEAD(H)) : 0), (H)->prev)
+
+#else
+
+#define AVL_GET_LESS(H, ACCESS) ((H)->self)
+#define AVL_GET_GREATER(H, ACCESS) ((H)->prev)
+
+#endif
+
+#define AVL_SET_LESS(H, LH) (H)->self = (LH);
+#define AVL_SET_GREATER(H, GH) (H)->prev = (GH);
+
+/* high bit of high bit of
+** block_size previous_block_size balance factor
+** ----------- ------------------- --------------
+** 0 0 n/a (block allocated)
+** 0 1 1
+** 1 0 -1
+** 1 1 0
+*/
+
+#define AVL_GET_BALANCE_FACTOR(H) \
+ ((((head_record *) (PTR_REC_TO_HEAD(H)))->block_size & \
+ HIGH_BIT_BAU_SIZE) ? \
+ (((head_record *) (PTR_REC_TO_HEAD(H)))->previous_block_size & \
+ HIGH_BIT_BAU_SIZE ? 0 : -1) : 1)
+
+#define AVL_SET_BALANCE_FACTOR(H, BF) \
+ { \
+ register head_record *p = \
+ (head_record *) PTR_REC_TO_HEAD(H); \
+ register int bal_f = (BF); \
+ \
+ if (bal_f <= 0) \
+ p->block_size |= HIGH_BIT_BAU_SIZE; \
+ else \
+ p->block_size &= ~HIGH_BIT_BAU_SIZE; \
+ if (bal_f >= 0) \
+ p->previous_block_size |= HIGH_BIT_BAU_SIZE; \
+ else \
+ p->previous_block_size &= ~HIGH_BIT_BAU_SIZE; \
+ }
+
+#define COMPARE_KEY_KEY(K1, K2) ((K1) == (K2) ? 0 : ((K1) > (K2) ? 1 : -1))
+
+#define AVL_COMPARE_KEY_NODE(K, H) \
+ COMPARE_KEY_KEY(K, BLOCK_BAUS(PTR_REC_TO_HEAD(H)))
+
+#define AVL_COMPARE_NODE_NODE(H1, H2) \
+ COMPARE_KEY_KEY(BLOCK_BAUS(PTR_REC_TO_HEAD(H1)), \
+ BLOCK_BAUS(PTR_REC_TO_HEAD(H2)))
+
+#define AVL_NULL ((ptr_record *) 0)
+
+#define AVL_IMPL_MASK \
+ ( AVL_IMPL_INSERT | AVL_IMPL_SEARCH | AVL_IMPL_REMOVE | AVL_IMPL_SUBST )
+
+#include "cavl_impl.h"
diff --git a/Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/hmm_dflt_abort.c b/Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/hmm_dflt_abort.c
new file mode 100644
index 00000000..0bbee582
--- /dev/null
+++ b/Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/hmm_dflt_abort.c
@@ -0,0 +1,43 @@
+/* This code is in the public domain.
+** Version: 1.1 Author: Walt Karas
+*/
+
+/* The function in this file performs default actions if self-auditing
+** finds heap corruption. Don't rely my feeble attempt to handle the
+** case where HMM is being used to implement the malloc and free standard
+** library functions. Rewrite the function if necessary to avoid using
+** I/O and execution termination functions that call malloc or free.
+** In Unix, for example, you would replace the fputs calls with calls
+** to the write system call using file handle number 2.
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+
+static int entered = 0;
+
+/* Print abort message, file and line. Terminate execution.
+*/
+void HMM_dflt_abort(const char *file, const char *line)
+ {
+ /* Avoid use of printf(), which is more likely to use heap. */
+
+ if (entered)
+ /* The standard I/O functions called a heap function and caused
+ ** an indirect recursive call to this function. So we'll have
+ ** to just exit without printing a message. */
+ while(1);
+
+ entered = 1;
+
+ fputs("\nABORT - Heap corruption\n" "File: ", stderr);
+ fputs(file, stderr);
+ fputs(" Line: ", stderr);
+ fputs(line, stderr);
+ fputs("\n\n", stderr);
+ fputs( "HMM_dflt_abort: while(1)!!!\n", stderr );
+ fflush(stderr);
+
+ while(1);
+ }
+
diff --git a/Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/hmm_grow.c b/Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/hmm_grow.c
new file mode 100644
index 00000000..b90212dc
--- /dev/null
+++ b/Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/hmm_grow.c
@@ -0,0 +1,39 @@
+/* This code is in the public domain.
+** Version: 1.1 Author: Walt Karas
+*/
+
+#include "hmm_intrnl.h"
+
+void U(grow_chunk)(U(descriptor) *desc, void *end, U(size_bau) n_baus)
+ {
+ #undef HEAD_PTR
+ #define HEAD_PTR ((head_record *) end)
+
+ end = BAUS_BACKWARD(end, DUMMY_END_BLOCK_BAUS);
+
+ #ifdef HMM_AUDIT_FAIL
+
+ if (HEAD_PTR->block_size != 0)
+ /* Chunk does not have valid dummy end block. */
+ HMM_AUDIT_FAIL
+
+ #endif
+
+ /* Create a new block that absorbs the old dummy end block. */
+ HEAD_PTR->block_size = n_baus;
+
+ /* Set up the new dummy end block. */
+ {
+ head_record *dummy = (head_record *) BAUS_FORWARD(end, n_baus);
+ dummy->previous_block_size = n_baus;
+ dummy->block_size = 0;
+ }
+
+ /* Simply free the new block, allowing it to coalesce with any
+ ** free block at that was the last block in the chunk prior to
+ ** growth.
+ */
+ U(free)(desc, HEAD_TO_PTR_REC(end));
+
+ #undef HEAD_PTR
+ }
diff --git a/Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/hmm_largest.c b/Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/hmm_largest.c
new file mode 100644
index 00000000..4b01e072
--- /dev/null
+++ b/Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/hmm_largest.c
@@ -0,0 +1,49 @@
+/* This code is in the public domain.
+** Version: 1.1 Author: Walt Karas
+*/
+
+#include "hmm_intrnl.h"
+
+U(size_aau) U(largest_available)(U(descriptor) *desc)
+ {
+ U(size_bau) largest;
+
+ if (!(desc->avl_tree_root))
+ largest = 0;
+ else
+ {
+ #ifdef HMM_AUDIT_FAIL
+ /* Audit root block in AVL tree. */
+ AUDIT_BLOCK(PTR_REC_TO_HEAD(desc->avl_tree_root))
+ #endif
+
+ largest =
+ BLOCK_BAUS(
+ PTR_REC_TO_HEAD(
+ U(avl_search)(
+ (U(avl_avl) *) &(desc->avl_tree_root),
+ (U(size_bau)) ~ (U(size_bau)) 0, AVL_LESS)));
+ }
+
+ if (desc->last_freed)
+ {
+ /* Size of last freed block. */
+ register U(size_bau) lf_size;
+
+ #ifdef HMM_AUDIT_FAIL
+ AUDIT_BLOCK(desc->last_freed)
+ #endif
+
+ lf_size = BLOCK_BAUS(desc->last_freed);
+
+ if (lf_size > largest)
+ largest = lf_size;
+ }
+
+ /* Convert largest size to AAUs and subract head size leaving payload
+ ** size.
+ */
+ return(largest ?
+ ((largest * ((U(size_aau)) HMM_BLOCK_ALIGN_UNIT)) - HEAD_AAUS) :
+ 0);
+ }
diff --git a/Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/hmm_resize.c b/Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/hmm_resize.c
new file mode 100644
index 00000000..c17d15a7
--- /dev/null
+++ b/Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/hmm_resize.c
@@ -0,0 +1,107 @@
+/* This code is in the public domain.
+** Version: 1.1 Author: Walt Karas
+*/
+
+#include "hmm_intrnl.h"
+
+int U(resize)(U(descriptor) *desc, void *mem, U(size_aau) n)
+ {
+ U(size_aau) i;
+ head_record *next_head_ptr;
+ head_record *head_ptr = PTR_REC_TO_HEAD(mem);
+
+ /* Flag. */
+ int next_block_free;
+
+ /* Convert n from desired block size in AAUs to BAUs. */
+ n += HEAD_AAUS;
+ n = DIV_ROUND_UP(n, HMM_BLOCK_ALIGN_UNIT);
+ if (n < MIN_BLOCK_BAUS)
+ n = MIN_BLOCK_BAUS;
+
+ #ifdef HMM_AUDIT_FAIL
+
+ AUDIT_BLOCK(head_ptr)
+
+ if (!IS_BLOCK_ALLOCATED(head_ptr))
+ HMM_AUDIT_FAIL
+
+ if (desc->avl_tree_root)
+ AUDIT_BLOCK(PTR_REC_TO_HEAD(desc->avl_tree_root))
+
+ #endif
+
+ i = head_ptr->block_size;
+
+ next_head_ptr =
+ (head_record *) BAUS_FORWARD(head_ptr, head_ptr->block_size);
+
+ next_block_free =
+ (next_head_ptr == desc->last_freed) ||
+ !IS_BLOCK_ALLOCATED(next_head_ptr);
+
+ if (next_block_free)
+ /* Block can expand into next free block. */
+ i += BLOCK_BAUS(next_head_ptr);
+
+ if (n > i)
+ /* Not enough room for block to expand. */
+ return(-1);
+
+ if (next_block_free)
+ {
+ #ifdef HMM_AUDIT_FAIL
+ AUDIT_BLOCK(next_head_ptr)
+ #endif
+
+ if (next_head_ptr == desc->last_freed)
+ desc->last_freed = 0;
+ else
+ U(out_of_free_collection)(desc, next_head_ptr);
+
+ next_head_ptr =
+ (head_record *) BAUS_FORWARD(head_ptr, (U(size_bau)) i);
+ }
+
+ /* Set i to number of "extra" BAUs. */
+ i -= n;
+
+ if (i < MIN_BLOCK_BAUS)
+ /* Not enough extra BAUs to be a block on their own, so just keep them
+ ** in the block being resized.
+ */
+ {
+ n += i;
+ i = n;
+ }
+ else
+ {
+ /* There are enough "leftover" BAUs in the next block to
+ ** form a remainder block. */
+
+ head_record *rem_head_ptr;
+
+ rem_head_ptr = (head_record *) BAUS_FORWARD(head_ptr, n);
+
+ rem_head_ptr->previous_block_size = (U(size_bau)) n;
+ rem_head_ptr->block_size = (U(size_bau)) i;
+
+ if (desc->last_freed)
+ {
+ #ifdef HMM_AUDIT_FAIL
+ AUDIT_BLOCK(desc->last_freed)
+ #endif
+
+ U(into_free_collection)(desc, (head_record *) (desc->last_freed));
+
+ desc->last_freed = 0;
+ }
+
+ desc->last_freed = rem_head_ptr;
+ }
+
+ head_ptr->block_size = (U(size_bau)) n;
+ next_head_ptr->previous_block_size = (U(size_bau)) i;
+
+ return(0);
+ }
diff --git a/Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/hmm_shrink.c b/Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/hmm_shrink.c
new file mode 100644
index 00000000..5bf17ab3
--- /dev/null
+++ b/Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/hmm_shrink.c
@@ -0,0 +1,96 @@
+/* This code is in the public domain.
+** Version: 1.1 Author: Walt Karas
+*/
+
+#include "hmm_intrnl.h"
+
+void U(shrink_chunk)(U(descriptor) *desc, U(size_bau) n_baus_to_shrink)
+ {
+ head_record *dummy_end_block = (head_record *)
+ BAUS_BACKWARD(desc->end_of_shrinkable_chunk, DUMMY_END_BLOCK_BAUS);
+
+ #ifdef HMM_AUDIT_FAIL
+
+ if (dummy_end_block->block_size != 0)
+ /* Chunk does not have valid dummy end block. */
+ HMM_AUDIT_FAIL
+
+ #endif
+
+ if (n_baus_to_shrink)
+ {
+ head_record *last_block = (head_record *)
+ BAUS_BACKWARD(
+ dummy_end_block, dummy_end_block->previous_block_size);
+
+ #ifdef HMM_AUDIT_FAIL
+ AUDIT_BLOCK(last_block)
+ #endif
+
+ if (last_block == desc->last_freed)
+ {
+ U(size_bau) bs = BLOCK_BAUS(last_block);
+
+ /* Chunk will not be shrunk out of existence if
+ ** 1. There is at least one allocated block in the chunk
+ ** and the amount to shrink is exactly the size of the
+ ** last block, OR
+ ** 2. After the last block is shrunk, there will be enough
+ ** BAUs left in it to form a minimal size block. */
+ int chunk_will_survive =
+ (PREV_BLOCK_BAUS(last_block) && (n_baus_to_shrink == bs)) ||
+ (n_baus_to_shrink <= (U(size_bau)) (bs - MIN_BLOCK_BAUS));
+
+ if (chunk_will_survive ||
+ (!PREV_BLOCK_BAUS(last_block) &&
+ (n_baus_to_shrink ==
+ (U(size_bau)) (bs + DUMMY_END_BLOCK_BAUS))))
+ {
+ desc->last_freed = 0;
+
+ if (chunk_will_survive)
+ {
+ bs -= n_baus_to_shrink;
+ if (bs)
+ {
+ /* The last (non-dummy) block was not completely
+ ** eliminated by the shrink. */
+
+ last_block->block_size = bs;
+
+ /* Create new dummy end record.
+ */
+ dummy_end_block =
+ (head_record *) BAUS_FORWARD(last_block, bs);
+ dummy_end_block->previous_block_size = bs;
+ dummy_end_block->block_size = 0;
+
+ #ifdef HMM_AUDIT_FAIL
+ if (desc->avl_tree_root)
+ AUDIT_BLOCK(PTR_REC_TO_HEAD(desc->avl_tree_root))
+ #endif
+
+ U(into_free_collection)(desc, last_block);
+ }
+ else
+ {
+ /* The last (non-dummy) block was completely
+ ** eliminated by the shrink. Make its head
+ ** the new dummy end block.
+ */
+ last_block->block_size = 0;
+ last_block->previous_block_size &= ~HIGH_BIT_BAU_SIZE;
+ }
+ }
+ }
+ #ifdef HMM_AUDIT_FAIL
+ else
+ HMM_AUDIT_FAIL
+ #endif
+ }
+ #ifdef HMM_AUDIT_FAIL
+ else
+ HMM_AUDIT_FAIL
+ #endif
+ }
+ }
diff --git a/Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/hmm_true.c b/Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/hmm_true.c
new file mode 100644
index 00000000..23492b27
--- /dev/null
+++ b/Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/hmm_true.c
@@ -0,0 +1,21 @@
+/* This code is in the public domain.
+** Version: 1.1 Author: Walt Karas
+*/
+
+#include "hmm_intrnl.h"
+
+U(size_aau) U(true_size)(void *payload_ptr)
+ {
+ register head_record *head_ptr = PTR_REC_TO_HEAD(payload_ptr);
+
+ #ifdef HMM_AUDIT_FAIL
+ AUDIT_BLOCK(head_ptr)
+ #endif
+
+ /* Convert block size from BAUs to AAUs. Subtract head size, leaving
+ ** payload size.
+ */
+ return(
+ (BLOCK_BAUS(head_ptr) * ((U(size_aau)) HMM_BLOCK_ALIGN_UNIT)) -
+ HEAD_AAUS);
+ }
diff --git a/Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/include/cavl_if.h b/Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/include/cavl_if.h
new file mode 100644
index 00000000..a2df0830
--- /dev/null
+++ b/Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/include/cavl_if.h
@@ -0,0 +1,216 @@
+/* Abstract AVL Tree Generic C Package.
+** Interface generation header file.
+**
+** This code is in the public domain. See cavl_tree.html for interface
+** documentation.
+**
+** Version: 1.5 Author: Walt Karas
+*/
+
+/* This header contains the definition of CHAR_BIT (number of bits in a
+** char). */
+#include <limits.h>
+
+#undef L__
+#undef L__EST_LONG_BIT
+#undef L__SIZE
+#undef L__SC
+#undef L__LONG_BIT
+#undef L__BIT_ARR_DEFN
+
+#ifndef AVL_SEARCH_TYPE_DEFINED_
+#define AVL_SEARCH_TYPE_DEFINED_
+
+typedef enum
+ {
+ AVL_EQUAL = 1,
+ AVL_LESS = 2,
+ AVL_GREATER = 4,
+ AVL_LESS_EQUAL = AVL_EQUAL | AVL_LESS,
+ AVL_GREATER_EQUAL = AVL_EQUAL | AVL_GREATER
+ }
+avl_search_type;
+
+#endif
+
+#ifdef AVL_UNIQUE
+
+#define L__ AVL_UNIQUE
+
+#else
+
+#define L__(X) X
+
+#endif
+
+/* Determine storage class for function prototypes. */
+#ifdef AVL_PRIVATE
+
+#define L__SC static
+
+#else
+
+#define L__SC extern
+
+#endif
+
+#ifdef AVL_SIZE
+
+#define L__SIZE AVL_SIZE
+
+#else
+
+#define L__SIZE unsigned long
+
+#endif
+
+typedef struct
+ {
+ #ifdef AVL_INSIDE_STRUCT
+
+ AVL_INSIDE_STRUCT
+
+ #endif
+
+ AVL_HANDLE root;
+ }
+L__(avl);
+
+/* Function prototypes. */
+
+L__SC void L__(init)(L__(avl) *tree);
+
+L__SC int L__(is_empty)(L__(avl) *tree);
+
+L__SC AVL_HANDLE L__(insert)(L__(avl) *tree, AVL_HANDLE h);
+
+L__SC AVL_HANDLE L__(search)(L__(avl) *tree, AVL_KEY k, avl_search_type st);
+
+L__SC AVL_HANDLE L__(search_least)(L__(avl) *tree);
+
+L__SC AVL_HANDLE L__(search_greatest)(L__(avl) *tree);
+
+L__SC AVL_HANDLE L__(remove)(L__(avl) *tree, AVL_KEY k);
+
+L__SC AVL_HANDLE L__(subst)(L__(avl) *tree, AVL_HANDLE new_node);
+
+#ifdef AVL_BUILD_ITER_TYPE
+
+L__SC int L__(build)(
+ L__(avl) *tree, AVL_BUILD_ITER_TYPE p, L__SIZE num_nodes);
+
+#endif
+
+/* ANSI C/ISO C++ require that a long have at least 32 bits. Set
+** L__EST_LONG_BIT to be the greatest multiple of 8 in the range
+** 32 - 64 (inclusive) that is less than or equal to the number of
+** bits in a long.
+*/
+
+#if (((LONG_MAX >> 31) >> 7) == 0)
+
+#define L__EST_LONG_BIT 32
+
+#elif (((LONG_MAX >> 31) >> 15) == 0)
+
+#define L__EST_LONG_BIT 40
+
+#elif (((LONG_MAX >> 31) >> 23) == 0)
+
+#define L__EST_LONG_BIT 48
+
+#elif (((LONG_MAX >> 31) >> 31) == 0)
+
+#define L__EST_LONG_BIT 56
+
+#else
+
+#define L__EST_LONG_BIT 64
+
+#endif
+
+/* Number of bits in a long. */
+#define L__LONG_BIT (sizeof(long) * CHAR_BIT)
+
+/* The macro L__BIT_ARR_DEFN defines a bit array whose index is a (0-based)
+** node depth. The definition depends on whether the maximum depth is more
+** or less than the number of bits in a single long.
+*/
+
+#if ((AVL_MAX_DEPTH) > L__EST_LONG_BIT)
+
+/* Maximum depth may be more than number of bits in a long. */
+
+#define L__BIT_ARR_DEFN(NAME) \
+ unsigned long NAME[((AVL_MAX_DEPTH) + L__LONG_BIT - 1) / L__LONG_BIT];
+
+#else
+
+/* Maximum depth is definitely less than number of bits in a long. */
+
+#define L__BIT_ARR_DEFN(NAME) unsigned long NAME;
+
+#endif
+
+/* Iterator structure. */
+typedef struct
+ {
+ /* Tree being iterated over. */
+ L__(avl) *tree_;
+
+ /* Records a path into the tree. If bit n is true, indicates
+ ** take greater branch from the nth node in the path, otherwise
+ ** take the less branch. bit 0 gives branch from root, and
+ ** so on. */
+ L__BIT_ARR_DEFN(branch)
+
+ /* Zero-based depth of path into tree. */
+ unsigned depth;
+
+ /* Handles of nodes in path from root to current node (returned by *). */
+ AVL_HANDLE path_h[(AVL_MAX_DEPTH) - 1];
+ }
+L__(iter);
+
+/* Iterator function prototypes. */
+
+L__SC void L__(start_iter)(
+ L__(avl) *tree, L__(iter) *iter, AVL_KEY k, avl_search_type st);
+
+L__SC void L__(start_iter_least)(L__(avl) *tree, L__(iter) *iter);
+
+L__SC void L__(start_iter_greatest)(L__(avl) *tree, L__(iter) *iter);
+
+L__SC AVL_HANDLE L__(get_iter)(L__(iter) *iter);
+
+L__SC void L__(incr_iter)(L__(iter) *iter);
+
+L__SC void L__(decr_iter)(L__(iter) *iter);
+
+L__SC void L__(init_iter)(L__(iter) *iter);
+
+#define AVL_IMPL_INIT 1
+#define AVL_IMPL_IS_EMPTY (1 << 1)
+#define AVL_IMPL_INSERT (1 << 2)
+#define AVL_IMPL_SEARCH (1 << 3)
+#define AVL_IMPL_SEARCH_LEAST (1 << 4)
+#define AVL_IMPL_SEARCH_GREATEST (1 << 5)
+#define AVL_IMPL_REMOVE (1 << 6)
+#define AVL_IMPL_BUILD (1 << 7)
+#define AVL_IMPL_START_ITER (1 << 8)
+#define AVL_IMPL_START_ITER_LEAST (1 << 9)
+#define AVL_IMPL_START_ITER_GREATEST (1 << 10)
+#define AVL_IMPL_GET_ITER (1 << 11)
+#define AVL_IMPL_INCR_ITER (1 << 12)
+#define AVL_IMPL_DECR_ITER (1 << 13)
+#define AVL_IMPL_INIT_ITER (1 << 14)
+#define AVL_IMPL_SUBST (1 << 15)
+
+#define AVL_IMPL_ALL (~0)
+
+#undef L__
+#undef L__EST_LONG_BIT
+#undef L__SIZE
+#undef L__SC
+#undef L__LONG_BIT
+#undef L__BIT_ARR_DEFN
diff --git a/Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/include/cavl_impl.h b/Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/include/cavl_impl.h
new file mode 100644
index 00000000..21242da9
--- /dev/null
+++ b/Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/include/cavl_impl.h
@@ -0,0 +1,1181 @@
+/* Abstract AVL Tree Generic C Package.
+** Implementation generation header file.
+**
+** This code is in the public domain. See cavl_tree.html for interface
+** documentation.
+**
+** Version: 1.5 Author: Walt Karas
+*/
+
+#undef L__
+#undef L__EST_LONG_BIT
+#undef L__SIZE
+#undef L__tree
+#undef L__MASK_HIGH_BIT
+#undef L__LONG_BIT
+#undef L__BIT_ARR_DEFN
+#undef L__BIT_ARR_VAL
+#undef L__BIT_ARR_0
+#undef L__BIT_ARR_1
+#undef L__BIT_ARR_ALL
+#undef L__BIT_ARR_LONGS
+#undef L__IMPL_MASK
+#undef L__CHECK_READ_ERROR
+#undef L__CHECK_READ_ERROR_INV_DEPTH
+#undef L__SC
+#undef L__BALANCE_PARAM_PREFIX
+
+#ifdef AVL_UNIQUE
+
+#define L__ AVL_UNIQUE
+
+#else
+
+#define L__(X) X
+
+#endif
+
+/* Determine correct storage class for functions */
+#ifdef AVL_PRIVATE
+
+#define L__SC static
+
+#else
+
+#define L__SC
+
+#endif
+
+#ifdef AVL_SIZE
+
+#define L__SIZE AVL_SIZE
+
+#else
+
+#define L__SIZE unsigned long
+
+#endif
+
+#define L__MASK_HIGH_BIT ((int) ~ ((~ (unsigned) 0) >> 1))
+
+/* ANSI C/ISO C++ require that a long have at least 32 bits. Set
+** L__EST_LONG_BIT to be the greatest multiple of 8 in the range
+** 32 - 64 (inclusive) that is less than or equal to the number of
+** bits in a long.
+*/
+
+#if (((LONG_MAX >> 31) >> 7) == 0)
+
+#define L__EST_LONG_BIT 32
+
+#elif (((LONG_MAX >> 31) >> 15) == 0)
+
+#define L__EST_LONG_BIT 40
+
+#elif (((LONG_MAX >> 31) >> 23) == 0)
+
+#define L__EST_LONG_BIT 48
+
+#elif (((LONG_MAX >> 31) >> 31) == 0)
+
+#define L__EST_LONG_BIT 56
+
+#else
+
+#define L__EST_LONG_BIT 64
+
+#endif
+
+#define L__LONG_BIT (sizeof(long) * CHAR_BIT)
+
+#if ((AVL_MAX_DEPTH) > L__EST_LONG_BIT)
+
+/* The maximum depth may be greater than the number of bits in a long,
+** so multiple longs are needed to hold a bit array indexed by node
+** depth. */
+
+#define L__BIT_ARR_LONGS (((AVL_MAX_DEPTH) + L__LONG_BIT - 1) / L__LONG_BIT)
+
+#define L__BIT_ARR_DEFN(NAME) unsigned long NAME[L__BIT_ARR_LONGS];
+
+#define L__BIT_ARR_VAL(BIT_ARR, BIT_NUM) \
+ ((BIT_ARR)[(BIT_NUM) / L__LONG_BIT] & (1L << ((BIT_NUM) % L__LONG_BIT)))
+
+#define L__BIT_ARR_0(BIT_ARR, BIT_NUM) \
+ (BIT_ARR)[(BIT_NUM) / L__LONG_BIT] &= ~(1L << ((BIT_NUM) % L__LONG_BIT));
+
+#define L__BIT_ARR_1(BIT_ARR, BIT_NUM) \
+ (BIT_ARR)[(BIT_NUM) / L__LONG_BIT] |= 1L << ((BIT_NUM) % L__LONG_BIT);
+
+#define L__BIT_ARR_ALL(BIT_ARR, BIT_VAL) \
+ { int i = L__BIT_ARR_LONGS; do (BIT_ARR)[--i] = 0L - (BIT_VAL); while(i); }
+
+#else /* The bit array can definitely fit in one long */
+
+#define L__BIT_ARR_DEFN(NAME) unsigned long NAME;
+
+#define L__BIT_ARR_VAL(BIT_ARR, BIT_NUM) ((BIT_ARR) & (1L << (BIT_NUM)))
+
+#define L__BIT_ARR_0(BIT_ARR, BIT_NUM) (BIT_ARR) &= ~(1L << (BIT_NUM));
+
+#define L__BIT_ARR_1(BIT_ARR, BIT_NUM) (BIT_ARR) |= 1L << (BIT_NUM);
+
+#define L__BIT_ARR_ALL(BIT_ARR, BIT_VAL) (BIT_ARR) = 0L - (BIT_VAL);
+
+#endif
+
+#ifdef AVL_READ_ERRORS_HAPPEN
+
+#define L__CHECK_READ_ERROR(ERROR_RETURN) \
+{ if (AVL_READ_ERROR) return(ERROR_RETURN); }
+
+#else
+
+#define L__CHECK_READ_ERROR(ERROR_RETURN)
+
+#endif
+
+/* The presumed reason that an instantiation places additional fields
+** inside the AVL tree structure is that the SET_ and GET_ macros
+** need these fields. The "balance" function does not explicitly use
+** any fields in the AVL tree structure, so only pass an AVL tree
+** structure pointer to "balance" if it has instantiation-specific
+** fields that are (presumably) needed by the SET_/GET_ calls within
+** "balance".
+*/
+#ifdef AVL_INSIDE_STRUCT
+
+#define L__BALANCE_PARAM_CALL_PREFIX L__tree,
+#define L__BALANCE_PARAM_DECL_PREFIX L__(avl) *L__tree,
+
+#else
+
+#define L__BALANCE_PARAM_CALL_PREFIX
+#define L__BALANCE_PARAM_DECL_PREFIX
+
+#endif
+
+#ifdef AVL_IMPL_MASK
+
+#define L__IMPL_MASK (AVL_IMPL_MASK)
+
+#else
+
+/* Define all functions. */
+#define L__IMPL_MASK AVL_IMPL_ALL
+
+#endif
+
+#if (L__IMPL_MASK & AVL_IMPL_INIT)
+
+L__SC void L__(init)(L__(avl) *L__tree) { L__tree->root = AVL_NULL; }
+
+#endif
+
+#if (L__IMPL_MASK & AVL_IMPL_IS_EMPTY)
+
+L__SC int L__(is_empty)(L__(avl) *L__tree)
+ { return(L__tree->root == AVL_NULL); }
+
+#endif
+
+/* Put the private balance function in the same compilation module as
+** the insert function. */
+#if (L__IMPL_MASK & AVL_IMPL_INSERT)
+
+/* Balances subtree, returns handle of root node of subtree after balancing.
+*/
+L__SC AVL_HANDLE L__(balance)(L__BALANCE_PARAM_DECL_PREFIX AVL_HANDLE bal_h)
+ {
+ AVL_HANDLE deep_h;
+
+ /* Either the "greater than" or the "less than" subtree of
+ ** this node has to be 2 levels deeper (or else it wouldn't
+ ** need balancing).
+ */
+ if (AVL_GET_BALANCE_FACTOR(bal_h) > 0)
+ {
+ /* "Greater than" subtree is deeper. */
+
+ deep_h = AVL_GET_GREATER(bal_h, 1);
+
+ L__CHECK_READ_ERROR(AVL_NULL)
+
+ if (AVL_GET_BALANCE_FACTOR(deep_h) < 0)
+ {
+ int bf;
+
+ AVL_HANDLE old_h = bal_h;
+ bal_h = AVL_GET_LESS(deep_h, 1);
+ L__CHECK_READ_ERROR(AVL_NULL)
+ AVL_SET_GREATER(old_h, AVL_GET_LESS(bal_h, 1))
+ AVL_SET_LESS(deep_h, AVL_GET_GREATER(bal_h, 1))
+ AVL_SET_LESS(bal_h, old_h)
+ AVL_SET_GREATER(bal_h, deep_h)
+
+ bf = AVL_GET_BALANCE_FACTOR(bal_h);
+ if (bf != 0)
+ {
+ if (bf > 0)
+ {
+ AVL_SET_BALANCE_FACTOR(old_h, -1)
+ AVL_SET_BALANCE_FACTOR(deep_h, 0)
+ }
+ else
+ {
+ AVL_SET_BALANCE_FACTOR(deep_h, 1)
+ AVL_SET_BALANCE_FACTOR(old_h, 0)
+ }
+ AVL_SET_BALANCE_FACTOR(bal_h, 0)
+ }
+ else
+ {
+ AVL_SET_BALANCE_FACTOR(old_h, 0)
+ AVL_SET_BALANCE_FACTOR(deep_h, 0)
+ }
+ }
+ else
+ {
+ AVL_SET_GREATER(bal_h, AVL_GET_LESS(deep_h, 0))
+ AVL_SET_LESS(deep_h, bal_h)
+ if (AVL_GET_BALANCE_FACTOR(deep_h) == 0)
+ {
+ AVL_SET_BALANCE_FACTOR(deep_h, -1)
+ AVL_SET_BALANCE_FACTOR(bal_h, 1)
+ }
+ else
+ {
+ AVL_SET_BALANCE_FACTOR(deep_h, 0)
+ AVL_SET_BALANCE_FACTOR(bal_h, 0)
+ }
+ bal_h = deep_h;
+ }
+ }
+ else
+ {
+ /* "Less than" subtree is deeper. */
+
+ deep_h = AVL_GET_LESS(bal_h, 1);
+ L__CHECK_READ_ERROR(AVL_NULL)
+
+ if (AVL_GET_BALANCE_FACTOR(deep_h) > 0)
+ {
+ int bf;
+ AVL_HANDLE old_h = bal_h;
+ bal_h = AVL_GET_GREATER(deep_h, 1);
+ L__CHECK_READ_ERROR(AVL_NULL)
+ AVL_SET_LESS(old_h, AVL_GET_GREATER(bal_h, 0))
+ AVL_SET_GREATER(deep_h, AVL_GET_LESS(bal_h, 0))
+ AVL_SET_GREATER(bal_h, old_h)
+ AVL_SET_LESS(bal_h, deep_h)
+
+ bf = AVL_GET_BALANCE_FACTOR(bal_h);
+ if (bf != 0)
+ {
+ if (bf < 0)
+ {
+ AVL_SET_BALANCE_FACTOR(old_h, 1)
+ AVL_SET_BALANCE_FACTOR(deep_h, 0)
+ }
+ else
+ {
+ AVL_SET_BALANCE_FACTOR(deep_h, -1)
+ AVL_SET_BALANCE_FACTOR(old_h, 0)
+ }
+ AVL_SET_BALANCE_FACTOR(bal_h, 0)
+ }
+ else
+ {
+ AVL_SET_BALANCE_FACTOR(old_h, 0)
+ AVL_SET_BALANCE_FACTOR(deep_h, 0)
+ }
+ }
+ else
+ {
+ AVL_SET_LESS(bal_h, AVL_GET_GREATER(deep_h, 0))
+ AVL_SET_GREATER(deep_h, bal_h)
+ if (AVL_GET_BALANCE_FACTOR(deep_h) == 0)
+ {
+ AVL_SET_BALANCE_FACTOR(deep_h, 1)
+ AVL_SET_BALANCE_FACTOR(bal_h, -1)
+ }
+ else
+ {
+ AVL_SET_BALANCE_FACTOR(deep_h, 0)
+ AVL_SET_BALANCE_FACTOR(bal_h, 0)
+ }
+ bal_h = deep_h;
+ }
+ }
+
+ return(bal_h);
+ }
+
+L__SC AVL_HANDLE L__(insert)(L__(avl) *L__tree, AVL_HANDLE h)
+ {
+ AVL_SET_LESS(h, AVL_NULL)
+ AVL_SET_GREATER(h, AVL_NULL)
+ AVL_SET_BALANCE_FACTOR(h, 0)
+
+ if (L__tree->root == AVL_NULL)
+ L__tree->root = h;
+ else
+ {
+ /* Last unbalanced node encountered in search for insertion point. */
+ AVL_HANDLE unbal = AVL_NULL;
+ /* Parent of last unbalanced node. */
+ AVL_HANDLE parent_unbal = AVL_NULL;
+ /* Balance factor of last unbalanced node. */
+ int unbal_bf;
+
+ /* Zero-based depth in tree. */
+ unsigned depth = 0, unbal_depth = 0;
+
+ /* Records a path into the tree. If bit n is true, indicates
+ ** take greater branch from the nth node in the path, otherwise
+ ** take the less branch. bit 0 gives branch from root, and
+ ** so on. */
+ L__BIT_ARR_DEFN(branch)
+
+ AVL_HANDLE hh = L__tree->root;
+ AVL_HANDLE parent = AVL_NULL;
+ int cmp;
+
+ do
+ {
+ if (AVL_GET_BALANCE_FACTOR(hh) != 0)
+ {
+ unbal = hh;
+ parent_unbal = parent;
+ unbal_depth = depth;
+ }
+ cmp = AVL_COMPARE_NODE_NODE(h, hh);
+ if (cmp == 0)
+ /* Duplicate key. */
+ return(hh);
+ parent = hh;
+ if (cmp > 0)
+ {
+ hh = AVL_GET_GREATER(hh, 1);
+ L__BIT_ARR_1(branch, depth)
+ }
+ else
+ {
+ hh = AVL_GET_LESS(hh, 1);
+ L__BIT_ARR_0(branch, depth)
+ }
+ L__CHECK_READ_ERROR(AVL_NULL)
+ depth++;
+ }
+ while (hh != AVL_NULL);
+
+ /* Add node to insert as leaf of tree. */
+ if (cmp < 0)
+ AVL_SET_LESS(parent, h)
+ else
+ AVL_SET_GREATER(parent, h)
+
+ depth = unbal_depth;
+
+ if (unbal == AVL_NULL)
+ hh = L__tree->root;
+ else
+ {
+ cmp = L__BIT_ARR_VAL(branch, depth) ? 1 : -1;
+ depth++;
+ unbal_bf = AVL_GET_BALANCE_FACTOR(unbal);
+ if (cmp < 0)
+ unbal_bf--;
+ else /* cmp > 0 */
+ unbal_bf++;
+ hh = cmp < 0 ? AVL_GET_LESS(unbal, 1) : AVL_GET_GREATER(unbal, 1);
+ L__CHECK_READ_ERROR(AVL_NULL)
+ if ((unbal_bf != -2) && (unbal_bf != 2))
+ {
+ /* No rebalancing of tree is necessary. */
+ AVL_SET_BALANCE_FACTOR(unbal, unbal_bf)
+ unbal = AVL_NULL;
+ }
+ }
+
+ if (hh != AVL_NULL)
+ while (h != hh)
+ {
+ cmp = L__BIT_ARR_VAL(branch, depth) ? 1 : -1;
+ depth++;
+ if (cmp < 0)
+ {
+ AVL_SET_BALANCE_FACTOR(hh, -1)
+ hh = AVL_GET_LESS(hh, 1);
+ }
+ else /* cmp > 0 */
+ {
+ AVL_SET_BALANCE_FACTOR(hh, 1)
+ hh = AVL_GET_GREATER(hh, 1);
+ }
+ L__CHECK_READ_ERROR(AVL_NULL)
+ }
+
+ if (unbal != AVL_NULL)
+ {
+ unbal = L__(balance)(L__BALANCE_PARAM_CALL_PREFIX unbal);
+ L__CHECK_READ_ERROR(AVL_NULL)
+ if (parent_unbal == AVL_NULL)
+ L__tree->root = unbal;
+ else
+ {
+ depth = unbal_depth - 1;
+ cmp = L__BIT_ARR_VAL(branch, depth) ? 1 : -1;
+ if (cmp < 0)
+ AVL_SET_LESS(parent_unbal, unbal)
+ else /* cmp > 0 */
+ AVL_SET_GREATER(parent_unbal, unbal)
+ }
+ }
+
+ }
+
+ return(h);
+ }
+
+#endif
+
+#if (L__IMPL_MASK & AVL_IMPL_SEARCH)
+
+L__SC AVL_HANDLE L__(search)(L__(avl) *L__tree, AVL_KEY k, avl_search_type st)
+ {
+ int cmp, target_cmp;
+ AVL_HANDLE match_h = AVL_NULL;
+ AVL_HANDLE h = L__tree->root;
+
+ if (st & AVL_LESS)
+ target_cmp = 1;
+ else if (st & AVL_GREATER)
+ target_cmp = -1;
+ else
+ target_cmp = 0;
+
+ while (h != AVL_NULL)
+ {
+ cmp = AVL_COMPARE_KEY_NODE(k, h);
+ if (cmp == 0)
+ {
+ if (st & AVL_EQUAL)
+ {
+ match_h = h;
+ break;
+ }
+ cmp = -target_cmp;
+ }
+ else if (target_cmp != 0)
+ if (!((cmp ^ target_cmp) & L__MASK_HIGH_BIT))
+ /* cmp and target_cmp are both positive or both negative. */
+ match_h = h;
+ h = cmp < 0 ? AVL_GET_LESS(h, 1) : AVL_GET_GREATER(h, 1);
+ L__CHECK_READ_ERROR(AVL_NULL)
+ }
+
+ return(match_h);
+ }
+
+#endif
+
+#if (L__IMPL_MASK & AVL_IMPL_SEARCH_LEAST)
+
+L__SC AVL_HANDLE L__(search_least)(L__(avl) *L__tree)
+ {
+ AVL_HANDLE h = L__tree->root;
+ AVL_HANDLE parent = AVL_NULL;
+
+ while (h != AVL_NULL)
+ {
+ parent = h;
+ h = AVL_GET_LESS(h, 1);
+ L__CHECK_READ_ERROR(AVL_NULL)
+ }
+
+ return(parent);
+ }
+
+#endif
+
+#if (L__IMPL_MASK & AVL_IMPL_SEARCH_GREATEST)
+
+L__SC AVL_HANDLE L__(search_greatest)(L__(avl) *L__tree)
+ {
+ AVL_HANDLE h = L__tree->root;
+ AVL_HANDLE parent = AVL_NULL;
+
+ while (h != AVL_NULL)
+ {
+ parent = h;
+ h = AVL_GET_GREATER(h, 1);
+ L__CHECK_READ_ERROR(AVL_NULL)
+ }
+
+ return(parent);
+ }
+
+#endif
+
+#if (L__IMPL_MASK & AVL_IMPL_REMOVE)
+
+/* Prototype of balance function (called by remove) in case not in
+** same compilation unit.
+*/
+L__SC AVL_HANDLE L__(balance)(L__BALANCE_PARAM_DECL_PREFIX AVL_HANDLE bal_h);
+
+L__SC AVL_HANDLE L__(remove)(L__(avl) *L__tree, AVL_KEY k)
+ {
+ /* Zero-based depth in tree. */
+ unsigned depth = 0, rm_depth;
+
+ /* Records a path into the tree. If bit n is true, indicates
+ ** take greater branch from the nth node in the path, otherwise
+ ** take the less branch. bit 0 gives branch from root, and
+ ** so on. */
+ L__BIT_ARR_DEFN(branch)
+
+ AVL_HANDLE h = L__tree->root;
+ AVL_HANDLE parent = AVL_NULL;
+ AVL_HANDLE child;
+ AVL_HANDLE path;
+ int cmp, cmp_shortened_sub_with_path;
+ int reduced_depth;
+ int bf;
+ AVL_HANDLE rm;
+ AVL_HANDLE parent_rm;
+
+ for ( ; ; )
+ {
+ if (h == AVL_NULL)
+ /* No node in tree with given key. */
+ return(AVL_NULL);
+ cmp = AVL_COMPARE_KEY_NODE(k, h);
+ if (cmp == 0)
+ /* Found node to remove. */
+ break;
+ parent = h;
+ if (cmp > 0)
+ {
+ h = AVL_GET_GREATER(h, 1);
+ L__BIT_ARR_1(branch, depth)
+ }
+ else
+ {
+ h = AVL_GET_LESS(h, 1);
+ L__BIT_ARR_0(branch, depth)
+ }
+ L__CHECK_READ_ERROR(AVL_NULL)
+ depth++;
+ cmp_shortened_sub_with_path = cmp;
+ }
+ rm = h;
+ parent_rm = parent;
+ rm_depth = depth;
+
+ /* If the node to remove is not a leaf node, we need to get a
+ ** leaf node, or a node with a single leaf as its child, to put
+ ** in the place of the node to remove. We will get the greatest
+ ** node in the less subtree (of the node to remove), or the least
+ ** node in the greater subtree. We take the leaf node from the
+ ** deeper subtree, if there is one. */
+
+ if (AVL_GET_BALANCE_FACTOR(h) < 0)
+ {
+ child = AVL_GET_LESS(h, 1);
+ L__BIT_ARR_0(branch, depth)
+ cmp = -1;
+ }
+ else
+ {
+ child = AVL_GET_GREATER(h, 1);
+ L__BIT_ARR_1(branch, depth)
+ cmp = 1;
+ }
+ L__CHECK_READ_ERROR(AVL_NULL)
+ depth++;
+
+ if (child != AVL_NULL)
+ {
+ cmp = -cmp;
+ do
+ {
+ parent = h;
+ h = child;
+ if (cmp < 0)
+ {
+ child = AVL_GET_LESS(h, 1);
+ L__BIT_ARR_0(branch, depth)
+ }
+ else
+ {
+ child = AVL_GET_GREATER(h, 1);
+ L__BIT_ARR_1(branch, depth)
+ }
+ L__CHECK_READ_ERROR(AVL_NULL)
+ depth++;
+ }
+ while (child != AVL_NULL);
+
+ if (parent == rm)
+ /* Only went through do loop once. Deleted node will be replaced
+ ** in the tree structure by one of its immediate children. */
+ cmp_shortened_sub_with_path = -cmp;
+ else
+ cmp_shortened_sub_with_path = cmp;
+
+ /* Get the handle of the opposite child, which may not be null. */
+ child = cmp > 0 ? AVL_GET_LESS(h, 0) : AVL_GET_GREATER(h, 0);
+ }
+
+ if (parent == AVL_NULL)
+ /* There were only 1 or 2 nodes in this tree. */
+ L__tree->root = child;
+ else if (cmp_shortened_sub_with_path < 0)
+ AVL_SET_LESS(parent, child)
+ else
+ AVL_SET_GREATER(parent, child)
+
+ /* "path" is the parent of the subtree being eliminated or reduced
+ ** from a depth of 2 to 1. If "path" is the node to be removed, we
+ ** set path to the node we're about to poke into the position of the
+ ** node to be removed. */
+ path = parent == rm ? h : parent;
+
+ if (h != rm)
+ {
+ /* Poke in the replacement for the node to be removed. */
+ AVL_SET_LESS(h, AVL_GET_LESS(rm, 0))
+ AVL_SET_GREATER(h, AVL_GET_GREATER(rm, 0))
+ AVL_SET_BALANCE_FACTOR(h, AVL_GET_BALANCE_FACTOR(rm))
+ if (parent_rm == AVL_NULL)
+ L__tree->root = h;
+ else
+ {
+ depth = rm_depth - 1;
+ if (L__BIT_ARR_VAL(branch, depth))
+ AVL_SET_GREATER(parent_rm, h)
+ else
+ AVL_SET_LESS(parent_rm, h)
+ }
+ }
+
+ if (path != AVL_NULL)
+ {
+ /* Create a temporary linked list from the parent of the path node
+ ** to the root node. */
+ h = L__tree->root;
+ parent = AVL_NULL;
+ depth = 0;
+ while (h != path)
+ {
+ if (L__BIT_ARR_VAL(branch, depth))
+ {
+ child = AVL_GET_GREATER(h, 1);
+ AVL_SET_GREATER(h, parent)
+ }
+ else
+ {
+ child = AVL_GET_LESS(h, 1);
+ AVL_SET_LESS(h, parent)
+ }
+ L__CHECK_READ_ERROR(AVL_NULL)
+ depth++;
+ parent = h;
+ h = child;
+ }
+
+ /* Climb from the path node to the root node using the linked
+ ** list, restoring the tree structure and rebalancing as necessary.
+ */
+ reduced_depth = 1;
+ cmp = cmp_shortened_sub_with_path;
+ for ( ; ; )
+ {
+ if (reduced_depth)
+ {
+ bf = AVL_GET_BALANCE_FACTOR(h);
+ if (cmp < 0)
+ bf++;
+ else /* cmp > 0 */
+ bf--;
+ if ((bf == -2) || (bf == 2))
+ {
+ h = L__(balance)(L__BALANCE_PARAM_CALL_PREFIX h);
+ L__CHECK_READ_ERROR(AVL_NULL)
+ bf = AVL_GET_BALANCE_FACTOR(h);
+ }
+ else
+ AVL_SET_BALANCE_FACTOR(h, bf)
+ reduced_depth = (bf == 0);
+ }
+ if (parent == AVL_NULL)
+ break;
+ child = h;
+ h = parent;
+ depth--;
+ cmp = L__BIT_ARR_VAL(branch, depth) ? 1 : -1;
+ if (cmp < 0)
+ {
+ parent = AVL_GET_LESS(h, 1);
+ AVL_SET_LESS(h, child)
+ }
+ else
+ {
+ parent = AVL_GET_GREATER(h, 1);
+ AVL_SET_GREATER(h, child)
+ }
+ L__CHECK_READ_ERROR(AVL_NULL)
+ }
+ L__tree->root = h;
+ }
+
+ return(rm);
+ }
+
+#endif
+
+#if (L__IMPL_MASK & AVL_IMPL_SUBST)
+
+L__SC AVL_HANDLE L__(subst)(L__(avl) *L__tree, AVL_HANDLE new_node)
+ {
+ AVL_HANDLE h = L__tree->root;
+ AVL_HANDLE parent = AVL_NULL;
+ int cmp, last_cmp;
+
+ /* Search for node already in tree with same key. */
+ for ( ; ; )
+ {
+ if (h == AVL_NULL)
+ /* No node in tree with same key as new node. */
+ return(AVL_NULL);
+ cmp = AVL_COMPARE_NODE_NODE(new_node, h);
+ if (cmp == 0)
+ /* Found the node to substitute new one for. */
+ break;
+ last_cmp = cmp;
+ parent = h;
+ h = cmp < 0 ? AVL_GET_LESS(h, 1) : AVL_GET_GREATER(h, 1);
+ L__CHECK_READ_ERROR(AVL_NULL)
+ }
+
+ /* Copy tree housekeeping fields from node in tree to new node. */
+ AVL_SET_LESS(new_node, AVL_GET_LESS(h, 0))
+ AVL_SET_GREATER(new_node, AVL_GET_GREATER(h, 0))
+ AVL_SET_BALANCE_FACTOR(new_node, AVL_GET_BALANCE_FACTOR(h))
+
+ if (parent == AVL_NULL)
+ /* New node is also new root. */
+ L__tree->root = new_node;
+ else
+ {
+ /* Make parent point to new node. */
+ if (last_cmp < 0)
+ AVL_SET_LESS(parent, new_node)
+ else
+ AVL_SET_GREATER(parent, new_node)
+ }
+
+ return(h);
+ }
+
+#endif
+
+#ifdef AVL_BUILD_ITER_TYPE
+
+#if (L__IMPL_MASK & AVL_IMPL_BUILD)
+
+L__SC int L__(build)(
+ L__(avl) *L__tree, AVL_BUILD_ITER_TYPE p, L__SIZE num_nodes)
+ {
+ /* Gives path to subtree being built. If bit n is false, branch
+ ** less from the node at depth n, if true branch greater. */
+ L__BIT_ARR_DEFN(branch)
+
+ /* If bit n is true, then for the current subtree at depth n, its
+ ** greater subtree has one more node than its less subtree. */
+ L__BIT_ARR_DEFN(rem)
+
+ /* Depth of root node of current subtree. */
+ unsigned depth = 0;
+
+ /* Number of nodes in current subtree. */
+ L__SIZE num_sub = num_nodes;
+
+ /* The algorithm relies on a stack of nodes whose less subtree has
+ ** been built, but whose greater subtree has not yet been built.
+ ** The stack is implemented as linked list. The nodes are linked
+ ** together by having the "greater" handle of a node set to the
+ ** next node in the list. "less_parent" is the handle of the first
+ ** node in the list. */
+ AVL_HANDLE less_parent = AVL_NULL;
+
+ /* h is root of current subtree, child is one of its children. */
+ AVL_HANDLE h;
+ AVL_HANDLE child;
+
+ if (num_nodes == 0)
+ {
+ L__tree->root = AVL_NULL;
+ return(1);
+ }
+
+ for ( ; ; )
+ {
+ while (num_sub > 2)
+ {
+ /* Subtract one for root of subtree. */
+ num_sub--;
+ if (num_sub & 1)
+ L__BIT_ARR_1(rem, depth)
+ else
+ L__BIT_ARR_0(rem, depth)
+ L__BIT_ARR_0(branch, depth)
+ depth++;
+ num_sub >>= 1;
+ }
+
+ if (num_sub == 2)
+ {
+ /* Build a subtree with two nodes, slanting to greater.
+ ** I arbitrarily chose to always have the extra node in the
+ ** greater subtree when there is an odd number of nodes to
+ ** split between the two subtrees. */
+
+ h = AVL_BUILD_ITER_VAL(p);
+ L__CHECK_READ_ERROR(0)
+ AVL_BUILD_ITER_INCR(p)
+ child = AVL_BUILD_ITER_VAL(p);
+ L__CHECK_READ_ERROR(0)
+ AVL_BUILD_ITER_INCR(p)
+ AVL_SET_LESS(child, AVL_NULL)
+ AVL_SET_GREATER(child, AVL_NULL)
+ AVL_SET_BALANCE_FACTOR(child, 0)
+ AVL_SET_GREATER(h, child)
+ AVL_SET_LESS(h, AVL_NULL)
+ AVL_SET_BALANCE_FACTOR(h, 1)
+ }
+ else /* num_sub == 1 */
+ {
+ /* Build a subtree with one node. */
+
+ h = AVL_BUILD_ITER_VAL(p);
+ L__CHECK_READ_ERROR(0)
+ AVL_BUILD_ITER_INCR(p)
+ AVL_SET_LESS(h, AVL_NULL)
+ AVL_SET_GREATER(h, AVL_NULL)
+ AVL_SET_BALANCE_FACTOR(h, 0)
+ }
+
+ while (depth)
+ {
+ depth--;
+ if (!L__BIT_ARR_VAL(branch, depth))
+ /* We've completed a less subtree. */
+ break;
+
+ /* We've completed a greater subtree, so attach it to
+ ** its parent (that is less than it). We pop the parent
+ ** off the stack of less parents. */
+ child = h;
+ h = less_parent;
+ less_parent = AVL_GET_GREATER(h, 1);
+ L__CHECK_READ_ERROR(0)
+ AVL_SET_GREATER(h, child)
+ /* num_sub = 2 * (num_sub - rem[depth]) + rem[depth] + 1 */
+ num_sub <<= 1;
+ num_sub += L__BIT_ARR_VAL(rem, depth) ? 0 : 1;
+ if (num_sub & (num_sub - 1))
+ /* num_sub is not a power of 2. */
+ AVL_SET_BALANCE_FACTOR(h, 0)
+ else
+ /* num_sub is a power of 2. */
+ AVL_SET_BALANCE_FACTOR(h, 1)
+ }
+
+ if (num_sub == num_nodes)
+ /* We've completed the full tree. */
+ break;
+
+ /* The subtree we've completed is the less subtree of the
+ ** next node in the sequence. */
+
+ child = h;
+ h = AVL_BUILD_ITER_VAL(p);
+ L__CHECK_READ_ERROR(0)
+ AVL_BUILD_ITER_INCR(p)
+ AVL_SET_LESS(h, child)
+
+ /* Put h into stack of less parents. */
+ AVL_SET_GREATER(h, less_parent)
+ less_parent = h;
+
+ /* Proceed to creating greater than subtree of h. */
+ L__BIT_ARR_1(branch, depth)
+ num_sub += L__BIT_ARR_VAL(rem, depth) ? 1 : 0;
+ depth++;
+
+ } /* end for ( ; ; ) */
+
+ L__tree->root = h;
+
+ return(1);
+ }
+
+#endif
+
+#endif
+
+#if (L__IMPL_MASK & AVL_IMPL_INIT_ITER)
+
+/* Initialize depth to invalid value, to indicate iterator is
+** invalid. (Depth is zero-base.) It's not necessary to initialize
+** iterators prior to passing them to the "start" function.
+*/
+L__SC void L__(init_iter)(L__(iter) *iter) { iter->depth = ~0; }
+
+#endif
+
+#ifdef AVL_READ_ERRORS_HAPPEN
+
+#define L__CHECK_READ_ERROR_INV_DEPTH \
+{ if (AVL_READ_ERROR) { iter->depth = ~0; return; } }
+
+#else
+
+#define L__CHECK_READ_ERROR_INV_DEPTH
+
+#endif
+
+#if (L__IMPL_MASK & AVL_IMPL_START_ITER)
+
+L__SC void L__(start_iter)(
+ L__(avl) *L__tree, L__(iter) *iter, AVL_KEY k, avl_search_type st)
+ {
+ AVL_HANDLE h = L__tree->root;
+ unsigned d = 0;
+ int cmp, target_cmp;
+
+ /* Save the tree that we're going to iterate through in a
+ ** member variable. */
+ iter->tree_ = L__tree;
+
+ iter->depth = ~0;
+
+ if (h == AVL_NULL)
+ /* Tree is empty. */
+ return;
+
+ if (st & AVL_LESS)
+ /* Key can be greater than key of starting node. */
+ target_cmp = 1;
+ else if (st & AVL_GREATER)
+ /* Key can be less than key of starting node. */
+ target_cmp = -1;
+ else
+ /* Key must be same as key of starting node. */
+ target_cmp = 0;
+
+ for ( ; ; )
+ {
+ cmp = AVL_COMPARE_KEY_NODE(k, h);
+ if (cmp == 0)
+ {
+ if (st & AVL_EQUAL)
+ {
+ /* Equal node was sought and found as starting node. */
+ iter->depth = d;
+ break;
+ }
+ cmp = -target_cmp;
+ }
+ else if (target_cmp != 0)
+ if (!((cmp ^ target_cmp) & L__MASK_HIGH_BIT))
+ /* cmp and target_cmp are both negative or both positive. */
+ iter->depth = d;
+ h = cmp < 0 ? AVL_GET_LESS(h, 1) : AVL_GET_GREATER(h, 1);
+ L__CHECK_READ_ERROR_INV_DEPTH
+ if (h == AVL_NULL)
+ break;
+ if (cmp > 0)
+ L__BIT_ARR_1(iter->branch, d)
+ else
+ L__BIT_ARR_0(iter->branch, d)
+ iter->path_h[d++] = h;
+ }
+ }
+
+#endif
+
+#if (L__IMPL_MASK & AVL_IMPL_START_ITER_LEAST)
+
+L__SC void L__(start_iter_least)(L__(avl) *L__tree, L__(iter) *iter)
+ {
+ AVL_HANDLE h = L__tree->root;
+
+ iter->tree_ = L__tree;
+
+ iter->depth = ~0;
+
+ L__BIT_ARR_ALL(iter->branch, 0)
+
+ while (h != AVL_NULL)
+ {
+ if (iter->depth != ~0)
+ iter->path_h[iter->depth] = h;
+ iter->depth++;
+ h = AVL_GET_LESS(h, 1);
+ L__CHECK_READ_ERROR_INV_DEPTH
+ }
+ }
+
+#endif
+
+#if (L__IMPL_MASK & AVL_IMPL_START_ITER_GREATEST)
+
+L__SC void L__(start_iter_greatest)(L__(avl) *L__tree, L__(iter) *iter)
+ {
+ AVL_HANDLE h = L__tree->root;
+
+ iter->tree_ = L__tree;
+
+ iter->depth = ~0;
+
+ L__BIT_ARR_ALL(iter->branch, 1)
+
+ while (h != AVL_NULL)
+ {
+ if (iter->depth != ~0)
+ iter->path_h[iter->depth] = h;
+ iter->depth++;
+ h = AVL_GET_GREATER(h, 1);
+ L__CHECK_READ_ERROR_INV_DEPTH
+ }
+ }
+
+#endif
+
+#if (L__IMPL_MASK & AVL_IMPL_GET_ITER)
+
+L__SC AVL_HANDLE L__(get_iter)(L__(iter) *iter)
+ {
+ if (iter->depth == ~0)
+ return(AVL_NULL);
+
+ return(iter->depth == 0 ?
+ iter->tree_->root : iter->path_h[iter->depth - 1]);
+ }
+
+#endif
+
+#if (L__IMPL_MASK & AVL_IMPL_INCR_ITER)
+
+L__SC void L__(incr_iter)(L__(iter) *iter)
+ {
+ #define L__tree (iter->tree_)
+
+ if (iter->depth != ~0)
+ {
+ AVL_HANDLE h =
+ AVL_GET_GREATER((iter->depth == 0 ?
+ iter->tree_->root : iter->path_h[iter->depth - 1]), 1);
+ L__CHECK_READ_ERROR_INV_DEPTH
+
+ if (h == AVL_NULL)
+ do
+ {
+ if (iter->depth == 0)
+ {
+ iter->depth = ~0;
+ break;
+ }
+ iter->depth--;
+ }
+ while (L__BIT_ARR_VAL(iter->branch, iter->depth));
+ else
+ {
+ L__BIT_ARR_1(iter->branch, iter->depth)
+ iter->path_h[iter->depth++] = h;
+ for ( ; ; )
+ {
+ h = AVL_GET_LESS(h, 1);
+ L__CHECK_READ_ERROR_INV_DEPTH
+ if (h == AVL_NULL)
+ break;
+ L__BIT_ARR_0(iter->branch, iter->depth)
+ iter->path_h[iter->depth++] = h;
+ }
+ }
+ }
+
+ #undef L__tree
+ }
+
+#endif
+
+#if (L__IMPL_MASK & AVL_IMPL_DECR_ITER)
+
+L__SC void L__(decr_iter)(L__(iter) *iter)
+ {
+ #define L__tree (iter->tree_)
+
+ if (iter->depth != ~0)
+ {
+ AVL_HANDLE h =
+ AVL_GET_LESS((iter->depth == 0 ?
+ iter->tree_->root : iter->path_h[iter->depth - 1]), 1);
+ L__CHECK_READ_ERROR_INV_DEPTH
+
+ if (h == AVL_NULL)
+ do
+ {
+ if (iter->depth == 0)
+ {
+ iter->depth = ~0;
+ break;
+ }
+ iter->depth--;
+ }
+ while (!L__BIT_ARR_VAL(iter->branch, iter->depth));
+ else
+ {
+ L__BIT_ARR_0(iter->branch, iter->depth)
+ iter->path_h[iter->depth++] = h;
+ for ( ; ; )
+ {
+ h = AVL_GET_GREATER(h, 1);
+ L__CHECK_READ_ERROR_INV_DEPTH
+ if (h == AVL_NULL)
+ break;
+ L__BIT_ARR_1(iter->branch, iter->depth)
+ iter->path_h[iter->depth++] = h;
+ }
+ }
+ }
+
+ #undef L__tree
+ }
+
+#endif
+
+/* Tidy up the preprocessor symbol name space. */
+#undef L__
+#undef L__EST_LONG_BIT
+#undef L__SIZE
+#undef L__MASK_HIGH_BIT
+#undef L__LONG_BIT
+#undef L__BIT_ARR_DEFN
+#undef L__BIT_ARR_VAL
+#undef L__BIT_ARR_0
+#undef L__BIT_ARR_1
+#undef L__BIT_ARR_ALL
+#undef L__CHECK_READ_ERROR
+#undef L__CHECK_READ_ERROR_INV_DEPTH
+#undef L__BIT_ARR_LONGS
+#undef L__IMPL_MASK
+#undef L__CHECK_READ_ERROR
+#undef L__CHECK_READ_ERROR_INV_DEPTH
+#undef L__SC
+#undef L__BALANCE_PARAM_CALL_PREFIX
+#undef L__BALANCE_PARAM_DECL_PREFIX
diff --git a/Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/include/heapmm.h b/Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/include/heapmm.h
new file mode 100644
index 00000000..797e4d07
--- /dev/null
+++ b/Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/include/heapmm.h
@@ -0,0 +1,142 @@
+/* This code is in the public domain.
+** Version: 1.1 Author: Walt Karas
+*/
+
+/* External header file for Heap Memory Manager. See documentation in
+** heapmm.html.
+*/
+
+#undef HMM_PROCESS
+
+/* Include once per configuration in a particular translation unit. */
+
+#ifndef HMM_CNFG_NUM
+
+/* Default configuration. */
+
+#ifndef HMM_INC_CNFG_DFLT
+#define HMM_INC_CNFG_DFLT
+#define HMM_PROCESS
+#endif
+
+#elif HMM_CNFG_NUM == 0
+
+/* Test configuration. */
+
+#ifndef HMM_INC_CNFG_0
+#define HMM_INC_CNFG_0
+#define HMM_PROCESS
+#endif
+
+#elif HMM_CNFG_NUM == 1
+
+#ifndef HMM_INC_CNFG_1
+#define HMM_INC_CNFG_1
+#define HMM_PROCESS
+#endif
+
+#elif HMM_CNFG_NUM == 2
+
+#ifndef HMM_INC_CNFG_2
+#define HMM_INC_CNFG_2
+#define HMM_PROCESS
+#endif
+
+#elif HMM_CNFG_NUM == 3
+
+#ifndef HMM_INC_CNFG_3
+#define HMM_INC_CNFG_3
+#define HMM_PROCESS
+#endif
+
+#elif HMM_CNFG_NUM == 4
+
+#ifndef HMM_INC_CNFG_4
+#define HMM_INC_CNFG_4
+#define HMM_PROCESS
+#endif
+
+#elif HMM_CNFG_NUM == 5
+
+#ifndef HMM_INC_CNFG_5
+#define HMM_INC_CNFG_5
+#define HMM_PROCESS
+#endif
+
+#endif
+
+#ifdef HMM_PROCESS
+
+#include "hmm_cnfg.h"
+
+/* Heap descriptor. */
+typedef struct HMM_UNIQUE(structure)
+ {
+ /* private: */
+
+ /* Pointer to (payload of) root node in AVL tree. This field should
+ ** really be the AVL tree descriptor (type avl_avl). But (in the
+ ** instantiation of the AVL tree generic package used in package) the
+ ** AVL tree descriptor simply contains a pointer to the root. So,
+ ** whenever a pointer to the AVL tree descriptor is needed, I use the
+ ** cast:
+ **
+ ** (avl_avl *) &(heap_desc->avl_tree_root)
+ **
+ ** (where heap_desc is a pointer to a heap descriptor). This trick
+ ** allows me to avoid including cavl_if.h in this external header. */
+ void *avl_tree_root;
+
+ /* Pointer to first byte of last block freed, after any coalescing. */
+ void *last_freed;
+
+ /* public: */
+
+ HMM_UNIQUE(size_bau) num_baus_can_shrink;
+ void *end_of_shrinkable_chunk;
+ }
+HMM_UNIQUE(descriptor);
+
+/* Prototypes for externally-callable functions. */
+
+void HMM_UNIQUE(init)(HMM_UNIQUE(descriptor) *desc);
+
+void * HMM_UNIQUE(alloc)(
+ HMM_UNIQUE(descriptor) *desc, HMM_UNIQUE(size_aau) num_addr_align_units);
+
+/* NOT YET IMPLEMENTED */
+void * HMM_UNIQUE(greedy_alloc)(
+ HMM_UNIQUE(descriptor) *desc, HMM_UNIQUE(size_aau) needed_addr_align_units,
+ HMM_UNIQUE(size_aau) coveted_addr_align_units);
+
+int HMM_UNIQUE(resize)(
+ HMM_UNIQUE(descriptor) *desc, void *mem,
+ HMM_UNIQUE(size_aau) num_addr_align_units);
+
+/* NOT YET IMPLEMENTED */
+int HMM_UNIQUE(greedy_resize)(
+ HMM_UNIQUE(descriptor) *desc, void *mem,
+ HMM_UNIQUE(size_aau) needed_addr_align_units,
+ HMM_UNIQUE(size_aau) coveted_addr_align_units);
+
+void HMM_UNIQUE(free)(HMM_UNIQUE(descriptor) *desc, void *mem);
+
+HMM_UNIQUE(size_aau) HMM_UNIQUE(true_size)(void *mem);
+
+HMM_UNIQUE(size_aau) HMM_UNIQUE(largest_available)(
+ HMM_UNIQUE(descriptor) *desc);
+
+void HMM_UNIQUE(new_chunk)(
+ HMM_UNIQUE(descriptor) *desc, void *start_of_chunk,
+ HMM_UNIQUE(size_bau) num_block_align_units);
+
+void HMM_UNIQUE(grow_chunk)(
+ HMM_UNIQUE(descriptor) *desc, void *end_of_chunk,
+ HMM_UNIQUE(size_bau) num_block_align_units);
+
+/* NOT YET IMPLEMENTED */
+void HMM_UNIQUE(shrink_chunk)(
+ HMM_UNIQUE(descriptor) *desc,
+ HMM_UNIQUE(size_bau) num_block_align_units);
+
+#endif /* defined HMM_PROCESS */
diff --git a/Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/include/hmm_cnfg.h b/Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/include/hmm_cnfg.h
new file mode 100644
index 00000000..3a453ef4
--- /dev/null
+++ b/Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/include/hmm_cnfg.h
@@ -0,0 +1,105 @@
+/* This code is in the public domain.
+** Version: 1.1 Author: Walt Karas
+*/
+
+/* Configure Heap Memory Manager for processor architecture, compiler,
+** and desired performance characteristics. This file is included
+** by heapmm.h, so these definitions can be used by code external to
+** HMM. You can change the default configuration, and/or create alternate
+** configuration(s).
+*/
+
+/* To allow for multiple configurations of HMM to be used in the same
+** compilation unit, undefine all preprocessor symbols that will be
+** defined below.
+*/
+#undef HMM_ADDR_ALIGN_UNIT
+#undef HMM_BLOCK_ALIGN_UNIT
+#undef HMM_UNIQUE
+#undef HMM_DESC_PARAM
+#undef HMM__SYM_TO_STRING
+#undef HMM_SYM_TO_STRING
+#undef HMM_AUDIT_FAIL
+
+/* Turn X into a string after one macro expansion pass of X. This trick
+** works with both GCC and Visual C++. */
+#define HMM_SYM_TO_STRING(X) HMM__SYM_TO_STRING(X)
+#define HMM__SYM_TO_STRING(X) #X
+
+#ifndef HMM_CNFG_NUM
+
+/* Default configuration. */
+
+/* Use hmm_ prefix to avoid identifier conflicts. */
+#define HMM_UNIQUE(BASE) hmm_ ## BASE
+
+/* Number of bytes in an Address Alignment Unit (AAU). */
+//fwghack
+//#define HMM_ADDR_ALIGN_UNIT sizeof(int)
+#define HMM_ADDR_ALIGN_UNIT 32
+
+/* Number of AAUs in a Block Alignment Unit (BAU). */
+#define HMM_BLOCK_ALIGN_UNIT 1
+
+/* Type of unsigned integer big enough to hold the size of a Block in AAUs. */
+typedef unsigned long HMM_UNIQUE(size_aau);
+
+/* Type of unsigned integer big enough to hold the size of a Block/Chunk
+** in BAUs. The high bit will be robbed. */
+typedef unsigned long HMM_UNIQUE(size_bau);
+
+void HMM_dflt_abort(const char *, const char *);
+
+/* Actions upon a self-audit failure. Must expand to a single complete
+** statement. If you remove the definition of this macro, no self-auditing
+** will be performed. */
+#define HMM_AUDIT_FAIL \
+ HMM_dflt_abort(__FILE__, HMM_SYM_TO_STRING(__LINE__));
+
+#elif HMM_CNFG_NUM == 0
+
+/* Definitions for testing. */
+
+#define HMM_UNIQUE(BASE) thmm_ ## BASE
+
+#define HMM_ADDR_ALIGN_UNIT sizeof(int)
+
+#define HMM_BLOCK_ALIGN_UNIT 3
+
+typedef unsigned HMM_UNIQUE(size_aau);
+
+typedef unsigned short HMM_UNIQUE(size_bau);
+
+/* Under this test setup, a long jump is done if there is a self-audit
+** failure.
+*/
+
+extern jmp_buf HMM_UNIQUE(jmp_buf);
+extern const char * HMM_UNIQUE(fail_file);
+extern unsigned HMM_UNIQUE(fail_line);
+
+#define HMM_AUDIT_FAIL \
+ { HMM_UNIQUE(fail_file) = __FILE__; HMM_UNIQUE(fail_line) = __LINE__; \
+ longjmp(HMM_UNIQUE(jmp_buf), 1); }
+
+#elif HMM_CNFG_NUM == 1
+
+/* Put configuration 1 definitions here (if there is a configuration 1). */
+
+#elif HMM_CNFG_NUM == 2
+
+/* Put configuration 2 definitions here. */
+
+#elif HMM_CNFG_NUM == 3
+
+/* Put configuration 3 definitions here. */
+
+#elif HMM_CNFG_NUM == 4
+
+/* Put configuration 4 definitions here. */
+
+#elif HMM_CNFG_NUM == 5
+
+/* Put configuration 5 definitions here. */
+
+#endif
diff --git a/Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/include/hmm_intrnl.h b/Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/include/hmm_intrnl.h
new file mode 100644
index 00000000..d0d0e7d8
--- /dev/null
+++ b/Src/libvp6/corelibs/on2_common/src/on2_mem/memory_manager/include/hmm_intrnl.h
@@ -0,0 +1,149 @@
+/* This code is in the public domain.
+** Version: 1.1 Author: Walt Karas
+*/
+
+#ifndef HMM_INTRNL_H_
+#define HMM_INTRNL_H_
+
+#include "heapmm.h"
+
+#define U(BASE) HMM_UNIQUE(BASE)
+
+/* Mask of high bit of variable of size_bau type. */
+#define HIGH_BIT_BAU_SIZE \
+ ((U(size_bau)) ~ (((U(size_bau)) ~ (U(size_bau)) 0) >> 1))
+
+/* Add a given number of AAUs to pointer. */
+#define AAUS_FORWARD(PTR, AAU_OFFSET) \
+ (((char *) (PTR)) + ((AAU_OFFSET) * ((U(size_aau)) HMM_ADDR_ALIGN_UNIT)))
+
+/* Subtract a given number of AAUs from pointer. */
+#define AAUS_BACKWARD(PTR, AAU_OFFSET) \
+ (((char *) (PTR)) - ((AAU_OFFSET) * ((U(size_aau)) HMM_ADDR_ALIGN_UNIT)))
+
+/* Add a given number of BAUs to a pointer. */
+#define BAUS_FORWARD(PTR, BAU_OFFSET) \
+ AAUS_FORWARD((PTR), (BAU_OFFSET) * ((U(size_aau)) HMM_BLOCK_ALIGN_UNIT))
+
+/* Subtract a given number of BAUs to a pointer. */
+#define BAUS_BACKWARD(PTR, BAU_OFFSET) \
+ AAUS_BACKWARD((PTR), (BAU_OFFSET) * ((U(size_aau)) HMM_BLOCK_ALIGN_UNIT))
+
+typedef struct head_struct
+ {
+ /* Sizes in Block Alignment Units. */
+ HMM_UNIQUE(size_bau) previous_block_size, block_size;
+ }
+head_record;
+
+typedef struct ptr_struct
+ {
+ struct ptr_struct *self, *prev, *next;
+ }
+ptr_record;
+
+/* Divide and round up any fraction to the next whole number. */
+#define DIV_ROUND_UP(NUMER, DENOM) (((NUMER) + (DENOM) - 1) / (DENOM))
+
+/* Number of AAUs in a block head. */
+#define HEAD_AAUS DIV_ROUND_UP(sizeof(head_record), HMM_ADDR_ALIGN_UNIT)
+
+/* Number of AAUs in a block pointer record. */
+#define PTR_RECORD_AAUS DIV_ROUND_UP(sizeof(ptr_record), HMM_ADDR_ALIGN_UNIT)
+
+/* Number of BAUs in a dummy end record (at end of chunk). */
+#define DUMMY_END_BLOCK_BAUS DIV_ROUND_UP(HEAD_AAUS, HMM_BLOCK_ALIGN_UNIT)
+
+/* Minimum number of BAUs in a block (allowing room for the pointer record. */
+#define MIN_BLOCK_BAUS \
+ DIV_ROUND_UP(HEAD_AAUS + PTR_RECORD_AAUS, HMM_BLOCK_ALIGN_UNIT)
+
+/* Return number of BAUs in block (masking off high bit containing block
+** status). */
+#define BLOCK_BAUS(HEAD_PTR) \
+ (((head_record *) (HEAD_PTR))->block_size & ~HIGH_BIT_BAU_SIZE)
+
+/* Return number of BAUs in previous block (masking off high bit containing
+** block status). */
+#define PREV_BLOCK_BAUS(HEAD_PTR) \
+ (((head_record *) (HEAD_PTR))->previous_block_size & ~HIGH_BIT_BAU_SIZE)
+
+/* Set number of BAUs in previous block, preserving high bit containing
+** block status. */
+#define SET_PREV_BLOCK_BAUS(HEAD_PTR, N_BAUS) \
+ { register head_record *h_ptr = (head_record *) (HEAD_PTR); \
+ h_ptr->previous_block_size &= HIGH_BIT_BAU_SIZE; \
+ h_ptr->previous_block_size |= (N_BAUS); }
+
+/* Convert pointer to pointer record of block to pointer to block's head
+** record. */
+#define PTR_REC_TO_HEAD(PTR_REC_PTR) \
+ ((head_record *) AAUS_BACKWARD(PTR_REC_PTR, HEAD_AAUS))
+
+/* Convert pointer to block head to pointer to block's pointer record. */
+#define HEAD_TO_PTR_REC(HEAD_PTR) \
+ ((ptr_record *) AAUS_FORWARD(HEAD_PTR, HEAD_AAUS))
+
+/* Returns non-zero if block is allocated. */
+#define IS_BLOCK_ALLOCATED(HEAD_PTR) \
+ (((((head_record *) (HEAD_PTR))->block_size | \
+ ((head_record *) (HEAD_PTR))->previous_block_size) & \
+ HIGH_BIT_BAU_SIZE) == 0)
+
+#define MARK_BLOCK_ALLOCATED(HEAD_PTR) \
+ { register head_record *h_ptr = (head_record *) (HEAD_PTR); \
+ h_ptr->block_size &= ~HIGH_BIT_BAU_SIZE; \
+ h_ptr->previous_block_size &= ~HIGH_BIT_BAU_SIZE; }
+
+/* Mark a block as free when it is not the first block in a bin (and
+** therefore not a node in the AVL tree). */
+#define MARK_SUCCESSIVE_BLOCK_IN_FREE_BIN(HEAD_PTR) \
+ { register head_record *h_ptr = (head_record *) (HEAD_PTR); \
+ h_ptr->block_size |= HIGH_BIT_BAU_SIZE; }
+
+/* Prototypes for internal functions implemented in one file and called in
+** another.
+*/
+
+void U(into_free_collection)(U(descriptor) *desc, head_record *head_ptr);
+
+void U(out_of_free_collection)(U(descriptor) *desc, head_record *head_ptr);
+
+void * U(alloc_from_bin)(
+ U(descriptor) *desc, ptr_record *bin_front_ptr, U(size_bau) n_baus);
+
+#ifdef HMM_AUDIT_FAIL
+
+/* Simply contains a reference to the HMM_AUDIT_FAIL macro and a
+** dummy return. */
+int U(audit_block_fail_dummy_return)(void);
+
+/* More sickness needed because C has no inline function (yes, it's the
+** "use the comma operator like a semicolon" thing.)
+*/
+
+/* Auditing a block consists of checking that the size in its head
+** matches the previous block size in the head of the next block. */
+#define AUDIT_BLOCK_AS_EXPR(HEAD_PTR) \
+ ((BLOCK_BAUS(HEAD_PTR) == \
+ PREV_BLOCK_BAUS(BAUS_FORWARD(HEAD_PTR, BLOCK_BAUS(HEAD_PTR)))) ? \
+ 0 : U(audit_block_fail_dummy_return)())
+
+#define AUDIT_BLOCK(HEAD_PTR) \
+ { void *h_ptr = (HEAD_PTR); AUDIT_BLOCK_AS_EXPR(h_ptr); }
+
+#endif
+
+/* Interface to AVL tree generic package instantiation. */
+
+#define AVL_UNIQUE(BASE) U(avl_ ## BASE)
+
+#define AVL_HANDLE ptr_record *
+
+#define AVL_KEY U(size_bau)
+
+#define AVL_MAX_DEPTH 64
+
+#include "cavl_if.h"
+
+#endif /* Include once. */
diff --git a/Src/libvp6/corelibs/on2_common/src/on2_mem/on2_mem.c b/Src/libvp6/corelibs/on2_common/src/on2_mem/on2_mem.c
new file mode 100644
index 00000000..3bbebac6
--- /dev/null
+++ b/Src/libvp6/corelibs/on2_common/src/on2_mem/on2_mem.c
@@ -0,0 +1,561 @@
+#define __ON2_MEM_C__
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "on2_mem.h"
+
+#define INCLUDE_MEMORY_MANAGER 0 //include heap manager functionality
+#define INCLUDE_MEM_TRACKER 0 //include xon2_* calls in the lib
+#define INCLUDE_MEM_CHECKS 1 //include some basic safety checks in
+ //on2_memcpy, _memset, and _memmove
+#if INCLUDE_MEM_TRACKER
+# include "on2_mem_tracker.h"
+# if ON2_MEM_TRACKER_VERSION_CHIEF != 2
+# error "on2_mem requires memory tracker version 2 to track memory usage"
+# endif
+#endif
+
+#define ADDRESS_STORAGE_SIZE sizeof(size_t)
+
+#if defined(VXWORKS)
+# define DEFAULT_ALIGNMENT 32 //default addr alignment to use in
+ //calls to on2_* functions other
+ //than on2_memalign
+#else
+# define DEFAULT_ALIGNMENT 1
+#endif
+
+#if INCLUDE_MEM_TRACKER
+# define TRY_BOUNDS_CHECK 1 //when set to 1 pads each allocation,
+ //integrity can be checked using
+ //on2_MemoryTrackerCheckIntegrity
+ //or on free by defining
+ //TRY_BOUNDS_CHECK_ON_FREE
+#else
+# define TRY_BOUNDS_CHECK 0
+#endif
+
+#if TRY_BOUNDS_CHECK
+# define TRY_BOUNDS_CHECK_ON_FREE 0 //checks mem integrity on every
+ //free, very expensive
+# define BOUNDS_CHECK_VALUE 0xdeadbeef //value stored before/after ea.
+ //mem addr for bounds checking
+# define BOUNDS_CHECK_PAD_SIZE 32 //size of the padding before and
+ //after ea allocation to be filled
+ //with BOUNDS_CHECK_VALUE.
+ //this should be a multiple of 4
+#else
+# define BOUNDS_CHECK_VALUE 0
+# define BOUNDS_CHECK_PAD_SIZE 0
+#endif
+
+unsigned long g_AllocCount = 0;
+
+#if INCLUDE_MEMORY_MANAGER
+# include "heapmm.h"
+# include "hmm_intrnl.h"
+
+# define SHIFT_HMM_ADDR_ALIGN_UNIT 5
+# define TOTAL_MEMORY_TO_ALLOCATE 20971520 // 20 * 1024 * 1024
+//# define TOTAL_MEMORY_TO_ALLOCATE 10485100 // 10 * 1024 * 1024
+//# define TOTAL_MEMORY_TO_ALLOCATE 16777216 // 16 * 1024 * 1024
+
+# define MM_DYNAMIC_MEMORY 1
+# if MM_DYNAMIC_MEMORY
+ unsigned char* g_p_mng_memory_raw = NULL;
+ unsigned char* g_p_mng_memory = NULL;
+# else
+ unsigned char g_p_mng_memory[TOTAL_MEMORY_TO_ALLOCATE];
+# endif
+
+ size_t g_mm_memory_size = TOTAL_MEMORY_TO_ALLOCATE;
+
+ hmm_descriptor hmm_d;
+ int g_mngMemoryAllocated = 0;
+
+ static int On2_MM_CreateHeapMemory();
+ static void* On2_MM_realloc(void* memblk, size_t size);
+#endif //INCLUDE_MEMORY_MANAGER
+
+unsigned int on2_mem_get_version()
+{
+ unsigned int ver = ((unsigned int)(unsigned char)ON2_MEM_VERSION_CHIEF << 24 |
+ (unsigned int)(unsigned char)ON2_MEM_VERSION_MAJOR << 16 |
+ (unsigned int)(unsigned char)ON2_MEM_VERSION_MINOR << 8 |
+ (unsigned int)(unsigned char)ON2_MEM_VERSION_PATCH);
+ return ver;
+}
+
+int on2_mem_set_heap_size(size_t size)
+{
+ int ret = -1;
+
+ #if INCLUDE_MEMORY_MANAGER
+ #if MM_DYNAMIC_MEMORY
+ if(!g_mngMemoryAllocated && size) {
+ g_mm_memory_size = size;
+ ret = 0;
+ } else
+ ret = -3;
+ #else
+ ret = -2;
+ #endif
+ #else
+ (void)size;
+ #endif
+
+ return ret;
+}
+
+void* on2_memalign(size_t align, size_t size)
+{
+ void* addr,
+ * x = NULL;
+
+ #if INCLUDE_MEMORY_MANAGER
+ int number_aau;
+
+ if (On2_MM_CreateHeapMemory() < 0)
+ {
+ printf("[on2][mm] ERROR xon2_memalign() Couldn't create memory for Heap.\n");
+ }
+
+ number_aau = ((size + align + ADDRESS_STORAGE_SIZE) >>
+ SHIFT_HMM_ADDR_ALIGN_UNIT) + 1;
+
+ addr = hmm_alloc(&hmm_d, number_aau);
+ #else
+ addr = malloc(size + align + ADDRESS_STORAGE_SIZE);
+ #endif //INCLUDE_MEMORY_MANAGER
+
+ if(addr) {
+ ptrdiff_t align_ = align;
+
+ x = (void*)(((size_t)
+ ((unsigned char*)addr + ADDRESS_STORAGE_SIZE) + (align_ - 1)) & (size_t)-align_);
+ /* save the actual malloc address */
+ ((size_t*)x)[-1] = (size_t)addr;
+ }
+
+ return x;
+}
+
+void* on2_malloc(size_t size)
+{
+ return on2_memalign(DEFAULT_ALIGNMENT, size);
+}
+
+void* on2_calloc(size_t num, size_t size)
+{
+ void *x;
+
+ x = on2_memalign(DEFAULT_ALIGNMENT, num*size);
+
+ if(x)
+ memset(x, 0, num*size);
+
+ return x;
+}
+
+void* on2_realloc(void* memblk, size_t size)
+{
+ void* addr,
+ * new_addr = NULL;
+ int align = DEFAULT_ALIGNMENT;
+ /*
+ The realloc() function changes the size of the object pointed to by
+ ptr to the size specified by size, and returns a pointer to the
+ possibly moved block. The contents are unchanged up to the lesser
+ of the new and old sizes. If ptr is null, realloc() behaves like
+ malloc() for the specified size. If size is zero (0) and ptr is
+ not a null pointer, the object pointed to is freed.
+ */
+ if(!memblk)
+ new_addr = on2_malloc(size);
+ else if (!size)
+ on2_free(memblk);
+ else
+ {
+ addr = (void*)(((size_t*)memblk)[-1]);
+ memblk = NULL;
+
+ #if INCLUDE_MEMORY_MANAGER
+ new_addr = On2_MM_realloc(addr, size + align + ADDRESS_STORAGE_SIZE);
+ #else
+ new_addr = realloc(addr, size + align + ADDRESS_STORAGE_SIZE);
+ #endif
+ if(new_addr) {
+ addr = new_addr;
+ new_addr = (void*)(((size_t)
+ ((unsigned char*)new_addr + ADDRESS_STORAGE_SIZE) + (align - 1)) &
+ (size_t)-align);
+ /* save the actual malloc address */
+ ((size_t*)new_addr)[-1] = (size_t)addr;
+ }
+ }
+
+ return new_addr;
+}
+
+void on2_free(void* memblk)
+{
+ if(memblk) {
+ void* addr = (void*)(((size_t*)memblk)[-1]);
+ #if INCLUDE_MEMORY_MANAGER
+ hmm_free(&hmm_d, addr);
+ #else
+ free(addr);
+ #endif
+ }
+}
+
+#if INCLUDE_MEM_TRACKER
+
+void* xon2_memalign(size_t align, size_t size, char* file, int line)
+{
+ #if TRY_BOUNDS_CHECK
+ unsigned char *xBounds;
+ #endif
+
+ void *x;
+
+ if (g_AllocCount == 0)
+ {
+ int iRv = on2_MemoryTrackerInit(BOUNDS_CHECK_PAD_SIZE, BOUNDS_CHECK_VALUE);
+ if (iRv < 0)
+ {
+ printf("ERROR xon2_malloc MEM_TRACK_USAGE error on2_MemoryTrackerInit().\n");
+ }
+ }
+
+ #if TRY_BOUNDS_CHECK
+ {
+ int i;
+ unsigned int tempme = BOUNDS_CHECK_VALUE;
+
+ xBounds = on2_memalign(align, size + (BOUNDS_CHECK_PAD_SIZE * 2));
+
+ for (i=0;i<BOUNDS_CHECK_PAD_SIZE;i+=sizeof(unsigned int))
+ {
+ memcpy(xBounds+i, &tempme, sizeof(unsigned int));
+ memcpy(xBounds + size + BOUNDS_CHECK_PAD_SIZE + i, &tempme, sizeof(unsigned int));
+ }
+ x = (void*)(xBounds + BOUNDS_CHECK_PAD_SIZE);
+ }
+ #else
+ x = on2_memalign(align, size);
+ #endif //TRY_BOUNDS_CHECK
+
+ g_AllocCount++;
+
+ on2_MemoryTrackerAdd((size_t)x, size, file, line);
+
+ return x;
+}
+
+void* xon2_malloc(size_t size, char *file, int line)
+{
+ return xon2_memalign(DEFAULT_ALIGNMENT, size, file, line);
+}
+
+void* xon2_calloc(size_t num, size_t size, char *file, int line)
+{
+ void* x = xon2_memalign(DEFAULT_ALIGNMENT, num*size, file, line);
+
+ if(x)
+ memset(x, 0, num*size);
+
+ return x;
+}
+
+void* xon2_realloc(void* memblk, size_t size, char *file, int line)
+{
+ struct MemBlock* p = NULL;
+ int orig_size = 0,
+ orig_line = 0;
+ char* orig_file = NULL;
+
+ #if TRY_BOUNDS_CHECK
+ unsigned char *xBounds = memblk ?
+ (unsigned char*)memblk - BOUNDS_CHECK_PAD_SIZE :
+ NULL;
+ #endif
+
+ void *x;
+
+ if (g_AllocCount == 0)
+ {
+ if (!on2_MemoryTrackerInit(BOUNDS_CHECK_PAD_SIZE, BOUNDS_CHECK_VALUE))
+ {
+ printf("ERROR xon2_malloc MEM_TRACK_USAGE error on2_MemoryTrackerInit().\n");
+ }
+ }
+
+ if (p = on2_MemoryTrackerFind((size_t)memblk))
+ {
+ orig_size = p->size;
+ orig_file = p->file;
+ orig_line = p->line;
+ }
+
+ #if TRY_BOUNDS_CHECK_ON_FREE
+ on2_MemoryTrackerCheckIntegrity(file, line);
+ #endif
+
+ //have to do this regardless of success, because
+ //the memory that does get realloc'd may change
+ //the bounds values of this block
+ on2_MemoryTrackerRemove((size_t)memblk);
+
+ #if TRY_BOUNDS_CHECK
+ {
+ xBounds = on2_realloc(xBounds, size + (BOUNDS_CHECK_PAD_SIZE * 2));
+
+ if (xBounds)
+ {
+ int i;
+ unsigned int tempme = BOUNDS_CHECK_VALUE;
+
+ for (i=0;i<BOUNDS_CHECK_PAD_SIZE;i+=sizeof(unsigned int))
+ {
+ memcpy(xBounds+i, &tempme, 4);
+ memcpy(xBounds + size + BOUNDS_CHECK_PAD_SIZE + i, &tempme, 4);
+ }
+
+ x = (void*)(xBounds + BOUNDS_CHECK_PAD_SIZE);
+ }
+ else
+ x = NULL;
+ }
+ #else
+ x = on2_realloc(memblk, size);
+ #endif //TRY_BOUNDS_CHECK
+
+ if (x)
+ on2_MemoryTrackerAdd((size_t)x, size, file, line);
+ else
+ on2_MemoryTrackerAdd((size_t)memblk, orig_size, orig_file, orig_line);
+
+ return x;
+}
+
+void xon2_free(void *pAddress, char *file, int line)
+{
+ #if TRY_BOUNDS_CHECK
+ unsigned char *pBoundsAddress = (unsigned char*)pAddress;
+ pBoundsAddress -= BOUNDS_CHECK_PAD_SIZE;
+ #endif
+
+ #if !TRY_BOUNDS_CHECK_ON_FREE
+ (void)file; (void)line;
+ #endif
+
+ if(pAddress)
+ {
+ g_AllocCount--;
+
+ #if TRY_BOUNDS_CHECK_ON_FREE
+ on2_MemoryTrackerCheckIntegrity(file, line);
+ #endif
+
+ //if the addr isn't found in the list, assume it was allocated via
+ //on2_ calls not xon2_, therefore it does not contain any padding
+ if (on2_MemoryTrackerRemove((size_t)pAddress) == -2)
+ pBoundsAddress = pAddress;
+
+ #if TRY_BOUNDS_CHECK
+ on2_free(pBoundsAddress);
+ #else
+ on2_free(pAddress);
+ #endif
+ }
+}
+
+#endif /*INCLUDE_MEM_TRACKER*/
+
+#if INCLUDE_MEM_CHECKS
+#if defined(VXWORKS)
+/* This function is only used to get a stack trace of the player
+object so we can se where we are having a problem. */
+int getMyTT(int task)
+{
+ tt(task);
+
+ return 0;
+}
+#endif
+#endif
+
+void * on2_memcpy(void *dest, const void *source, size_t length)
+{
+ #if INCLUDE_MEM_CHECKS
+ if (((intptr_t)dest < 0x4000) || ((intptr_t)source < 0x4000))
+ {
+ printf("WARNING: on2_memcpy dest:0x%p source:0x%p len:%d\n", dest, source, length);
+
+ #if defined(VXWORKS)
+ sp(getMyTT, taskIdSelf(), 0, 0, 0, 0, 0, 0, 0, 0);
+
+ on2Timer_Sleep(10000);
+ #endif
+ }
+ #endif
+
+ return memcpy(dest, source, length);
+}
+
+
+void * on2_memset(void *dest, int val, size_t length)
+{
+ #if INCLUDE_MEM_CHECKS
+ if ((intptr_t)dest < 0x4000)
+ {
+ printf("WARNING: on2_memset dest:0x%p val:%d len:%d\n", dest, val, length);
+
+ #if defined(VXWORKS)
+ sp(getMyTT, taskIdSelf(), 0, 0, 0, 0, 0, 0, 0, 0);
+
+ on2Timer_Sleep(10000);
+ #endif
+ }
+ #endif
+
+ return memset(dest, val, length);
+}
+
+
+void * on2_memmove(void *dest, const void *src, size_t count)
+{
+ #if INCLUDE_MEM_CHECKS
+ if (((intptr_t)dest < 0x4000) || ((intptr_t)src < 0x4000))
+ {
+ printf("WARNING: on2_memmove dest:0x%p src:0x%p count:%d\n", dest, src, count);
+
+ #if defined(VXWORKS)
+ sp(getMyTT, taskIdSelf(), 0, 0, 0, 0, 0, 0, 0, 0);
+
+ on2Timer_Sleep(10000);
+ #endif
+ }
+ #endif
+
+ return memmove(dest, src, count);
+}
+
+#if INCLUDE_MEMORY_MANAGER
+
+static int On2_MM_CreateHeapMemory()
+{
+ int iRv = 0;
+
+ if (!g_mngMemoryAllocated)
+ {
+ #if MM_DYNAMIC_MEMORY
+ g_p_mng_memory_raw =
+ (unsigned char*)malloc(g_mm_memory_size + HMM_ADDR_ALIGN_UNIT);
+
+ if (g_p_mng_memory_raw)
+ {
+ g_p_mng_memory = (unsigned char*)((((unsigned int)g_p_mng_memory_raw) +
+ HMM_ADDR_ALIGN_UNIT-1) &
+ -(int)HMM_ADDR_ALIGN_UNIT);
+
+ printf("[on2][mm] total memory size:%d g_p_mng_memory_raw:0x%x g_p_mng_memory:0x%x\n"
+ , g_mm_memory_size + HMM_ADDR_ALIGN_UNIT
+ , (unsigned int)g_p_mng_memory_raw
+ , (unsigned int)g_p_mng_memory);
+ }
+ else
+ {
+ printf("[on2][mm] Couldn't allocate memory:%d for on2 memory manager.\n"
+ , g_mm_memory_size);
+
+ iRv = -1;
+ }
+
+ if (g_p_mng_memory)
+ #endif
+ {
+ int chunkSize = 0;
+
+ g_mngMemoryAllocated = 1;
+
+ hmm_init(&hmm_d);
+
+ chunkSize = g_mm_memory_size >> SHIFT_HMM_ADDR_ALIGN_UNIT;
+
+ chunkSize -= DUMMY_END_BLOCK_BAUS;
+
+ printf("[on2][mm] memory size:%d for on2 memory manager. g_p_mng_memory:0x%x chunkSize:%d\n"
+ , g_mm_memory_size
+ , (unsigned int)g_p_mng_memory
+ , chunkSize);
+
+ hmm_new_chunk(&hmm_d, (void*)g_p_mng_memory, chunkSize);
+ }
+ #if MM_DYNAMIC_MEMORY
+ else
+ {
+ printf("[on2][mm] Couldn't allocate memory:%d for on2 memory manager.\n"
+ , g_mm_memory_size);
+
+ iRv = -1;
+ }
+ #endif
+ }
+
+ return iRv;
+}
+
+static void* On2_MM_realloc(void* memblk, size_t size)
+{
+ void* pRet = NULL;
+
+ if (On2_MM_CreateHeapMemory() < 0)
+ {
+ printf("[on2][mm] ERROR On2_MM_realloc() Couldn't create memory for Heap.\n");
+ }
+ else
+ {
+ int iRv = 0;
+ int old_num_aaus;
+ int new_num_aaus;
+
+ old_num_aaus = hmm_true_size(memblk);
+ new_num_aaus = (size >> SHIFT_HMM_ADDR_ALIGN_UNIT) + 1;
+
+ if (old_num_aaus == new_num_aaus)
+ {
+ pRet = memblk;
+ }
+ else
+ {
+ iRv = hmm_resize(&hmm_d, memblk, new_num_aaus);
+ if (iRv == 0)
+ {
+ pRet = memblk;
+ }
+ else
+ {
+ /* Error. Try to malloc and then copy data. */
+ void* pFromMalloc;
+
+ new_num_aaus = (size >> SHIFT_HMM_ADDR_ALIGN_UNIT) + 1;
+ pFromMalloc = hmm_alloc(&hmm_d, new_num_aaus);
+
+ if (pFromMalloc)
+ {
+ on2_memcpy(pFromMalloc, memblk, size);
+ hmm_free(&hmm_d, memblk);
+
+ pRet = pFromMalloc;
+ }
+ }
+ }
+ }
+
+ return pRet;
+}
+
+#endif //INCLUDE_MEMORY_MANAGER
diff --git a/Src/libvp6/corelibs/on2_common/src/on2_mem/on2_mem.xcodeproj/project.pbxproj b/Src/libvp6/corelibs/on2_common/src/on2_mem/on2_mem.xcodeproj/project.pbxproj
new file mode 100644
index 00000000..8b6d6d89
--- /dev/null
+++ b/Src/libvp6/corelibs/on2_common/src/on2_mem/on2_mem.xcodeproj/project.pbxproj
@@ -0,0 +1,197 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 42;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 0CC4DD1E0BB7930400837D4E /* on2_mem.c in Sources */ = {isa = PBXBuildFile; fileRef = 0CC4DD1D0BB7930400837D4E /* on2_mem.c */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ 0CC4DD1D0BB7930400837D4E /* on2_mem.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = on2_mem.c; sourceTree = "<group>"; };
+ D2AAC046055464E500DB518D /* libon2_mem.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libon2_mem.a; sourceTree = BUILT_PRODUCTS_DIR; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ D289987405E68DCB004EDB86 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 08FB7794FE84155DC02AAC07 /* on2_mem */ = {
+ isa = PBXGroup;
+ children = (
+ 08FB7795FE84155DC02AAC07 /* Source */,
+ C6A0FF2B0290797F04C91782 /* Documentation */,
+ 1AB674ADFE9D54B511CA2CBB /* Products */,
+ );
+ name = on2_mem;
+ sourceTree = "<group>";
+ };
+ 08FB7795FE84155DC02AAC07 /* Source */ = {
+ isa = PBXGroup;
+ children = (
+ 0CC4DD1D0BB7930400837D4E /* on2_mem.c */,
+ );
+ name = Source;
+ sourceTree = "<group>";
+ };
+ 1AB674ADFE9D54B511CA2CBB /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ D2AAC046055464E500DB518D /* libon2_mem.a */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ C6A0FF2B0290797F04C91782 /* Documentation */ = {
+ isa = PBXGroup;
+ children = (
+ );
+ name = Documentation;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXHeadersBuildPhase section */
+ D2AAC043055464E500DB518D /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXHeadersBuildPhase section */
+
+/* Begin PBXNativeTarget section */
+ D2AAC045055464E500DB518D /* on2_mem */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 1DEB91EB08733DB70010E9CD /* Build configuration list for PBXNativeTarget "on2_mem" */;
+ buildPhases = (
+ D2AAC043055464E500DB518D /* Headers */,
+ D2AAC044055464E500DB518D /* Sources */,
+ D289987405E68DCB004EDB86 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = on2_mem;
+ productName = on2_mem;
+ productReference = D2AAC046055464E500DB518D /* libon2_mem.a */;
+ productType = "com.apple.product-type.library.static";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 08FB7793FE84155DC02AAC07 /* Project object */ = {
+ isa = PBXProject;
+ buildConfigurationList = 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "on2_mem" */;
+ hasScannedForEncodings = 1;
+ mainGroup = 08FB7794FE84155DC02AAC07 /* on2_mem */;
+ projectDirPath = "";
+ targets = (
+ D2AAC045055464E500DB518D /* on2_mem */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXSourcesBuildPhase section */
+ D2AAC044055464E500DB518D /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 0CC4DD1E0BB7930400837D4E /* on2_mem.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+ 1DEB91EC08733DB70010E9CD /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = NO;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_ENABLE_FIX_AND_CONTINUE = YES;
+ GCC_MODEL_TUNING = G5;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ INSTALL_PATH = /usr/local/lib;
+ PRODUCT_NAME = on2_mem;
+ ZERO_LINK = YES;
+ };
+ name = Debug;
+ };
+ 1DEB91ED08733DB70010E9CD /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = (
+ ppc,
+ i386,
+ );
+ GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+ GCC_MODEL_TUNING = G5;
+ INSTALL_PATH = /usr/local/lib;
+ PRODUCT_NAME = on2_mem;
+ };
+ name = Release;
+ };
+ 1DEB91F008733DB70010E9CD /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ OBJROOT = build;
+ PREBINDING = NO;
+ SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
+ SYMROOT = ../../../../lib/osx;
+ USER_HEADER_SEARCH_PATHS = include;
+ };
+ name = Debug;
+ };
+ 1DEB91F108733DB70010E9CD /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ OBJROOT = build;
+ PREBINDING = NO;
+ SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
+ SYMROOT = ../../../../lib/osx;
+ USER_HEADER_SEARCH_PATHS = include;
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 1DEB91EB08733DB70010E9CD /* Build configuration list for PBXNativeTarget "on2_mem" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 1DEB91EC08733DB70010E9CD /* Debug */,
+ 1DEB91ED08733DB70010E9CD /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "on2_mem" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 1DEB91F008733DB70010E9CD /* Debug */,
+ 1DEB91F108733DB70010E9CD /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;
+}
diff --git a/Src/libvp6/corelibs/on2_common/src/on2_mem/on2_mem_tracker.c b/Src/libvp6/corelibs/on2_common/src/on2_mem/on2_mem_tracker.c
new file mode 100644
index 00000000..4021dd2d
--- /dev/null
+++ b/Src/libvp6/corelibs/on2_common/src/on2_mem/on2_mem_tracker.c
@@ -0,0 +1,596 @@
+#define __ON2_MEM_TRACKER_C__
+/*
+ on2_mem_tracker.c
+
+ jwz 2003-09-30:
+ Stores a list of addreses, their size, and file and line they came from.
+ All exposed lib functions are prefaced by on2_ and allow the global list
+ to be thread safe.
+ Current supported platforms are:
+ Linux, Win32, WinCE and VxWorks
+ Further support can be added by defining the platform specific mutex
+ in the MemoryTracker struct as well as calls to create/destroy/lock/unlock
+ the mutex in on2_MemoryTrackerInit/Destroy and MemoryTrackerLockMutex/UnlockMutex
+*/
+
+#if defined(LINUX)
+#include <pthread.h>
+#elif defined(WIN32) || defined(_WIN32_WCE)
+#include <windows.h>
+#include <winbase.h>
+#elif defined(VXWORKS)
+#include <semLib.h>
+#endif
+
+#include "on2_mem_tracker.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h> //VXWORKS doesn't have a malloc/memory.h file,
+ //this should pull in malloc,free,etc.
+#include <stdarg.h>
+
+#undef on2_malloc //undefine any on2_mem macros that may affect calls to
+#undef on2_free //memory functions in this file
+#undef on2_memcpy
+#undef on2_memset
+
+struct MemoryTracker
+{
+ struct MemBlock * head,
+ * tail;
+ int len,
+ totalsize;
+ unsigned int current_allocated,
+ max_allocated;
+
+ #if defined(LINUX)
+ pthread_mutex_t mutex;
+ #elif defined(WIN32) || defined(_WIN32_WCE)
+ HANDLE mutex;
+ #elif defined(VXWORKS)
+ SEM_ID mutex;
+ #else
+ #error "No mutex type defined for this platform!"
+ #endif
+
+ int padding_size,
+ pad_value;
+
+};
+
+
+/* prototypes for internal library functions */
+static void memtrack_log(const char* fmt, ...);
+static void MemoryTrackerDump();
+static void MemoryTrackerCheckIntegrity(char* file, unsigned int line);
+static void MemoryTrackerAdd(size_t addr, unsigned int size,
+ char* file, unsigned int line);
+static int MemoryTrackerRemove(size_t addr);
+static struct MemBlock* MemoryTrackerFind(size_t addr);
+
+static int MemoryTrackerLockMutex();
+static int MemoryTrackerUnlockMutex();
+
+static struct MemoryTracker memtrack; //our global memory allocation list
+static int g_bMemTrackerInited = 0; //indicates whether the global list has
+ //been initialized (1:yes/0:no)
+static FILE* g_logfile = NULL;
+static int g_logtype = 0;
+
+/*
+ *
+ * Exposed library functions
+ *
+*/
+
+/*
+ on2_MemoryTrackerInit(int padding_size, int pad_value)
+ padding_size - the size of the padding before and after each mem addr.
+ Values > 0 indicate that integrity checks can be performed
+ by inspecting these areas.
+ pad_value - the initial value within the padding area before and after
+ each mem addr.
+
+ Initializes global memory tracker structure
+ Allocates the head of the list
+*/
+int on2_MemoryTrackerInit(int padding_size, int pad_value)
+{
+ if (!g_bMemTrackerInited)
+ {
+ if (memtrack.head = (struct MemBlock*)malloc(sizeof(struct MemBlock)))
+ {
+ int ret;
+
+ memset(memtrack.head, 0, sizeof(struct MemBlock));
+
+ memtrack.tail = memtrack.head;
+
+ memtrack.current_allocated = 0;
+ memtrack.max_allocated = 0;
+
+ memtrack.padding_size = padding_size;
+ memtrack.pad_value = pad_value;
+
+ #if defined(LINUX)
+ ret = pthread_mutex_init(&memtrack.mutex,
+ NULL); /*mutex attributes (NULL=default)*/
+ #elif defined(WIN32) || defined(_WIN32_WCE)
+ memtrack.mutex = CreateMutex(NULL, /*security attributes*/
+ FALSE, /*we don't want initial ownership*/
+ NULL); /*mutex name*/
+ ret = !memtrack.mutex;
+ #elif defined(VXWORKS)
+ memtrack.mutex = semBCreate(SEM_Q_FIFO, /*SEM_Q_FIFO non-priority based mutex*/
+ SEM_FULL); /*SEM_FULL initial state is unlocked*/
+ ret = !memtrack.mutex;
+ #endif
+
+ if (ret)
+ {
+ memtrack_log("on2_MemoryTrackerInit: Error creating mutex!\n");
+
+ free(memtrack.head);
+ memtrack.head = NULL;
+ }
+ else
+ {
+ memtrack_log("Memory Tracker init'd, v."on2_mem_tracker_version"\n");
+ g_bMemTrackerInited = 1;
+ }
+ }
+ }
+
+ return g_bMemTrackerInited;
+}
+
+/*
+ on2_MemoryTrackerDestroy()
+ If our global struct was initialized zeros out all its members,
+ frees memory and destroys it's mutex
+*/
+void on2_MemoryTrackerDestroy()
+{
+ if (!MemoryTrackerLockMutex())
+ {
+ struct MemBlock* p = memtrack.head,
+ * p2 = memtrack.head;
+
+ MemoryTrackerDump();
+
+ while(p)
+ {
+ p2 = p;
+ p = p->next;
+
+ free(p2);
+ }
+
+ memtrack.head = NULL;
+ memtrack.tail = NULL;
+ memtrack.len = 0;
+ memtrack.current_allocated = 0;
+ memtrack.max_allocated = 0;
+
+ if(!g_logtype && g_logfile && g_logfile != stderr) {
+ fclose(g_logfile);
+ g_logfile = NULL;
+ }
+
+ MemoryTrackerUnlockMutex();
+
+ g_bMemTrackerInited = 0;
+ }
+}
+
+/*
+ on2_MemoryTrackerAdd(size_t addr, unsigned int size,
+ char * file, unsigned int line)
+ addr - memory address to be added to list
+ size - size of addr
+ file - the file addr was referenced from
+ line - the line in file addr was referenced from
+ Adds memory address addr, it's size, file and line it came from
+ to the global list via the thread safe internal library function
+*/
+void on2_MemoryTrackerAdd(size_t addr, unsigned int size,
+ char * file, unsigned int line)
+{
+ MemoryTrackerAdd(addr, size, file, line);
+}
+
+/*
+ on2_MemoryTrackerRemove(size_t addr)
+ addr - memory address to be removed from list
+ Removes addr from the global list via the thread safe
+ internal remove function
+ Return:
+ Same as described for MemoryTrackerRemove
+*/
+int on2_MemoryTrackerRemove(size_t addr)
+{
+ return MemoryTrackerRemove(addr);
+}
+
+/*
+ on2_MemoryTrackerFind(size_t addr)
+ addr - address to be found in list
+ Return:
+ If found, pointer to the memory block that matches addr
+ NULL otherwise
+*/
+struct MemBlock* on2_MemoryTrackerFind(size_t addr)
+{
+ struct MemBlock* p = NULL;
+
+ if (!MemoryTrackerLockMutex())
+ {
+ p = MemoryTrackerFind(addr);
+ MemoryTrackerUnlockMutex();
+ }
+
+ return p;
+}
+
+/*
+ on2_MemoryTrackerDump()
+ Locks the memory tracker's mutex and calls the internal
+ library function to dump the current contents of the
+ global memory allocation list
+*/
+void on2_MemoryTrackerDump()
+{
+ if (!MemoryTrackerLockMutex())
+ {
+ MemoryTrackerDump();
+ MemoryTrackerUnlockMutex();
+ }
+}
+
+/*
+ on2_MemoryTrackerCheckIntegrity(char* file, unsigned int line)
+ file - The file name where the check was placed
+ line - The line in file where the check was placed
+ Locks the memory tracker's mutex and calls the internal
+ integrity check function to inspect every address in the global
+ memory allocation list
+*/
+void on2_MemoryTrackerCheckIntegrity(char* file, unsigned int line)
+{
+ if (!MemoryTrackerLockMutex())
+ {
+ MemoryTrackerCheckIntegrity(file, line);
+ MemoryTrackerUnlockMutex();
+ }
+}
+
+/*
+ on2_MemoryTrackerSetLogType
+ Sets the logging type for the memory tracker. Based on the value it will
+ direct its output to the appropriate place.
+ Return:
+ 0: on success
+ -1: if the logging type could not be set, because the value was invalid
+ or because a file could not be opened
+*/
+int on2_MemoryTrackerSetLogType(int type, char* option)
+{
+ int ret = -1;
+
+ switch(type) {
+ case 0:
+ g_logtype = 0;
+ if(!option) {
+ g_logfile = stderr;
+ ret = 0;
+ } else {
+ if (g_logfile = fopen(option, "w"))
+ ret = 0;
+ }
+ break;
+#if defined(WIN32) && !defined(_WIN32_WCE)
+ case 1:
+ g_logtype = type;
+ ret = 0;
+ break;
+#endif
+ default:
+ break;
+ }
+
+ //output the version to the new logging destination
+ if(!ret)
+ memtrack_log("Memory Tracker init'd, v."on2_mem_tracker_version"\n");
+
+ return ret;
+}
+
+/*
+ *
+ * END - Exposed library functions
+ *
+*/
+
+
+/*
+ *
+ * Internal library functions
+ *
+*/
+
+static void memtrack_log(const char* fmt, ...)
+{
+ va_list list;
+
+ va_start(list, fmt);
+ switch(g_logtype) {
+ case 0:
+ if (g_logfile) {
+ vfprintf(g_logfile, fmt, list);
+ fflush(g_logfile);
+ }
+ break;
+#if defined(WIN32) && !defined(_WIN32_WCE)
+ case 1:
+ {
+ char temp[1024];
+ _vsnprintf(temp, sizeof(temp)/sizeof(char)-1, fmt, list);
+ OutputDebugString(temp);
+ }
+ break;
+#endif
+ default:
+ break;
+ }
+ va_end(list);
+}
+
+/*
+ MemoryTrackerDump()
+ Dumps the current contents of the global memory allocation list
+*/
+static void MemoryTrackerDump()
+{
+ int i = 0;
+ struct MemBlock* p = (memtrack.head ? memtrack.head->next : NULL);
+
+ memtrack_log("Currently Allocated= %d; Max allocated= %d\n",
+ memtrack.current_allocated, memtrack.max_allocated);
+
+ while(p)
+ {
+ memtrack_log("memblocks[%d].addr= 0x%.8x, memblocks[%d].size= %d, file: %s, line: %d\n", i,
+ p->addr, i, p->size,
+ p->file, p->line);
+
+ p = p->next;
+ ++i;
+ }
+}
+
+/*
+ MemoryTrackerCheckIntegrity(char* file, unsigned int file)
+ file - the file name where the check was placed
+ line - the line in file where the check was placed
+ If a padding_size was supplied to on2_MemoryTrackerInit()
+ this function will ea. addr in the list verifying that
+ addr-padding_size and addr+padding_size is filled with pad_value
+*/
+static void MemoryTrackerCheckIntegrity(char* file, unsigned int line)
+{
+ if (memtrack.padding_size)
+ {
+ int i,
+ index = 0;
+ unsigned int * pShowMe,
+ * pShowMe2;
+ unsigned int tempme = memtrack.pad_value,
+ dead1,
+ dead2;
+ unsigned char *xBounds;
+ struct MemBlock* p = memtrack.head->next;
+
+ while (p)
+ {
+ xBounds = (unsigned char*)p->addr;
+
+ //back up ON2_BYTE_ALIGNMENT
+ xBounds -= memtrack.padding_size;
+
+ for (i=0;i<memtrack.padding_size;i+=sizeof(unsigned int))
+ {
+ pShowMe = (unsigned int*)(xBounds+i);
+ pShowMe2 = (unsigned int*)(xBounds + p->size + memtrack.padding_size + i);
+
+ memcpy(&dead1, pShowMe, sizeof(unsigned int));
+ memcpy(&dead2, pShowMe2, sizeof(unsigned int));
+
+ if ((dead1 != tempme) || (dead2 != tempme))
+ {
+ memtrack_log("\n[on2_mem integrity check failed]:\n"
+ " index[%d] {%s:%d} addr=0x%x, size= %d,"
+ " file: %s, line: %d c0:0x%x c1:0x%x\n",
+ index, file, line, p->addr, p->size, p->file,
+ p->line, dead1, dead2);
+ }
+ }
+
+ ++index;
+ p = p->next;
+ }
+ }
+}
+
+/*
+ MemoryTrackerAdd(size_t addr, unsigned int size,
+ char * file, unsigned int line)
+ Adds an address (addr), it's size, file and line number to our list.
+ Adjusts the total bytes allocated and max bytes allocated if necessary.
+ If memory cannot be allocated the list will be destroyed.
+*/
+void MemoryTrackerAdd(size_t addr, unsigned int size,
+ char * file, unsigned int line)
+{
+ if (!MemoryTrackerLockMutex())
+ {
+ struct MemBlock* p;
+
+ p = malloc(sizeof(struct MemBlock));
+
+ if (p)
+ {
+ p->prev = memtrack.tail;
+ p->prev->next = p;
+ p->addr = addr;
+ p->size = size;
+ p->line = line;
+ p->file = file;
+ p->next = NULL;
+
+ memtrack.tail = p;
+
+ memtrack.current_allocated += size;
+
+ if (memtrack.current_allocated > memtrack.max_allocated)
+ memtrack.max_allocated = memtrack.current_allocated;
+
+ MemoryTrackerUnlockMutex();
+ }
+ else
+ {
+ memtrack_log("MemoryTrackerAdd: error allocating memory!\n");
+ MemoryTrackerUnlockMutex();
+ on2_MemoryTrackerDestroy();
+ }
+ }
+}
+
+/*
+ MemoryTrackerRemove(size_t addr)
+ Removes an address and its corresponding size (if they exist)
+ from the memory tracker list and adjusts the current number
+ of bytes allocated.
+ Return:
+ 0: on success
+ -1: if the mutex could not be locked
+ -2: if the addr was not found in the list
+*/
+int MemoryTrackerRemove(size_t addr)
+{
+ int ret = -1;
+
+ if (!MemoryTrackerLockMutex())
+ {
+ struct MemBlock* p;
+
+ if (p = MemoryTrackerFind(addr))
+ {
+ memtrack.current_allocated -= p->size;
+
+ p->prev->next = p->next;
+ if (p->next)
+ p->next->prev = p->prev;
+ else
+ memtrack.tail = p->prev;
+
+ ret = 0;
+ free(p);
+ }
+ else
+ {
+ memtrack_log("MemoryTrackerRemove(): addr not found in list, 0x%.8x\n", addr);
+ ret = -2;
+ }
+
+ MemoryTrackerUnlockMutex();
+ }
+
+ return ret;
+}
+
+/*
+ MemoryTrackerFind(size_t addr)
+ Finds an address in our addrs list
+ NOTE: the mutex MUST be locked in the other internal
+ functions before calling this one. This avoids
+ the need for repeated locking and unlocking as in Remove
+ Returns: pointer to the mem block if found, NULL otherwise
+*/
+static struct MemBlock* MemoryTrackerFind(size_t addr)
+{
+ struct MemBlock* p = NULL;
+
+ if (memtrack.head)
+ {
+ p = memtrack.head->next;
+
+ while(p && (p->addr != addr))
+ p = p->next;
+ }
+
+ return p;
+}
+
+/*
+ MemoryTrackerLockMutex()
+ Locks the memory tracker mutex with a platform specific call
+ Returns:
+ 0: Success
+ <0: Failure, either the mutex was not initialized
+ or the call to lock the mutex failed
+*/
+static int MemoryTrackerLockMutex()
+{
+ int ret = -1;
+
+ if (g_bMemTrackerInited)
+ {
+
+ #if defined(LINUX)
+ ret = pthread_mutex_lock(&memtrack.mutex);
+ #elif defined(WIN32) || defined(_WIN32_WCE)
+ ret = WaitForSingleObject(memtrack.mutex, INFINITE);
+ #elif defined(VXWORKS)
+ ret = semTake(memtrack.mutex, WAIT_FOREVER);
+ #endif
+
+ if (ret)
+ {
+ memtrack_log("MemoryTrackerLockMutex: mutex lock failed\n");
+ }
+ }
+
+ return ret;
+}
+
+/*
+ MemoryTrackerUnlockMutex()
+ Unlocks the memory tracker mutex with a platform specific call
+ Returns:
+ 0: Success
+ <0: Failure, either the mutex was not initialized
+ or the call to unlock the mutex failed
+*/
+static int MemoryTrackerUnlockMutex()
+{
+ int ret = -1;
+
+ if (g_bMemTrackerInited)
+ {
+
+ #if defined(LINUX)
+ ret = pthread_mutex_unlock(&memtrack.mutex);
+ #elif defined(WIN32) || defined(_WIN32_WCE)
+ ret = !ReleaseMutex(memtrack.mutex);
+ #elif defined(VXWORKS)
+ ret = semGive(memtrack.mutex);
+ #endif
+
+ if (ret)
+ {
+ memtrack_log("MemoryTrackerUnlockMutex: mutex unlock failed\n");
+ }
+ }
+
+ return ret;
+}
diff --git a/Src/libvp6/corelibs/sal/generic/circlebuffer.c b/Src/libvp6/corelibs/sal/generic/circlebuffer.c
new file mode 100644
index 00000000..d7b2d228
--- /dev/null
+++ b/Src/libvp6/corelibs/sal/generic/circlebuffer.c
@@ -0,0 +1,410 @@
+
+
+#include "circlebuffer.h"
+
+#include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h> /* memory copy */
+#include "duck_mem.h"
+
+
+/* this is just a debugging trick so that we can "see" the free space */
+void* circleread_memcpy(void* dst, void* src, int64_t count);
+void* circleread_memcpy(void* dst, void* src, int64_t count)
+{
+ return duck_memcpy64(dst, src, count);
+}
+
+
+
+void CircleReport(const CircleBuffer_t* cb, const char* title)
+{
+ printf("-----(%s)------\n", title);
+ printf("max Size cb = %ld\n", cb->bufSize);
+ printf("fills at = %ld\n", cb->bufSize * cb->percent / 100 );
+ printf("Current amount = %ld, level = %ld\n", cb->count, cb->count * 100 / cb->bufSize);
+}
+
+
+
+
+int ForwardBuffer(CircleBuffer_t* cb, int64_t len)
+{
+ if (len >= (int64_t)cb->count)
+ return -1;
+
+ if ( (cb->head + len) < cb->bufSize )
+ cb->head += (int)len;
+
+ else
+ cb->head = (int)len - (cb->bufSize - cb->head);
+
+ cb->count -= (int)len;
+
+ return 0;
+}
+
+
+
+
+
+
+int RewindBuffer(CircleBuffer_t* cb, int64_t len)
+{
+ if (len >= (int64_t)(cb->bufSize - cb->count) )
+ return -1; /* not enough history in buffer ! */
+
+ if (cb->head <= (size_t)len)
+ {
+ if (cb->wrapped == 0)
+ return -1;
+
+ cb->head = cb->bufSize - ((int)len - cb->head);
+ cb->count += (int)len;
+ return 0;
+ }
+ else
+ {
+ cb->head -= (int)len;
+ cb->count += (int)len;
+ }
+
+ return 0;
+}
+
+
+
+
+void destroyCircleBuffer(CircleBuffer_t* cb)
+{
+ assert(cb);
+ if (cb->buffer)
+ free(cb->buffer);
+
+ if (cb->maxChunk)
+ free(cb->maxChunk);
+}
+
+
+int resetCircleBuffer(CircleBuffer_t* cb)
+{
+ cb->count = 0;
+ cb->bytesConsumed = 0;
+ cb->wrapped = 0;
+ cb->starvedBytes = 0;
+ cb->starvedRequests = 0;
+
+ return 0;
+}
+
+
+
+int initCircleBuffer(
+ CircleBuffer_t* cb,
+ size_t countRecords,
+ int percent,
+ size_t maxChunk,
+ FuncLock_t lock,
+ FuncLock_t unlock
+)
+{
+ assert(cb);
+
+ cb->buffer = (unsigned char * ) calloc(1, countRecords);
+
+ cb->maxChunk = (unsigned char *) calloc(1, maxChunk);
+ cb->maxChunkLen = maxChunk;
+
+ if (cb->buffer)
+ {
+ cb->head = cb->count = 0;
+ cb->balance = 0;
+ cb->bufSize = countRecords;
+ cb->bytesConsumed = 0;
+ cb->muted = false;
+ cb->percent = percent;
+ cb->wrapped = 0;
+ cb->lock = lock;
+ cb->unlock = unlock;
+ return 0;
+ }
+ else
+ {
+ return -1; /* error */
+ }
+
+}
+
+
+
+/* return zero if plenty of room and success */
+/*-------------------------------------------*/
+/* free space nested in the middle of the buffer is consider endSpace */
+/* and when free space nested in middle, startSpace is considered to be zero */
+/*---------------------------------------------------------------------------*/
+int addToCircleBuffer(CircleBuffer_t* cb, void* data, size_t requestSpace)
+{
+ int64_t freeSpace; /* count total free space in buffer */
+ int64_t head = cb->head; /* offset start of valid data */
+ int64_t tail = (cb->head + cb->count) % cb->bufSize; /* offest first free byte after valid data */
+ int64_t endSpace;
+
+ freeSpace = cb->bufSize - cb->count;
+
+ /* if not enough room to do the add */
+ /*----------------------------------*/
+ if (requestSpace > freeSpace)
+ {
+ assert(0);
+ return CB_FULL;
+ }
+
+
+ endSpace = cb->bufSize - tail;
+
+ if (tail >= head && requestSpace > endSpace) /* additional data write will wrap */
+ {
+ duck_memcpy64(&cb->buffer[tail], data, endSpace);
+ duck_memcpy64(
+ cb->buffer,
+ (unsigned char *)data+endSpace,
+ requestSpace - endSpace);
+ }
+ else /* existing data wrapped around from end of buffer through beginning of buffer. */
+ {
+ memcpy(&cb->buffer[tail], data, requestSpace);
+ }
+
+ cb->count += requestSpace;
+ cb->balance += 1;
+
+ return 0; /* -1 will mean error,m zero is OK */
+}
+
+/* get info need so we can write direct as in memcpy into the circle buffer */
+/*--------------------------------------------------------------------------*/
+void FreeWrapless(const CircleBuffer_t* cb, void* handle, int64_t* sizeWrapless)
+{
+ int64_t tail = (cb->head + cb->count) % cb->bufSize;
+
+ if ((cb->head + cb->count) < cb->bufSize)
+ {
+ *((void **) handle) = &cb->buffer[tail];
+ *sizeWrapless = (cb->bufSize -(cb->head + cb->count));
+ }
+ else
+ {
+ *((void **) handle) = &cb->buffer[tail];
+ *sizeWrapless = (cb->bufSize - cb->count);
+ }
+}
+
+
+
+/* Please clone this sucker from readFromCircleBuffer */
+int accessCircleBuffer(CircleBuffer_t* cb, void* handle1, size_t requestSize)
+{
+ int64_t head = cb->head;
+ int64_t tail = (cb->head + cb->count) % cb->bufSize;
+ void** handle = (void **) handle1;
+ void* dest = *handle;
+
+ if (requestSize <= 0)
+ {
+ return requestSize;
+ }
+
+ if (cb->count < requestSize)
+ {
+ return -1;
+ }
+
+
+ if (tail > head) /* the data does not wrap ! */
+ {
+ *handle = &cb->buffer[head];
+ }
+ else /* the current data does wrap */
+ {
+ /* but our read does not wrap */
+ if (head + requestSize < cb->bufSize)
+ {
+ *handle = &cb->buffer[head];
+ }
+ else if (head + requestSize == cb->bufSize)
+ {
+ *handle = &cb->buffer[head];
+ }
+ else /* our read will wrap ! */
+ {
+ int64_t temp = cb->bufSize - head;
+ dest = cb->maxChunk;
+
+ assert(cb->maxChunkLen >= requestSize);
+
+ circleread_memcpy(
+ dest,
+ &cb->buffer[head],
+ temp);
+ circleread_memcpy(
+ ((unsigned char *) dest) + temp,
+ cb->buffer,
+ requestSize - temp);
+ *handle = dest;
+ }
+ }
+
+ cb->head = (cb->head + requestSize) % cb->bufSize;
+ cb->count -= requestSize;
+
+ cb->bytesConsumed += requestSize;
+ cb->balance -= 1;
+
+ return requestSize; /* records (16 bit or maybe other in future) */
+}
+
+
+
+
+
+
+/* return count read , or -1 if not enough data */
+/*----------------------------------------------*/
+int readFromCircleBuffer(CircleBuffer_t* cb, void* dest, size_t requestSize)
+{
+ int64_t head = cb->head;
+ int64_t tail = (cb->head + cb->count) % cb->bufSize;
+
+ if (cb->count < requestSize)
+ {
+ requestSize = cb->count; /* Give them what we have */
+ }
+
+ if (requestSize <= 0)
+ {
+ return (int)requestSize;
+ }
+
+ if (tail > head) /* the data does not wrap ! */
+ {
+ circleread_memcpy(dest, &cb->buffer[head], requestSize);
+ }
+ else /* the current data does wrap */
+ {
+ /* but our read does not wrap */
+ if (head + requestSize < cb->bufSize)
+ {
+ circleread_memcpy(dest, &cb->buffer[head], requestSize);
+ }
+ else if (head + requestSize == cb->bufSize)
+ {
+ circleread_memcpy(dest, &cb->buffer[head], requestSize);
+ memset(&cb->buffer[head], 0, (size_t)requestSize); /* optional, debug */
+ }
+ else /* our read will wrap ! */
+ {
+ int64_t temp = cb->bufSize - head;
+ circleread_memcpy(
+ dest,
+ &cb->buffer[head],
+ temp);
+ circleread_memcpy(
+ ((unsigned char *) dest) + temp,
+ cb->buffer,
+ requestSize - temp);
+ }
+ }
+
+ cb->head = (cb->head + requestSize) % cb->bufSize;
+ cb->count -= requestSize;
+
+ cb->bytesConsumed += requestSize;
+ cb->balance -= 1;
+
+ return (int)requestSize; /* records (16 bit or maybe other in future) */
+}
+
+
+
+
+
+
+
+void testCircleBuffer()
+{
+ CircleBuffer_t temp;
+ size_t bufSize = 256;
+ const size_t maxInput = 256*3;
+ size_t count = 0;
+ size_t t;
+ int i;
+ const int maxRandom = 32;
+ size_t chunkOut = 30;
+
+ CircleRecord_t data[256*3];
+
+ initCircleBuffer(&temp, bufSize, 75, 256, 0, 0);
+
+ /* who cares ... take the default seed value. */
+ while (count < maxInput || temp.count > chunkOut)
+ {
+ t = rand();
+
+ /* for whatever reason this seems to be a 16 bit random number */
+ t = t / ( 2 << (16 - 7) ) ;
+
+ for(i = 0; i < (int)t; i++)
+ {
+ data[i] = (unsigned char ) ( count + i );
+ }
+
+ if (
+ ((temp.bufSize - temp.count) >= t*sizeof(short)+1) &&
+ (count < (maxInput - maxRandom))
+ ) /* add 1 to keep buffer being completely filled */
+ {
+ int64_t tail = (temp.head + temp.count) % temp.bufSize;
+ addToCircleBuffer(&temp, data, t);
+ printf("Add to buffer count = %ld. head = %ld, tail = %ld\n", t, temp.head, tail);
+ count += t;
+ }
+ else /* not enough space in buffer, try to empty some out */
+ {
+ int r;
+ r = readFromCircleBuffer(&temp, data, chunkOut);
+
+ if (r >= 0)
+ {
+ int64_t tail = (temp.head + temp.count) % temp.bufSize;
+ for(i = 0; i < r; i++)
+ printf("%ld ", data[i]);
+
+ printf("\nRead from buffer. head = %ld, tail = %ld\n", temp.head, tail);
+ }
+ }
+
+
+ } /* while we have not accumulated a large eough test ... */
+
+}
+
+
+
+
+
+
+int CirclePercent(CircleBuffer_t* cb)
+{
+ return (int)(cb->count * 100 / cb->bufSize);
+}
+
+int CircleAtLevel(CircleBuffer_t* cb)
+{
+ return (int)(cb->count * 100 / cb->bufSize) >= cb->percent;
+}
+
+int CircleOverLevel(CircleBuffer_t* cb)
+{
+ return (int)(cb->count * 100 / cb->bufSize) > cb->percent;
+} \ No newline at end of file
diff --git a/Src/libvp6/corelibs/sal/generic/circlebuffer.h b/Src/libvp6/corelibs/sal/generic/circlebuffer.h
new file mode 100644
index 00000000..65329442
--- /dev/null
+++ b/Src/libvp6/corelibs/sal/generic/circlebuffer.h
@@ -0,0 +1,99 @@
+
+#if !defined(_circlebuffer_h)
+#define _circlebuffer_h
+
+#include <stdlib.h>
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+
+#if defined(_WIN32)
+ typedef __int64 int64_t;
+#elif defined(__POWERPC) || defined(__APPLE)
+ #include <ppc/types.h>
+#else
+ typedef long long int64_t;
+#endif
+
+#if !defined(_WIN32)
+#pragma bool on
+#endif
+
+
+
+typedef unsigned char CircleRecord_t;
+
+
+
+typedef void (*FuncLock_t)() ;
+
+/* assume that assert, alerts, messages to go off before this ever is allowed to fill */
+/*------------------------------------------------------------------------------------*/
+typedef struct CircleBuf_tt
+{
+ size_t head; /* points to start of usable data in buffer */
+ size_t count;
+ size_t bufSize;
+ int64_t bytesConsumed;
+ size_t recordSize;
+ size_t userData; /* might store actual recordsize */
+ int balance;
+ CircleRecord_t* buffer; /* 10 seconds of 16 bit stereo nice quality */
+ unsigned char* maxChunk;
+ size_t maxChunkLen;
+ int percent; /* level where buffer considered stable */
+ int wrapped; /* non-zero if data has wrapped at least once */
+ int muted;
+
+ FuncLock_t lock; /* in case there could be competition for any members */
+ FuncLock_t unlock; /* in case there could be competition for any members */
+
+ int starvedBytes; /* how many bytes we had to "conjure up" because we were empty (debug) */
+ int starvedRequests; /* how many request we honored when we have been in a starved state (debug) */
+
+} CircleBuffer_t;
+
+
+void testCircleBuffer(void);
+void destroyCircleBuffer(CircleBuffer_t* cb);
+int initCircleBuffer(CircleBuffer_t* cb, size_t size, int percent, size_t maxChunk, FuncLock_t lock, FuncLock_t unlock);
+int addToCircleBuffer(CircleBuffer_t* cb, void* data, size_t count);
+int readFromCircleBuffer(CircleBuffer_t* cb, void* dest, size_t count);
+int accessCircleBuffer(CircleBuffer_t* cb, void* dest, size_t count);
+void FreeWrapless(const CircleBuffer_t* cb, void* handle, size_t* sizeWrapless);
+int resetCircleBuffer(CircleBuffer_t* cb);
+int RewindBuffer(CircleBuffer_t* cb, int64_t len);
+int ForwardBuffer(CircleBuffer_t* cb, int64_t len);
+
+
+
+void CircleReport(const CircleBuffer_t* cb, const char* title);
+
+
+
+int CirclePercent(CircleBuffer_t* cb);
+
+int CircleAtLevel(CircleBuffer_t* cb);
+
+int CircleOverLevel(CircleBuffer_t* cb);
+
+
+
+typedef enum {
+ CB_NOERR = 0, /* OK */
+ CB_FULL = -1, /* Buffer overflow */
+ CB_MAX_LEVEL = -2, /* Buffer is over target full level (percent) */
+ CB_MIN_LEVEL = -3, /* Buffer is under target min level (percent) */
+ CB_EMPTY = -4 /* Buffer is empty */
+} CB_Err_t;
+#if defined(__cplusplus)
+}
+#endif
+
+
+
+#endif
+
+
diff --git a/Src/libvp6/corelibs/sal/generic/duck_io.c b/Src/libvp6/corelibs/sal/generic/duck_io.c
new file mode 100644
index 00000000..0e2d7f30
--- /dev/null
+++ b/Src/libvp6/corelibs/sal/generic/duck_io.c
@@ -0,0 +1,130 @@
+/***********************************************\
+??? duck_io.c
+\***********************************************/
+
+#include <stdio.h>
+#include <string.h>
+#include <fcntl.h>
+#include "duck_io.h"
+#include "duck_io_http.h"
+#include "duck_io_file.h"
+#include "duck_hfb.h"
+
+#include <assert.h>
+
+#define MAKE_FOUR_CC(b1, b2, b3, b4 ) \
+ ((b4 << 24) | (b3 << 16) | (b2 << 8) | (b1 << 0))
+
+int duck_readFinished(int han, int flag)
+{
+ (void)han;
+ (void)flag;
+ return 1;
+}
+
+
+bool g_isHttp = false;
+
+int duck_open(const char *name, unsigned long userData)
+{
+ if (strstr(name, "http://"))
+ return duck_open_http(name, userData);
+ else
+ return duck_open_file(name, userData);
+
+}
+
+
+
+
+void duck_close(int handle)
+{
+ unsigned long schemeCC = *((unsigned long *) handle);
+
+ if (schemeCC == MAKE_FOUR_CC('h','t','t','p'))
+ duck_close_http(handle);
+ else if (schemeCC == MAKE_FOUR_CC('f','i','l','e'))
+ duck_close_file(handle);
+ else
+ assert(0);
+}
+
+
+int duck_read(int handle,unsigned char *buffer,int bytes)
+{
+ unsigned long schemeCC = *((unsigned long *) handle);
+
+ if (schemeCC == MAKE_FOUR_CC('h','t','t','p'))
+ return duck_read_http(handle, buffer, bytes);
+ else if (schemeCC == MAKE_FOUR_CC('f','i','l','e'))
+ return duck_read_file(handle, buffer, bytes);
+ else
+ {
+ assert(0);
+ return -1;
+ }
+}
+
+int duck_read_blocking(int handle,unsigned char *buffer,int bytes)
+{
+ unsigned long schemeCC = *((unsigned long *) handle);
+
+ if (schemeCC == MAKE_FOUR_CC('h','t','t','p'))
+ return duck_read_blocking_http(handle, buffer, bytes);
+ else if (schemeCC == MAKE_FOUR_CC('f','i','l','e'))
+ return duck_read_file(handle, buffer, bytes);
+ else
+ {
+ assert(0);
+ return -1;
+ }
+}
+
+
+
+int64_t duck_seek(int handle,int64_t offset,int origin)
+{
+
+ unsigned long schemeCC = *((unsigned long *) handle);
+
+ if (schemeCC == MAKE_FOUR_CC('h','t','t','p'))
+ return duck_seek_http(handle, offset, origin);
+ else if (schemeCC == MAKE_FOUR_CC('f','i','l','e'))
+ return duck_seek_file(handle, offset, origin);
+ else
+ {
+ assert(0);
+ return -1;
+ }
+
+}
+
+int duck_name(int handle, char name[], size_t maxLen)
+{
+ unsigned long schemeCC = *((unsigned long *) handle);
+
+ if (schemeCC == MAKE_FOUR_CC('h','t','t','p'))
+ return duck_name_http(handle, name, maxLen);
+ else if (schemeCC == MAKE_FOUR_CC('f','i','l','e'))
+ return duck_name_file(handle, name, maxLen);
+ else
+ {
+ assert(0);
+ return -1;
+ }
+}
+
+int64_t duck_available_data(int handle)
+{
+ unsigned long schemeCC = *((unsigned long *) handle);
+
+ if (schemeCC == MAKE_FOUR_CC('h','t','t','p'))
+ return duck_available_data_http(handle);
+ else if (schemeCC == MAKE_FOUR_CC('f','i','l','e'))
+ return duck_available_data_file(handle);
+ else
+ {
+ assert(0);
+ return -1;
+ }
+}
diff --git a/Src/libvp6/corelibs/sal/generic/duck_io_file.c b/Src/libvp6/corelibs/sal/generic/duck_io_file.c
new file mode 100644
index 00000000..bf954d5a
--- /dev/null
+++ b/Src/libvp6/corelibs/sal/generic/duck_io_file.c
@@ -0,0 +1,224 @@
+/***********************************************\
+??? duck_io.c
+\***********************************************/
+
+#include <stdio.h>
+#include <string.h>
+#include <fcntl.h>
+
+#if defined(_WIN32)
+ #include <io.h>
+#endif
+
+#include "duck_io_file.h"
+#include "duck_hfb.h"
+#include "duck_io.h"
+#include "duck_mem.h"
+
+#include <assert.h>
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+
+#if defined (__cplusplus)
+}
+#endif
+
+
+
+//int read_count;
+
+#define MAKE_FOUR_CC(b1, b2, b3, b4 ) \
+ ((b4 << 24) | (b3 << 16) | (b2 << 8) | (b1 << 0))
+
+typedef struct
+{
+ unsigned long scheme; /* contains FILE */
+ #if defined(_WIN32)
+ int fileDescriptor; /* used to be the handle */
+ #else
+ FILE* fileDescriptor; /* used to be the handle */
+ #endif
+ char fname[512];
+ int64_t fileLength;
+ char errorString[256];
+ SAL_ERR lastErrorCode;
+
+} FileScheme_t;
+
+
+/* Add the decoration to avoid name collisions in the case where we want to include */
+/* a forking version of duck_io that calls duck_io_file or duck_io_http */
+/* The user of this service should not need to compile and link all three files */
+/* duck_io (abstract forker) duck_io_file and duck_io_http. */
+#define DECORATE(x) x##_file
+
+
+/* Sets an error code and message */
+static int SetError(int handle, SAL_ERR code, const char* appendMsg)
+{
+ FileScheme_t* fileObj = (FileScheme_t *) handle;
+
+ const char* decode = SalErrText(code);
+ if (decode)
+ {
+ strcpy(fileObj->errorString, decode);
+ fileObj->lastErrorCode = code;
+ if (appendMsg)
+ {
+ strcat(fileObj->errorString, " : ");
+ strcat(fileObj->errorString, appendMsg);
+ }
+ return code;
+ }
+
+ return SAL_ERROR; // DEFAULT ERROR
+}
+
+
+int DECORATE(duck_open)(const char *name, unsigned long userData)
+{
+ FileScheme_t* const fileObj = (FileScheme_t *) duck_calloc(1,sizeof(FileScheme_t), DMEM_GENERAL);
+ const ReOpen_t* const openData = (ReOpen_t*) userData;
+
+ fileObj->scheme = MAKE_FOUR_CC('f','i','l','e');
+
+ assert(name);
+ assert(strlen(name) < sizeof(fileObj->fname));
+ strcpy(fileObj->fname,name);
+
+ #if defined(_WIN32)
+ fileObj->fileDescriptor = _open(name, _O_RDONLY | _O_BINARY);
+
+ if(fileObj->fileDescriptor == -1)
+ return SetError((int)fileObj, SAL_ERR_FILE_OPEN_FAILED, 0);
+ #else
+ fileObj->fileDescriptor = fopen(name, "rb");
+
+ if(fileObj->fileDescriptor == 0)
+ return SetError((int)fileObj, SAL_ERR_FILE_OPEN_FAILED, 0);;
+ #endif
+
+ fileObj->fileLength = duck_seek((int) fileObj, 0, SEEK_END);
+
+ duck_seek((int) fileObj, 0, SEEK_SET);
+
+ if(openData)
+ duck_seek_file((int) fileObj, openData->offset, SEEK_SET);
+
+ return (int)fileObj;
+
+}
+
+
+
+void DECORATE(duck_close)(int handle)
+{
+ FileScheme_t* fileObj = (FileScheme_t *) handle;
+
+ #if defined(_WIN32)
+ _close(fileObj->fileDescriptor);
+ #else
+ fclose(fileObj->fileDescriptor);
+ #endif
+
+ if (fileObj)
+ {
+ duck_free(fileObj);
+ fileObj = 0;
+ }
+
+}
+
+
+
+int DECORATE(duck_read_blocking)(int handle,unsigned char *buffer,int bytes)
+{
+ return DECORATE(duck_read)(handle, buffer, bytes);
+}
+
+
+
+
+int DECORATE(duck_read)(int handle,unsigned char *buffer,int bytes)
+{
+ int x;
+ FileScheme_t* fileObj = (FileScheme_t *) handle;
+
+ if (buffer == NULL){
+ duck_seek_file((int ) fileObj->fileDescriptor,bytes,SEEK_CUR);
+ return bytes;
+ }
+
+ if (bytes == 0)
+ return 0;
+
+ #if defined(_WIN32)
+ x = _read(fileObj->fileDescriptor, buffer, (unsigned int) bytes);
+ if (x == -1L)
+ {
+ assert(0);
+ }
+ #else
+ x = fread(buffer, sizeof(char) , (size_t) bytes, fileObj->fileDescriptor);
+ if (x < bytes)
+ {
+ assert(x == bytes);
+ }
+ #endif
+
+
+ return x ;
+}
+
+
+int64_t DECORATE(duck_seek)(int handle, int64_t offset, int origin)
+{
+#if defined(_WIN32)
+ int64_t tellNo = 0;
+ FileScheme_t* fileObj = (FileScheme_t *) handle;
+
+ _lseeki64(fileObj->fileDescriptor,offset,origin);
+
+ tellNo = _telli64(fileObj->fileDescriptor);
+
+ return tellNo ;
+#else
+ int64_t tellNo = 0;
+ FileScheme_t* fileObj = 0;
+ assert(sizeof(off_t) == sizeof(int64_t));
+ fileObj = (FileScheme_t *) handle;
+
+ fseeko(fileObj->fileDescriptor,(off_t) offset,origin);
+
+ tellNo = (int64_t) ftello(fileObj->fileDescriptor);
+
+ return tellNo ;
+#endif
+
+}
+
+
+int DECORATE(duck_name)(int handle, char fname[], size_t maxLen)
+{
+ FileScheme_t* fileObj = (FileScheme_t *) handle;
+
+ if (strlen(fileObj->fname) < maxLen)
+ strcpy(fname, fileObj->fname);
+ else
+ return -1;
+
+ return 0;
+}
+
+int64_t DECORATE(duck_available_data)(int handle)
+{
+ FileScheme_t* fileObj = (FileScheme_t *) handle;
+#if defined(_WIN32)
+ return fileObj->fileLength - _telli64(fileObj->fileDescriptor);
+#else
+ return fileObj->fileLength - (int64_t) ftello(fileObj->fileDescriptor);
+#endif
+}
diff --git a/Src/libvp6/corelibs/sal/generic/duck_io_http.c b/Src/libvp6/corelibs/sal/generic/duck_io_http.c
new file mode 100644
index 00000000..bec7a674
--- /dev/null
+++ b/Src/libvp6/corelibs/sal/generic/duck_io_http.c
@@ -0,0 +1,902 @@
+/***********************************************\
+??? duck_io.c
+\***********************************************/
+#ifdef _WIN32
+#pragma warning(push,3)
+#endif
+
+#include "duck_io_http.h"
+#include "duck_mem.h"
+#include "on2_timer.h"
+#include "circlebuffer.h"
+#include "duck_io.h"
+#include <errno.h>
+
+#ifdef _WIN32
+#include <winsock2.h>
+#else
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+extern "C" {
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <unistd.h>
+}
+#endif
+
+#include <sstream>
+#include <limits.h>
+
+
+#define DEFAULT_CBSIZE 512 * 1024
+
+#define DECORATE(x) x##_http
+
+
+
+int duck_sal_fill(void * handle, bool blocking, size_t maxFill);
+
+
+//#include "debug.h" // This can be removed
+
+#ifdef _WIN32
+#pragma warning(pop)
+#pragma warning(disable:4706) /* assignment in conditional expression */
+#pragma warning(disable:4514) /* matt made me do it */
+ const char i64Fmt[] = "%I64d";
+#else
+ const char i64Fmt[] = "%lld";
+ int WSAGetLastError()
+ {
+ return -1;
+ }
+#endif
+
+#define MAKE_FOUR_CC(b1, b2, b3, b4 ) \
+ ((b4 << 24) | (b3 << 16) | (b2 << 8) | (b1 << 0))
+
+typedef struct _DuckHttp_temp
+{
+ unsigned long scheme;
+ std::string url;
+ std::string urlExtended;
+
+#if defined(_WIN32)
+ SOCKET socket;
+#else
+ int socket;
+#endif
+
+ SAL_ERR lastErrorCode;
+ std::ostringstream errorString;
+
+
+
+ /* milliseconds to wait before disconnecting from server */
+ unsigned int timeOut;
+
+ /* Assuming 2k is the max size of an http header */
+ char httpHeader[2 * 1024];
+
+ int64_t contentLen; // Size of the movie
+ int headerSize; // Size of the http header
+ int xtraData; // Amout of movie data recv'd from the http header recv
+ int64_t totalRead; // Position in file
+ CircleBuffer_t cBuffer;
+ int cbSize; // Circular buffer size
+
+} DuckHttp_t;
+
+
+
+/* Returns size of movie as parsed from the http header */
+int64_t duck_content_len(void* handle)
+{
+ DuckHttp_t* httpObj = (DuckHttp_t *) handle;
+
+ if (httpObj == 0)
+ return -1;
+
+ return httpObj->contentLen;
+}
+
+
+
+void* duck_get_buffer(void *handle)
+{
+ DuckHttp_t* httpObj = (DuckHttp_t *) handle;
+
+ return (void *) &httpObj->cBuffer;
+}
+
+
+
+/* Checks to see if any errors occured in recv */
+int isDataAvailable(int bytesReceived)
+{
+ (void ) bytesReceived; // for warning supression
+
+ #ifdef WIN32
+ if (WSAGetLastError() == 10035) // No data is available right now, try again later
+ return 0;
+ #else
+
+ int x = errno;
+
+ if(x == EAGAIN)
+ {
+ return 0;
+ }
+ else if (x == 0)
+ {
+ assert(bytesReceived != -1);
+ return 1;
+ }
+ else
+ {
+ assert(0);
+ }
+ #endif
+
+ return 1;
+}
+
+/* Sets an error code and message */
+static int SetError(DuckHttp_t* httpObj, SAL_ERR code, const char* appendMsg)
+{
+ const char* decode = SalErrText(code);
+ if (decode)
+ {
+ httpObj->errorString.str("");
+ httpObj->errorString << decode;
+ httpObj->lastErrorCode = code;
+ if (appendMsg)
+ httpObj->errorString << " : " << appendMsg;
+ return code;
+ }
+
+ return SAL_ERROR; // Default error
+}
+
+
+static int64_t http_atoi(const char* str)
+{
+ int64_t temp = 0;
+ size_t len = 0;
+
+ while(str[len] >= '0' && str[len] <= '9')
+ len++;
+
+ for(size_t i = 0; i < len; i++)
+ temp = temp * 10 + (str[i] - '0');
+
+ return temp;
+}
+
+
+
+
+/* Parses url for a parameter */
+inline bool get_url_parameter(const std::string url, std::string& parameter)
+{
+
+ std::string temp = url;
+ size_t strPos;
+
+ strPos = temp.find(parameter.c_str());
+
+ if (strPos == std::string::npos)
+ {
+ return false;
+ }
+ else
+ {
+ temp = temp.substr(strPos + parameter.length() + 1);
+
+ size_t i = 0;
+
+ for(i = 0; i < temp.length(); i++)
+ {
+ if (temp[i] == '&')
+ temp[i] = '\0';
+ }
+
+ parameter = temp.c_str();
+
+ return true;
+ }
+
+}
+
+
+#if !defined(__cplusplus)
+#error
+#endif
+
+char* duck_init_http(char *url)
+{
+ std::string strTime = "timeout";
+ std::string strBuff = "buffer";
+
+ DuckHttp_t* httpObj = new (DuckHttp_t);
+ assert(httpObj);
+
+ httpObj->scheme = MAKE_FOUR_CC('h','t','t','p');
+
+ httpObj->urlExtended = url;
+
+ if (get_url_parameter(url, strTime))
+ sscanf(strTime.c_str(),"%d", &httpObj->timeOut);
+ else
+ httpObj->timeOut = INT_MAX; // Wait "forever" is default
+
+ if (get_url_parameter(url, strBuff))
+ {
+ sscanf(strBuff.c_str(), "%d", &httpObj->cbSize);
+ // Convert kilobytes into bytes
+ httpObj->cbSize *= 1024;
+ }
+ else
+ httpObj->cbSize = DEFAULT_CBSIZE;
+
+ for(size_t i = 0; i < strlen(url); i++)
+ {
+ if (url[i] == '?')
+ url[i] = '\0';
+ }
+
+ httpObj->url = url;
+ httpObj->contentLen = 0;
+
+#ifdef _WIN32
+
+ WSADATA wsaData;
+ if (WSAStartup(MAKEWORD(2,2), &wsaData))
+ {
+ std::ostringstream temp;
+ temp << " : " << WSAGetLastError();
+ SetError(httpObj,SAL_ERR_WSASTARTUP,temp.str().c_str());
+ return 0;
+ }
+#endif
+
+ return (char *) httpObj;
+}
+
+
+
+
+
+
+/* Might need to reduce timeout after initial buffering */
+/*------------------------------------------------------*/
+void duck_http_timeout(int handle, unsigned long milliseconds)
+{
+ DuckHttp_t* httpObj = (DuckHttp_t *) handle;
+ httpObj->timeOut = milliseconds;
+}
+
+
+
+
+
+int DECORATE(duck_open)(const char* src, unsigned long userData)
+{
+
+ struct sockaddr_in sa_in;
+ struct sockaddr* const psa = (struct sockaddr*)&sa_in;
+ struct hostent* host;
+ std::ostringstream buf1;
+ unsigned short port = 0;
+ int input;
+ char* endOfHttpHeader = "\r\n\r\n";
+ char* strContentLen = "Content-Length: ";
+ char* strPos;
+ on2Timer start;
+ (void) userData;
+ unsigned long block = 1;
+ DuckHttp_t* httpObj;
+
+ ReOpen_t* reOpenData = (ReOpen_t*) userData;
+
+ if(reOpenData == 0 || reOpenData->blocking || reOpenData->offset == 0)
+ httpObj = (DuckHttp_t *) duck_init_http((char *) src);
+ else
+ httpObj = (DuckHttp_t *) src;
+
+
+ if(!reOpenData) // if we're not doing a re-open
+ httpObj->totalRead = 0;
+ else
+ httpObj->totalRead = reOpenData->offset;
+
+
+ std::stringbuf path;
+ std::stringbuf server;
+ std::istringstream is(httpObj->url);
+
+ is.ignore(strlen("http://"), '\0');
+
+ // Check if a port is specified
+ for(size_t i = strlen("http://"); i < httpObj->url.length(); i++)
+ {
+ if(httpObj->url[i] == ':')
+ {
+ port = 1;
+ break;
+ } else if(httpObj->url[i] == '/') break;
+ }
+
+ if(port)
+ {
+ std::stringbuf strPort;
+
+ is.get(server,':');/* get the server */
+ is.ignore(1, '\0');
+ is.get(strPort, '/');
+ port = (unsigned short)http_atoi(strPort.str().c_str());
+ }
+ else
+ {
+ is.get(server,'/');/* get the server */
+
+ port = 80; // default http port
+ }
+
+ assert(server.str().length() > 0);
+
+ is.ignore(1, '\0'); /* get the path */
+ is.get(path, '\0');
+
+ /* Wrap up the send message */
+ buf1 << "GET " << "/" << path.str() << " HTTP/1.1 " << "\r\n";
+ buf1 << "Host:" << server.str().c_str() << "\r\n" ;
+
+ if (reOpenData)
+ {
+ char number[64];
+ sprintf(number, i64Fmt, reOpenData->offset);
+ buf1 << "Range: bytes=" << number << "-" ;
+ buf1 << " \r\n" ;
+ }
+ buf1 << "\r\n";
+
+ if ((httpObj->socket = socket(AF_INET, SOCK_STREAM, 0)) == -1)
+ {
+ fprintf(stderr, "duck_open: SAL_ERR_SOCKET_CREATE\n");
+ SetError(httpObj,SAL_ERR_SOCKET_CREATE, 0);
+ duck_exit_http((int)httpObj);
+ return SAL_ERR_SOCKET_CREATE;
+ }
+
+ sa_in.sin_family = AF_INET;
+ sa_in.sin_port = htons(port);
+
+ if (!(host = gethostbyname(server.str().c_str())))
+ {
+ fprintf(stderr, "duck_open: SAL_ERR_RESOLVING_HOSTNAME\n");
+ SetError(httpObj,SAL_ERR_RESOLVING_HOSTNAME,0);
+ duck_exit_http((int)httpObj);
+ return SAL_ERR_RESOLVING_HOSTNAME;
+ }
+
+ duck_memcpy(&sa_in.sin_addr, host->h_addr_list[0], sizeof(struct in_addr));
+
+ if (connect(httpObj->socket, psa, sizeof(sa_in) ) != 0)
+ {
+ fprintf(stderr, "duck_open: SAL_ERR_SERVER_CONNECTION\n");
+ SetError(httpObj,SAL_ERR_SERVER_CONNECTION,0);
+ duck_exit_http((int)httpObj);
+ return SAL_ERR_SERVER_CONNECTION;
+ }
+
+ /* connected */
+
+ if (send(httpObj->socket, buf1.str().c_str(), strlen(buf1.str().c_str()), 0) < 0)
+ {
+ fprintf(stderr, "duck_open: SAL_ERR_SENDING_DATA\n");
+ SetError(httpObj,SAL_ERR_SENDING_DATA,0);
+ duck_exit_http((int)httpObj);
+ return SAL_ERR_SENDING_DATA;
+ }
+
+
+ on2Timer_Init(&start);
+ on2Timer_Start(&start);
+
+ duck_memset(httpObj->httpHeader, 0, sizeof(httpObj->httpHeader));
+
+ /* Get the HTTP header EMH 2-14-03 */
+ /* Assuming we get all the header info in the 1st good recv */
+ do
+ {
+ unsigned long delta = on2Timer_GetCurrentElapsedMilli(&start);
+
+ if (delta > httpObj->timeOut)
+ {
+ return SetError(httpObj,SAL_ERR_CONNECTION_TIMEOUT,0);
+ }
+
+ input = recv(httpObj->socket, httpObj->httpHeader, sizeof(httpObj->httpHeader), 0);
+ } while (!strstr(httpObj->httpHeader, endOfHttpHeader));
+
+#ifdef _WIN32
+ ioctlsocket(httpObj->socket, FIONBIO, &block); /* Set the socket to non-blocking */
+#else
+ if (ioctl(httpObj->socket, FIONBIO, &block)) /* Set the socket to non-blocking */
+ {
+ assert(0);
+ }
+#endif
+
+ strPos = strstr(httpObj->httpHeader, endOfHttpHeader);
+
+ strPos += strlen(endOfHttpHeader);
+
+ httpObj->headerSize = (int)strPos - (int)httpObj->httpHeader;
+
+ httpObj->xtraData = input - httpObj->headerSize; // Amount of GOOD data grabbed with the HTTP header
+
+ if (strstr(httpObj->httpHeader, "404") && strstr(httpObj->httpHeader, "Not Found"))
+ {
+ fprintf(stderr, "duck_open: SAL_ERR_404_FILE_NOT_FOUND\n");
+ SetError(httpObj,SAL_ERR_404_FILE_NOT_FOUND,0);
+ duck_exit_http((int)httpObj);
+ return SAL_ERR_404_FILE_NOT_FOUND;
+ }
+
+ strPos = strstr(httpObj->httpHeader, strContentLen);
+
+ if (!strPos)
+ {
+ fprintf(stderr, "duck_open: SAL_ERR_PARSING_HTTP_HEADER\n");
+ SetError(httpObj,SAL_ERR_PARSING_HTTP_HEADER,0);
+ duck_exit_http((int)httpObj);
+ return SAL_ERR_PARSING_HTTP_HEADER;
+ }
+
+ strPos += strlen(strContentLen);
+
+ if((*strPos >= '0') && (*strPos <= '9'))
+ {
+ httpObj->contentLen = http_atoi(strPos);
+ }
+ else
+ {
+ fprintf(stderr, "duck_open: SAL_ERR_PARSING_CONTENT_LEN\n");
+ SetError(httpObj,SAL_ERR_PARSING_CONTENT_LEN,0);
+ duck_exit_http((int)httpObj);
+ return SAL_ERR_PARSING_CONTENT_LEN;
+ }
+
+
+ int rv;
+
+ rv = initCircleBuffer(&httpObj->cBuffer, httpObj->cbSize, 75,
+ httpObj->cbSize/4, /* max chunk */ 0, 0);
+
+ if (rv < 0)
+ assert(0);
+
+ addToCircleBuffer(&httpObj->cBuffer,
+ httpObj->httpHeader + httpObj->headerSize,
+ (size_t) httpObj->xtraData);
+
+ bool blocking = true;
+/*
+ // Block only if we're not doing a re-open
+ userData ? blocking = false : blocking = true;
+*/
+ if(reOpenData)
+ blocking = (reOpenData->blocking != 0);
+
+ if (duck_sal_fill((void *) httpObj, blocking, 0) < 0)
+ {
+ fprintf(stderr, "duck_open: SAL_ERR_RECEIVING_DATA\n");
+ duck_close_http((int)httpObj);
+ return -1;
+ }
+
+ return (int) httpObj;
+}
+
+
+
+
+void DECORATE(duck_close)(int handle)
+{
+ DuckHttp_t* httpObj = (DuckHttp_t *) handle;
+
+#if defined(_WIN32)
+ closesocket(httpObj->socket); // Close the old socket
+#else
+ close(httpObj->socket);
+#endif
+ destroyCircleBuffer(&httpObj->cBuffer);
+
+ duck_exit_http(handle);
+}
+
+
+
+
+
+void duck_exit_http(int handle)
+{
+ DuckHttp_t* httpObj = (DuckHttp_t *) handle;
+
+ //delete httpObj->cBuffer;
+ delete httpObj;
+
+#ifdef _WIN32
+ WSACleanup();
+#endif
+}
+
+
+
+
+/* Read data off of the socket directly into the circular buffer */
+inline int recv_circular (void* handle, size_t maxBytes)
+{
+ DuckHttp_t* httpObj = (DuckHttp_t *) handle;
+ int bytesRead = 0;
+ int totalRead = 0;
+
+
+ size_t tail = (httpObj->cBuffer.head + httpObj->cBuffer.count) % httpObj->cBuffer.bufSize;
+ size_t head = httpObj->cBuffer.head;
+ size_t freeSpace = httpObj->cBuffer.bufSize - httpObj->cBuffer.count;
+ size_t endSpace = httpObj->cBuffer.bufSize - tail;
+ size_t least;
+
+ if (tail >= head && maxBytes > endSpace) /* additional data write will wrap */
+ {
+ /* try to fill to end of buffer */
+ bytesRead = recv(httpObj->socket, (char*)httpObj->cBuffer.buffer + tail, (int)endSpace, 0);
+
+ if (bytesRead < 0)
+ {
+ if (isDataAvailable((int)bytesRead) == 0)
+ return 0; // Try again later...
+ else
+ return (int)bytesRead; // Error
+ }
+
+ totalRead += bytesRead;
+ httpObj->cBuffer.count += bytesRead;
+ maxBytes -= bytesRead;
+
+ freeSpace = httpObj->cBuffer.bufSize - httpObj->cBuffer.count;
+
+ if((size_t)bytesRead < maxBytes && (size_t)bytesRead == endSpace) /* filled to end and more to read */
+ {
+ httpObj->cBuffer.wrapped = 1;
+ least = (maxBytes < freeSpace) ? maxBytes : freeSpace;
+ bytesRead = recv(httpObj->socket, (char *)httpObj->cBuffer.buffer, (int)least, 0);
+
+ if (bytesRead < 0)
+ {
+ if (isDataAvailable((int)bytesRead) == 0)
+ return 0; // Try again later...
+ else
+ return (int)bytesRead; // Error
+ }
+
+ totalRead += bytesRead;
+ httpObj->cBuffer.count += bytesRead;
+ }
+ }
+ else /* existing data wrapped around from end of buffer through beginning of buffer. */
+ {
+ if (tail < head)
+ httpObj->cBuffer.wrapped = 1;
+ least = (maxBytes < freeSpace) ? maxBytes : freeSpace;
+ bytesRead = recv(httpObj->socket, (char*)httpObj->cBuffer.buffer + tail, (int)least, 0);
+
+ if (bytesRead < 0)
+ {
+ if (isDataAvailable((int)bytesRead) == 0)
+ return 0; // Try again later...
+ else
+ return (int)bytesRead; // Error
+ }
+
+ totalRead += bytesRead;
+ httpObj->cBuffer.count += bytesRead;
+ }
+ return (int)totalRead;
+}
+
+
+
+
+
+/* Re-charge the circular buffer */
+int duck_sal_fill(void * handle, bool blocking, size_t maxFill)
+{
+ DuckHttp_t* httpObj = (DuckHttp_t *) handle;
+ on2Timer start;
+ int bytesRead = 0;
+ int totalRead = 0;
+
+ int fillLevel = httpObj->cBuffer.bufSize * httpObj->cBuffer.percent / 100;
+ int fillSpace = fillLevel - httpObj->cBuffer.count;
+
+ if(maxFill)
+ {
+ // Charge twice as much as was read
+ maxFill *=2;
+ // Take the lesser of the two
+ fillSpace = ((int)maxFill < fillSpace) ? maxFill : fillSpace;
+ }
+
+ on2Timer_Init ( &start );
+ on2Timer_Start ( &start );
+
+ while ((httpObj->cBuffer.count < (size_t)fillLevel) && ((int)httpObj->cBuffer.count < httpObj->contentLen))
+ {
+ unsigned long delta = on2Timer_GetCurrentElapsedMilli(&start);
+
+ if (delta > httpObj->timeOut)
+ {
+ std::ostringstream temp;
+ temp << "Bytes received = " << totalRead;
+ //return -1;
+ return SetError(httpObj, SAL_ERR_CONNECTION_TIMEOUT, temp.str().c_str());
+ }
+ bytesRead = recv_circular(handle, fillSpace);
+
+
+ #if defined(__APPLE__) || defined(__POWERPC__)
+ if (bytesRead == 0 && blocking) /* please give some time to the SOCKET thread / OS . */
+ usleep(1000*2);
+ #endif
+
+ if (bytesRead < 0)
+ {
+ std::ostringstream temp;
+ temp << " : WSAGetLastError = " << WSAGetLastError();
+ SetError(httpObj,SAL_ERR_SERVER_CONNECTION,temp.str().c_str());
+ return bytesRead;
+ }
+
+ totalRead += bytesRead;
+
+ if (blocking == 0) /* we only want one recv done */
+ return totalRead;
+
+ }
+ return totalRead;
+}
+
+
+
+
+
+int DECORATE(duck_read)(int handle,unsigned char *buffer, int bytes)
+{
+ DuckHttp_t* httpObj = (DuckHttp_t *) handle;
+ int input;
+
+ if (bytes < 0)
+ return -1;
+
+ assert(httpObj);
+ assert(buffer);
+
+ input = readFromCircleBuffer(&httpObj->cBuffer, buffer, bytes);
+
+ if (input >= 1)
+ {
+ httpObj->totalRead += input;
+ }
+
+ bool blocking = false;
+
+ if (duck_sal_fill((void *)handle, blocking, bytes) < 0)
+ {
+ return -1; // The socket probably disconnected
+ }
+
+ return input;
+}
+
+
+
+
+
+
+int DECORATE(duck_read_blocking)(int handle,unsigned char *buffer, int bytes)
+{
+ DuckHttp_t* httpObj = (DuckHttp_t *) handle;
+ int input;
+ int amountRead = 0;
+
+ if (bytes < 0)
+ return -1;
+
+ assert(httpObj);
+ assert(buffer);
+
+ while (amountRead < bytes)
+ {
+ input = readFromCircleBuffer(
+ &httpObj->cBuffer,
+ buffer + amountRead,
+ bytes - amountRead);
+
+ if (input < 0)
+ return input;
+ else
+ {
+ amountRead += input;
+ httpObj->totalRead += input;
+ }
+
+ bool blocking = false;
+
+ if (duck_sal_fill((void *)handle, blocking, bytes) < 0)
+ {
+ return -1; // The socket probably disconnected
+ }
+ }
+ return amountRead;
+}
+
+
+
+
+
+
+int64_t DECORATE(duck_seek)(int handle, int64_t offset,int origin)
+{
+ DuckHttp_t* httpObj = (DuckHttp_t *) handle;
+
+ //printf("seeking to offset = %ld, origin = %ld\n", offset, origin);
+
+
+
+ if (offset < 0)
+ {
+ fprintf(stderr, "Trying to seek backwards with offset = %d\n", offset);
+ assert(0);
+ }
+
+ if (origin == SEEK_END)
+ {
+ fprintf(stderr, "SEEK_END is not supported\n", offset);
+ assert(0);
+ }
+
+
+ if (origin == SEEK_SET)
+ {
+ if ( offset > httpObj->totalRead &&
+ ForwardBuffer(&httpObj->cBuffer, (offset - httpObj->totalRead)) == 0
+ ) /* forward small jump */
+ {
+ // We've eaten away at the buffer so re-charge it.
+ duck_sal_fill((void *)handle, false, (int)(offset - httpObj->totalRead));
+ httpObj->totalRead = offset;
+ return httpObj->totalRead;
+ }
+
+ else if ( offset < httpObj->totalRead &&
+ RewindBuffer(&httpObj->cBuffer, (httpObj->totalRead - offset)) == 0
+ ) /* backwards small jump */
+ {
+ httpObj->totalRead = offset;
+ return httpObj->totalRead;
+ }
+
+ else
+ httpObj->totalRead = offset;
+ }
+
+
+ if (origin == SEEK_CUR)
+ {
+ if (!offset) // They just want the current pos
+ return httpObj->totalRead;
+
+ httpObj->totalRead += offset;
+
+ if(ForwardBuffer(&httpObj->cBuffer, offset) == 0)
+ {
+ duck_sal_fill((void *)handle, false, (size_t)offset); // We've eaten away at the buffer so re-charge it.
+ return httpObj->totalRead;
+ }
+
+ }
+
+#if defined(_WIN32)
+ closesocket(httpObj->socket); // Close the old socket
+#else
+ close(httpObj->socket);
+#endif
+
+ destroyCircleBuffer(&httpObj->cBuffer);
+
+ ReOpen_t openData;
+ openData.offset = httpObj->totalRead;
+ openData.blocking = 0;
+
+ // Reconnect to http server
+ if( duck_open_http((char* )handle, (unsigned long)&openData) < 0)
+ {
+ char err[256];
+ SAL_ERR errCode;
+ duck_sal_error_http((void*)handle, &errCode, err, sizeof(err));
+ assert(0);
+ return -1;
+ }
+ return httpObj->totalRead;
+
+}
+
+
+
+
+
+
+int64_t duck_tell(int handle)
+{
+ DuckHttp_t* httpObj = (DuckHttp_t *) handle;
+
+ return httpObj->totalRead;
+}
+
+
+
+
+
+/* Return the amount of data in the circular buffer */
+int duck_sal_buff_percent(void* handle)
+{
+ DuckHttp_t* httpObj = (DuckHttp_t *) handle;
+ return 100 * httpObj->cBuffer.count / httpObj->cBuffer.bufSize;
+}
+
+
+int64_t DECORATE(duck_available_data)(int handle)
+{
+ DuckHttp_t* httpObj = (DuckHttp_t *) handle;
+ return httpObj->cBuffer.count;
+}
+
+
+
+/* Checks the last error */
+int DECORATE(duck_sal_error)(void* handle, SAL_ERR* lastErrorCode, char buffer[], size_t maxLen)
+{
+ DuckHttp_t* httpObj = (DuckHttp_t *) handle;
+
+ *lastErrorCode = httpObj->lastErrorCode;
+
+ if (httpObj->errorString.str().length() <= maxLen)
+ {
+ strcpy(buffer, httpObj->errorString.str().c_str());
+ return 0;
+ }
+ else
+ return -1;
+
+}
+
+int DECORATE(duck_name)(int handle, char url[], size_t maxLen)
+{
+ DuckHttp_t* httpObj = (DuckHttp_t *) handle;
+
+ if (httpObj->urlExtended.length() <= maxLen)
+ strcpy(url, httpObj->urlExtended.c_str());
+ else
+ return -1;
+
+ return 0;
+}
diff --git a/Src/libvp6/corelibs/sal/generic/on2_timer.c b/Src/libvp6/corelibs/sal/generic/on2_timer.c
new file mode 100644
index 00000000..66a1c834
--- /dev/null
+++ b/Src/libvp6/corelibs/sal/generic/on2_timer.c
@@ -0,0 +1,110 @@
+#include "on2_timer.h"
+
+#if defined(WIN32)
+#include <windows.h>
+#include <mmsystem.h>
+#else
+#include <sys/time.h>
+#endif
+
+#if defined( WIN32 )
+const unsigned long MAX_BEFORE_ROLLOVER = (1000 * 60 * 60 * 24);
+#else
+const unsigned long MAX_BEFORE_ROLLOVER = 0xFFFFFFFF;
+#endif
+
+// full day in milliseconds
+const unsigned long kDuckFullDayMilli = 86400000;
+
+
+void
+on2Timer_Init ( on2Timer* pTimer )
+{
+ pTimer->elapsedMilli = 0;
+ pTimer->baseMilli = 0;
+}
+
+/* The DeInit function was in danger of trying to free statically allocated timers goofy */
+
+
+unsigned long
+on2Timer_Start ( on2Timer* pTimer )
+{
+ pTimer->baseMilli = on2Timer_GetCurrentTimeMilli();
+ pTimer->elapsedMilli = 0;
+ return pTimer->baseMilli;
+}
+
+unsigned long
+on2Timer_Stop ( on2Timer* pTimer )
+{
+ unsigned long currentMilli = on2Timer_GetCurrentTimeMilli();
+
+ if(currentMilli >= pTimer->baseMilli)
+ {
+ pTimer->elapsedMilli = currentMilli - pTimer->baseMilli;
+ return pTimer->elapsedMilli;
+ }
+ // rollover condition, get milli before rollover, add to current milli
+ // I think if there is a rollover during timing on win32 this will cause a crash
+ // when the addition of currentMilli and rollMilli results in overflowing the size of
+ // and unsigned long int
+ else
+ {
+ unsigned long rollMilli = MAX_BEFORE_ROLLOVER - pTimer->baseMilli;
+ pTimer->elapsedMilli = currentMilli + rollMilli;
+ return pTimer->elapsedMilli;
+ }
+}
+
+
+unsigned long
+on2Timer_GetCurrentElapsedMilli ( on2Timer* pTimer )
+{
+ unsigned long currentMilli = on2Timer_GetCurrentTimeMilli();
+
+ if(currentMilli >= pTimer->baseMilli)
+ {
+ return ( currentMilli - pTimer->baseMilli );
+ }
+ // rollover condition, get milli before rollover, add to current milli
+ else
+ {
+ unsigned long rollMilli = MAX_BEFORE_ROLLOVER - pTimer->baseMilli;
+ return ( currentMilli + rollMilli );
+ }
+}
+
+unsigned long
+on2Timer_GetCurrentTimeSeconds ()
+{
+ unsigned long currentMilli = on2Timer_GetCurrentTimeMilli();
+ return currentMilli / 1000;
+}
+
+unsigned long
+on2Timer_GetCurrentTimeMilli ()
+{
+#if !defined(WIN32)
+ unsigned long currentMilli;
+ struct timeval tv;
+ struct timezone tz;
+ gettimeofday ( &tv, &tz );
+ currentMilli = (tv.tv_sec * 1000) + (tv.tv_usec/1000);
+ return currentMilli;
+#else
+ return timeGetTime();
+#endif
+
+}
+
+int
+on2Timer_Sleep( int msec )
+{
+#ifdef _WIN32
+ Sleep( msec );
+#endif
+
+ return 0;
+}
+
diff --git a/Src/libvp6/corelibs/sal/generic/on2_timer.h b/Src/libvp6/corelibs/sal/generic/on2_timer.h
new file mode 100644
index 00000000..0a62d667
--- /dev/null
+++ b/Src/libvp6/corelibs/sal/generic/on2_timer.h
@@ -0,0 +1,85 @@
+#ifndef _ON2_TIMER_H_
+#define _ON2_TIMER_H_
+
+/************************************************************************/
+/* on2Timer: cross-platform timer, works on win32 and linux so far */
+/* started: August 14, 2001 */
+/* codemonkey: TJF */
+/************************************************************************/
+
+#include <stdio.h>
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+
+typedef struct on2Timer_ {
+ unsigned long baseMilli;
+ unsigned long elapsedMilli;
+} on2Timer;
+
+
+
+
+/****************************************************************/
+/* void on2Timer_Init ( on2Timer* pTimer ) */
+/* initialize an allocated timer's members to 0 */
+/****************************************************************/
+void on2Timer_Init ( on2Timer* pTimer );
+
+/****************************************************************/
+/* unsigned long on2Timer_Start ( on2Timer* pTimer ) */
+/* start a timer: sets baseTime to currentTime in milliseconds */
+/****************************************************************/
+unsigned long on2Timer_Start ( on2Timer* pTimer );
+
+/****************************************************************/
+/* unsigned long on2Timer_Stop ( on2Timer* pTimer ) */
+/* stop a timer: sets elapsed time and accounts for rollover */
+/****************************************************************/
+unsigned long on2Timer_Stop ( on2Timer* pTimer );
+
+/********************************************************************************/
+/* unsigned long on2Timer_GetCurrentElapsedMilli ( on2Timer* pTimer ) */
+/* get current elapsed time: returns elapsed time and accounts for rollover */
+/********************************************************************************/
+unsigned long on2Timer_GetCurrentElapsedMilli ( on2Timer* pTimer );
+
+/********************************************************************************/
+/* unsigned long on2Timer_GetMilliBeforeRollover ( unsigned long baseMilli ) */
+/* returns milliseconds elapsed since rollover occurred */
+/********************************************************************************/
+unsigned long on2Timer_GetMilliBeforeRollover ( unsigned long baseMilli );
+
+/****************************************************************/
+/* unsigned long on2Timer_GetCurrentTimeSeconds ( void ) */
+/* returns seconds since midnight */
+/****************************************************************/
+unsigned long on2Timer_GetCurrentTimeSeconds ( void );
+
+/****************************************************************/
+/* unsigned long on2Timer_GetCurrentTimeMilli ( void ) */
+/* returns milliseconds since midnight */
+/****************************************************************/
+unsigned long on2Timer_GetCurrentTimeMilli ( void );
+
+/****************************************************************/
+/* void on2Timer_DeInit ( on2Timer* pTimer ); */
+/* on2_free's a pointer to a on2Timer struct, for the lazy ;-) */
+/****************************************************************/
+void on2Timer_DeInit ( on2Timer* pTimer );
+
+/****************************************************************/
+/* void on2Timer_Sleep ( int msec ); */
+/* Sleeps for the passed in number of milliseconds */
+/****************************************************************/
+int on2Timer_Sleep( int msec );
+
+
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* #ifndef _ON2_TIMER_H_ */
diff --git a/Src/libvp6/corelibs/sal/sal.vcproj b/Src/libvp6/corelibs/sal/sal.vcproj
new file mode 100644
index 00000000..89468559
--- /dev/null
+++ b/Src/libvp6/corelibs/sal/sal.vcproj
@@ -0,0 +1,228 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="sal"
+ ProjectGUID="{7C45701D-CD78-4C6A-A551-C62952E163A6}"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="..\include,..\..\include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ PrecompiledHeaderFile=".\..\..\..\ObjectCode\sal\Release/sal.pch"
+ AssemblerListingLocation="..\..\..\ObjectCode\sal\Release/"
+ ObjectFile="..\..\..\ObjectCode\sal\Release/"
+ ProgramDataBaseFileName="..\..\..\ObjectCode\sal\Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="4"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\include,..\..\include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ PrecompiledHeaderFile=".\..\..\..\ObjectCode\sal\debug/sal.pch"
+ AssemblerListingLocation="..\..\..\ObjectCode\sal\debug/"
+ ObjectFile="..\..\..\ObjectCode\sal\debug/"
+ ProgramDataBaseFileName="..\..\..\ObjectCode\sal\debug/"
+ WarningLevel="4"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ CompileAs="0"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="win32"
+ >
+ <File
+ RelativePath="win32\duck_io32.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="win32\duck_mem.c"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ BasicRuntimeChecks="3"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="generic"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/Src/libvp6/corelibs/sal/win32/duck_io.c b/Src/libvp6/corelibs/sal/win32/duck_io.c
new file mode 100644
index 00000000..2ce37546
--- /dev/null
+++ b/Src/libvp6/corelibs/sal/win32/duck_io.c
@@ -0,0 +1,106 @@
+/***********************************************\
+??? duck_io.c
+\***********************************************/
+
+#include <stdio.h>
+#include <string.h>
+#include <io.h>
+#include <fcntl.h>
+#include "duck_io.h"
+#include "duck_hfb.h"
+
+#include <assert.h>
+
+
+int read_count;
+
+
+int duck_readFinished(int han, int flag)
+{
+ return 1;
+}
+
+
+
+
+int duck_open(const char *name, unsigned long userData)
+{
+ int f;
+ FILE *fp;
+ unsigned long x;
+
+ read_count = 0;
+
+ fp = fopen(name, "rb");
+
+ if (!fp)
+ assert(0);
+
+ x = (unsigned long ) fp;
+
+ /* high bit is set, the cast is a bad idea ! */
+ if (x & 0x90000000)
+ assert(0);
+
+ f = (int ) x;
+
+ return f;
+
+}
+
+
+
+
+void duck_close(int handle)
+{
+ fclose((FILE *) handle);
+}
+
+
+
+static long totalRead = 0;
+static long tellNo = 0;
+long duck_read(int handle,unsigned char *buffer,long bytes)
+{
+ int x;
+
+
+ if (buffer == NULL){
+ duck_seek(handle,bytes,SEEK_CUR);
+ return bytes;
+ }
+
+ tellNo = ftell((FILE *) handle);
+
+ if (bytes == 0)
+ return 0;
+
+
+ x = fread(buffer,sizeof(char) ,bytes, (FILE *) handle);
+
+
+ if (feof((FILE *) handle) && (x != (int ) bytes))
+ return -1;
+
+
+ totalRead += x;
+
+ if (x == -1L)
+ assert(0);
+
+ return x ;
+}
+
+
+long duck_seek(int handle,long offset,int origin)
+{
+ long x = fseek((FILE *) handle,offset,origin);
+
+ tellNo = ftell((FILE *) handle);
+
+ return tellNo ;
+
+
+}
+
+
diff --git a/Src/libvp6/corelibs/sal/win32/duck_io32.c b/Src/libvp6/corelibs/sal/win32/duck_io32.c
new file mode 100644
index 00000000..b8b31260
--- /dev/null
+++ b/Src/libvp6/corelibs/sal/win32/duck_io32.c
@@ -0,0 +1,70 @@
+/***********************************************\
+??? duck_io.c
+\***********************************************/
+
+#include <stdio.h>
+#include <string.h>
+#include <io.h>
+#include <fcntl.h>
+#include <windows.h>
+
+#include "duck_io.h"
+
+int duck_open(const char *name, unsigned long userData)
+{
+ char filename[255];
+ (void) userData;
+
+ if(name[strlen(name)-4] != '.') { /*no extension, try .AVI */
+ sprintf(filename,"%s.AVI",name);
+ //f = open(filename,O_BINARY|O_RDONLY);
+ //return(f);
+ }else
+ strcpy(filename,name);
+ //return(open(filename,O_BINARY|O_RDONLY));
+ return (int)CreateFile(filename,GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_FLAG_NO_BUFFERING,NULL);
+}
+
+void duck_close(int handle)
+{
+ //close(handle);
+ CloseHandle((void *)handle);
+}
+
+long duck_read(int handle,unsigned char *buffer,long bytes)
+{
+ DWORD bytesRead;
+
+ if (buffer == NULL){
+ duck_seek(handle,bytes,SEEK_CUR);
+ return bytes;
+ }
+
+ ReadFile((void *)handle,buffer,bytes,&bytesRead,NULL);
+ //return(read(handle,buffer,bytes));
+
+
+ return bytesRead;
+}
+
+int64_t duck_seek(int handle,int64_t offset,int origin)
+{
+ //return(lseek(handle,offset,origin));
+ return(SetFilePointer((HANDLE) handle,(LONG)offset,NULL,origin));
+}
+
+int duck_readFinished(int han, int flag)
+{
+ (void)han; // not used;
+ (void)flag; // not used;
+ return 1;
+}
+
+void set_iofuncs()
+{
+
+// HFB_Setopen(duck_open);
+// HFB_Setclose(duck_close);
+// HFB_Setread(duck_read);
+// HFB_Setseek(duck_seek);
+}
diff --git a/Src/libvp6/corelibs/sal/win32/duck_mem.c b/Src/libvp6/corelibs/sal/win32/duck_mem.c
new file mode 100644
index 00000000..5a610a32
--- /dev/null
+++ b/Src/libvp6/corelibs/sal/win32/duck_mem.c
@@ -0,0 +1,132 @@
+/***********************************************\
+??? duck_mem.c
+\***********************************************/
+
+#pragma warning(disable:4786)
+
+
+#include <stdio.h>
+#include <string.h>
+#include <dos.h>
+#include <time.h>
+#include <malloc.h>
+#include "duck_mem.h"
+#include "duck_io.h"
+//#include "duck_hfb.h"
+#include "duck_dxl.h"
+
+//#define CHECK_MEM
+
+#ifdef CHECK_MEM
+#include <map>
+#include "debug.h"
+#endif
+
+#ifdef CHECK_MEM
+struct comp
+{
+ bool operator()(void* v1, void* v2) const
+ {
+ return v1 < v2;
+ }
+};
+#endif
+
+#ifdef CHECK_MEM
+std::map<void*, size_t, struct comp> pointers;
+int g_allocs = 0;
+int g_frees = 0;
+#endif
+
+void *duck_memmove( void *dst, const void *src, size_t length )
+{
+ return memmove(dst, src, length);
+}
+
+void *duck_malloc(size_t size, dmemType foo)
+{
+ void *temp = malloc(size);
+
+#ifdef CHECK_MEM
+ g_allocs++;
+ TRACE("a=%d\t%d\n", g_allocs, (int)temp);
+ pointers[temp] = size;
+#endif
+ return temp;
+}
+
+void *duck_memset( void *dest, int c, size_t count )
+{
+ return((void *) memset(dest, c, count));
+}
+
+void *duck_calloc(size_t n,size_t size, dmemType foo)
+{
+ void *temp = calloc(n, size);
+
+#ifdef CHECK_MEM
+ g_allocs++;
+ TRACE("a=%d\t%d\n", g_allocs, (int)temp);
+ pointers[temp] = size;
+#endif
+ return temp;
+}
+
+void duck_free(void *old_blk)
+{
+#ifdef CHECK_MEM
+ g_frees++;
+ TRACE("f=%d\t%d\n", g_frees, (int)old_blk);
+ if(!pointers.erase(old_blk))
+ assert(0);
+#endif
+ free(old_blk);
+}
+
+void* duck_realloc(void *src, size_t newSize, size_t oldSize)
+{
+ void *temp;
+ if(newSize <= oldSize)
+ return src;
+
+#ifdef CHECK_MEM
+ temp = duck_malloc(newSize, DMEM_GENERAL);
+ duck_memcpy(temp, src, oldSize);
+ duck_free(src);
+#else
+ temp = realloc(src, newSize);
+#endif
+ return temp;
+}
+
+void *duck_memcpy(void *dest, const void *source, size_t length)
+{
+ return memcpy(dest,source,length);
+}
+
+void *duck_memcpy64(void *dest, const void *source, int64_t length)
+{
+ /* Not fully 64 bit compliant */
+ return memcpy(dest,source,(size_t)length);
+}
+
+
+int duck_strcmp(const char *one, const char *two)
+{
+ return strcmp(one, two);
+}
+
+void set_memfuncs()
+{
+#if defined(DXV_DLL)
+ DXV_Setmalloc(malloc);
+ DXV_Setcalloc(calloc);
+ DXV_Setfree(free);
+#endif
+
+#if defined(HFB_DLL)
+ HFB_Setmalloc(malloc);
+ HFB_Setcalloc(calloc);
+ HFB_Setfree(free);
+#endif
+}
diff --git a/Src/libvp6/corelibs/sal/win32/duck_str.c b/Src/libvp6/corelibs/sal/win32/duck_str.c
new file mode 100644
index 00000000..934c6732
--- /dev/null
+++ b/Src/libvp6/corelibs/sal/win32/duck_str.c
@@ -0,0 +1,19 @@
+/***********************************************\
+??? duck_io.c
+\***********************************************/
+
+#include <stdio.h>
+#include <string.h>
+#include <io.h>
+#include <fcntl.h>
+#include <windows.h>
+
+#include "duck_io.h"
+#include "duck_hfb.h"
+
+int duck_strcmp(const char *s1, const char *s2)
+{
+ return strcmp(s1, s2);
+}
+
+
diff --git a/Src/libvp6/include/AC3.hpp b/Src/libvp6/include/AC3.hpp
new file mode 100644
index 00000000..60b24515
--- /dev/null
+++ b/Src/libvp6/include/AC3.hpp
@@ -0,0 +1,140 @@
+#ifndef AC3_HPP
+#define AC3_HPP
+//______________________________________________________________________________
+//
+// AC3.hpp
+//
+
+//______________________________________________________________________________
+//
+
+#pragma warning(disable:4786)
+
+#include <windows.h>
+#include <string>
+#include <vector>
+#include <exception>
+#include <iosfwd>
+#include <cstdio>
+extern "C"
+{
+ #include "ac3.h"
+ #include "bitstream.h"
+}
+
+namespace AC3
+{
+
+//______________________________________________________________________________
+//
+
+ typedef __int64 offset_t;
+
+ //--------------------------------------
+ enum
+ {
+ SamplesPerBlock = 256 * 6
+ };
+
+ //--------------------------------------
+ class FileError : public std::exception
+ {
+ public:
+ FileError(DWORD messageId);
+ FileError(const char* message);
+ const char* what() const;
+ private:
+ std::string m_strMessage;
+ };
+
+ //--------------------------------------
+ struct Header
+ {
+ unsigned long m_nBlocks;
+ unsigned long m_ulSamplesPerSecond;
+ unsigned long m_ulSamplesPerBlock;
+ unsigned long m_ulBytesPerBlock; // blockAlign
+ };
+
+ std::ostream& operator<<(std::ostream& os, const Header& h);
+
+ //--------------------------------------
+ struct SyncFrame
+ {
+ syncinfo_t m_si;
+ bsi_t m_bsi;
+ };
+
+ std::ostream& operator<<(std::ostream& os, const SyncFrame& sf);
+
+ //--------------------------------------
+ class File
+ {
+ public:
+
+ enum mode_t {in, out, inout};
+
+ typedef std::vector<SyncFrame> VectorSyncFrame;
+
+ File();
+ File(const char* szName, mode_t mode);
+
+ ~File();
+
+ void open(const char* szName, mode_t mode);
+ void close();
+
+ bool isOpen() const;
+ bool eof() const;
+
+ const char* name() const;
+ mode_t mode() const;
+
+ unsigned long blockCount() const;
+ unsigned long samplesPerSecond() const;
+ unsigned long samplesPerBlock() const;
+
+ int samplesPerSec() const;
+
+ const Header& header() const;
+
+// const SyncFrame& syncFrame(int nSyncFrame) const;
+// SyncFrame& syncFrame(int nSyncFrame);
+
+ private:
+
+ File(const File& rhs); // Not implemented
+ File& operator=(const File& rhs); // Not implemented
+
+ int readHeader();
+
+ void readSyncFrame(SyncFrame& sf);
+
+ void writeSyncFrame(const SyncFrame& sf);
+
+ void read(void* buffer, size_t size) const;
+ void write(const void* data, size_t size);
+
+ offset_t size() const;
+ void seekCurrent(__int64) const;
+ void seek(offset_t) const;
+ offset_t tell() const;
+
+
+ FILE* m_pFile;
+ int m_hFile;
+ bitstream_t* m_pbs;
+
+ std::string m_strName;
+ mode_t m_mode;
+
+ Header m_header;
+ VectorSyncFrame m_vSyncFrame;
+
+ __int64 m_fileSize;
+ __int64 m_fileOffset;
+ };
+
+} // namespace AC3
+
+#endif // AC3_HPP
diff --git a/Src/libvp6/include/ACM.hpp b/Src/libvp6/include/ACM.hpp
new file mode 100644
index 00000000..0bdb4feb
--- /dev/null
+++ b/Src/libvp6/include/ACM.hpp
@@ -0,0 +1,31 @@
+#ifndef ACM_HPP
+#define ACM_HPP
+
+#include <windows.h>
+#include <vfw.h>
+#include <string>
+#include <iosfwd>
+
+namespace ACM
+{
+ const std::string versionAsStr(DWORD version);
+ const std::string supportAsStr(DWORD support);
+
+ std::ostream& operator<<(std::ostream&, const ACMDRIVERDETAILS&);
+
+ std::ostream& operator<<(std::ostream&, const WAVEFORMATEX&);
+
+ const std::string mmresultAsStr(MMRESULT);
+
+ std::ostream& operator<<(
+ std::ostream&,
+ const ACMFORMATTAGDETAILS&);
+
+ std::ostream& operator<<(
+ std::ostream&,
+ const ACMFORMATDETAILS&);
+
+
+}
+
+#endif
diff --git a/Src/libvp6/include/AVC.hpp b/Src/libvp6/include/AVC.hpp
new file mode 100644
index 00000000..0496a4ee
--- /dev/null
+++ b/Src/libvp6/include/AVC.hpp
@@ -0,0 +1,29 @@
+#ifndef AVC_HPP
+#define AVC_HPP
+
+namespace AVC
+{
+ struct Extra
+ {
+ unsigned __int16 samplesPerBlock;
+ unsigned __int16 blocksPerChunk;
+ unsigned __int32 version;
+ unsigned __int32 datarate;
+ unsigned __int32 flags;
+ };
+
+ enum
+ {
+ kFormatTag_SingleBlockPerChunk = 0x0500,
+ kFormatTag_MultipleBlocksPerChunk = 0x0501
+ };
+
+ enum
+ {
+ kArchaicFlag = 1,
+ kFancyFlag = 2,
+ kLooseFlag = 4
+ };
+}
+
+#endif
diff --git a/Src/libvp6/include/AVI.hpp b/Src/libvp6/include/AVI.hpp
new file mode 100644
index 00000000..3860db89
--- /dev/null
+++ b/Src/libvp6/include/AVI.hpp
@@ -0,0 +1,984 @@
+//=====================================================================
+//
+// Copyright (c) 1999-2003 On2 Technologies Inc. All Rights Reserved.
+//
+//---------------------------------------------------------------------
+//
+// File: $Workfile: AVI.hpp$
+//
+// Date: $Date: 2010/07/23 19:10:47 $
+//
+// Revision: $Revision: 1.1 $
+//
+//---------------------------------------------------------------------
+
+#ifndef AVI_HPP
+#define AVI_HPP
+
+#pragma warning(disable:4786)
+
+#include "FourCC.hpp"
+#include <exception>
+#include <iosfwd>
+#include <list>
+#include <deque>
+#include <string>
+#include <vector>
+
+#if defined WIN32
+#include <windows.h>
+#endif
+
+namespace AVI
+{
+#if defined WIN32
+ typedef unsigned __int64 size_type;
+ typedef DWORD dword;
+ typedef __int64 offset_t;
+ typedef unsigned __int32 length_t;
+#elif defined LINUX
+ typedef unsigned long long size_type;
+ typedef unsigned long dword;
+ typedef long long offset_t;
+ typedef unsigned int length_t;
+#endif
+
+ int asStreamId(const FourCC&);
+
+ enum ChunkType
+ {
+ waveform,
+ waveform_encrypted,
+ DIB_compressed,
+ DIB_uncompressed,
+ DIB_encrypted,
+ kChunkTypeUnknown
+ };
+
+ ChunkType asChunkType(const FourCC&);
+
+ const FourCC asChunkId(int stream, ChunkType type);
+ const FourCC asIndexChunkExId(int stream);
+
+ size_type estimatedFileSize(
+ int width,
+ int height,
+ int frameCount);
+
+ const std::string offtoa(offset_t);
+
+ class FileError : public std::exception
+ {
+ public:
+ FileError(dword messageId);
+ FileError(const char* message);
+ ~FileError() throw();
+ const char* what() const throw();
+ dword id() const;
+ private:
+ std::string message;
+ dword m_id;
+ };
+
+
+
+ struct MainHeader
+ {
+ enum Flag
+ {
+ hasIndex = 0x00000010,
+ mustUseIndex = 0x00000020,
+ isInterleaved = 0x00000100,
+ indexIsAbsolute = 0x00000800, //? "trust cktype"
+ wasCaptureFile = 0x00010000,
+ copyrighted = 0x00020000
+ };
+
+ dword microSecPerFrame;
+ dword maxBytesPerSec;
+ dword paddingGranularity;
+ dword flags;
+ dword totalFrames;
+ dword initialFrames;
+ dword streams;
+ dword suggestedBufferSize;
+ dword width;
+ dword height;
+ dword reserved[4];
+
+ const std::string flagsAsStr() const;
+ };
+
+ std::ostream& operator<<(std::ostream&, const MainHeader&);
+
+
+ class Chunk
+ {
+ public:
+
+ Chunk(const FourCC, length_t, const unsigned char* data = 0);
+
+ const FourCC fcc() const;
+
+ length_t length() const;
+
+ const unsigned char* data() const;
+ unsigned char* data();
+
+ void data(const unsigned char* d);
+
+ private:
+ FourCC m_fcc;
+// length_t m_length;
+// unsigned char* m_data;
+
+ typedef std::vector<unsigned char> data_t;
+ data_t m_data;
+ };
+
+ std::ostream& operator<<(std::ostream& os, const Chunk&);
+
+ typedef std::vector<Chunk> ExtraHeaderVector;
+
+
+
+ struct Rectangle
+ {
+ typedef unsigned short T;
+
+ T left;
+ T top;
+ T right;
+ T bottom;
+
+ Rectangle()
+ : left(0), top(0), right(0), bottom(0)
+ {
+ }
+
+ Rectangle(T l, T t, T r, T b)
+ : left(l), top(t), right(r), bottom(b)
+ {
+ }
+ };
+
+
+ struct StreamHeader
+ {
+ enum Flag
+ {
+ disabled = 0x00000001,
+ formatChanges = 0x00010000
+ };
+
+ FourCC fccType;
+ FourCC fccHandler;
+ dword flags;
+ unsigned short priority;
+ unsigned short language;
+ dword initialFrames;
+ dword scale;
+ dword rate;
+ dword start;
+ dword length;
+ dword suggestedBufferSize;
+ long quality;
+ dword sampleSize;
+ Rectangle frame;
+
+ const std::string flagsAsStr() const;
+ };
+
+ std::ostream& operator<<(std::ostream&, const StreamHeader&);
+
+
+ struct BitmapInfoHeader
+ {
+ dword size;
+ long width;
+ long height;
+ unsigned short planes;
+ unsigned short bitCount;
+ FourCC compression;
+ dword sizeImage;
+ long xPelsPerMeter;
+ long yPelsPerMeter;
+ dword clrUsed;
+ dword clrImportant;
+ };
+
+ std::ostream& operator<<(std::ostream&, const BitmapInfoHeader&);
+
+
+// namespace Compression
+// {
+// enum CompressionType
+// {
+// RGB,
+// RLE8,
+// RLE4,
+// bitfields,
+// unknown
+// };
+//
+// bool operator==(CompressionType, const FourCC&);
+// bool operator==(const FourCC&, CompressionType);
+//
+// CompressionType asCompression(const FourCC&);
+// const FourCC asFourCC(CompressionType);
+//
+// std::ostream& operator<<(std::ostream&, CompressionType);
+// }
+
+
+ struct PCMWaveFormat
+ {
+ unsigned short formatTag;
+ unsigned short nChannels;
+ dword samplesPerSec;
+ dword avgBytesPerSec;
+ unsigned short blockAlign;
+ unsigned short bitsPerSample;
+ };
+
+ struct WaveFormatEx : public PCMWaveFormat
+ {
+ typedef std::vector<unsigned char> ByteArray;
+ ByteArray extra;
+ };
+
+ std::ostream& operator<<(std::ostream&, const WaveFormatEx&);
+
+
+
+
+ //not currently used; it's for palette changes,
+ //which isn't implemented yet
+ struct RGBQuad
+ {
+ unsigned char blue;
+ unsigned char green;
+ unsigned char red;
+ unsigned char reserved;
+ };
+
+
+ struct IndexEntry
+ {
+ enum Flags
+ {
+ list = 0x00000001,
+ keyframe = 0x00000010,
+ notime = 0x00000100,
+ compuse = 0x0FFF0000
+ };
+
+ FourCC chunkId;
+ dword flags;
+ dword chunkOffset;
+ dword chunkLength;
+
+ const std::string flagsAsStr() const;
+ };
+
+ std::ostream& operator<<(std::ostream&, const IndexEntry&);
+
+ typedef std::vector<IndexEntry> IEVector;
+
+
+ struct FrameIndexEntry
+ {
+ union
+ {
+ offset_t offset;
+
+ struct
+ {
+ unsigned long offset_low;
+ unsigned long offset_high;
+ };
+ };
+
+ size_t size;
+ bool keyframe;
+ };
+
+ typedef std::vector<FrameIndexEntry> FrameIEVector;
+ typedef std::list<FrameIndexEntry> FrameIEList;
+
+ typedef std::deque<FrameIndexEntry> FrameIndex;
+
+
+ struct IndexChunkEx
+ {
+ FourCC code;
+ unsigned long length;
+ unsigned short longsPerEntry;
+ unsigned char subtype;
+ unsigned char type;
+ unsigned long entriesInUse;
+ FourCC chunkId;
+ unsigned long reserved[3];
+ };
+
+ std::ostream& operator<<(std::ostream&, const IndexChunkEx&);
+
+
+ struct StandardIndexChunk
+ {
+ FourCC code;
+ unsigned long length;
+ unsigned short longsPerEntry;
+ unsigned char subtype;
+ unsigned char type;
+ unsigned long entriesInUse;
+ FourCC chunkId;
+ unsigned long baseOffset_low;
+ unsigned long baseOffset_high;
+ unsigned long reserved;
+
+ struct Entry
+ {
+ unsigned long offset;
+ unsigned long size;
+ } index[1];
+ };
+
+ std::ostream& operator<<(std::ostream&, const StandardIndexChunk&);
+ std::ostream& operator<<(std::ostream&, const StandardIndexChunk::Entry&);
+
+
+ struct SuperIndexChunk
+ {
+ FourCC code;
+ unsigned long length;
+ unsigned short longsPerEntry;
+ unsigned char subtype;
+ unsigned char type;
+ unsigned long entriesInUse;
+ FourCC chunkId;
+ unsigned long reserved[3];
+
+ struct Entry
+ {
+ offset_t offset;
+ unsigned long size;
+ unsigned long duration;
+ } index[1];
+ };
+
+ std::ostream& operator<<(std::ostream&, const SuperIndexChunk&);
+ std::ostream& operator<<(std::ostream&, const SuperIndexChunk::Entry&);
+
+
+ class File
+ {
+ public:
+
+ enum mode_t {in, out, inout};
+
+ enum OutputType
+ {
+ OT_AVI,
+ OT_On2
+ };
+
+ File();
+ File(const char* name, mode_t mode);
+
+ ~File();
+
+ void open(const char* name, mode_t mode, dword flags = 0);
+ void outputType(OutputType ot);
+
+ void close();
+
+ bool isOpen() const;
+ mode_t mode() const;
+ const char* name() const;
+
+ void mapinit();
+ void mapfinal();
+
+ unsigned long map(
+ offset_t offset,
+ length_t size,
+ unsigned char*& base,
+ length_t& baseSize,
+ length_t& offsetInView) const;
+
+ void unmap(unsigned char* base, length_t size) const;
+
+ const MainHeader& mainHeader() const;
+ MainHeader& mainHeader();
+
+ int extraHeaderCount() const;
+ const Chunk& extraHeader(int nChunk) const;
+
+ void extraHeader(FourCC fcc, length_t length, unsigned char* data);
+ void extraHeader(int nStream, FourCC fcc, length_t length, unsigned char* data);
+
+ dword totalFrames() const;
+ dword& totalFrames();
+
+ int streamCount() const;
+
+ int makeStreamHeaderVideo(int superIndexEntryCount = 0);
+ int makeStreamHeaderAudio(int superIndexEntryCount = 0);
+
+ const StreamHeader& streamHeader(int stream) const;
+ StreamHeader& streamHeader(int stream);
+
+ const unsigned char* strf(int nStream) const;
+ size_t strfSize(int nStream) const;
+
+ const BitmapInfoHeader& videoFormat(int stream) const;
+ BitmapInfoHeader& videoFormat(int stream);
+
+ const WaveFormatEx& audioFormat(int stream) const;
+ WaveFormatEx& audioFormat(int stream);
+
+ dword streamDataSize(int stream) const;
+ const unsigned char* streamData(int stream) const;
+ void setStreamData(int nStream, dword sds, const unsigned char* psd);
+
+ const char* streamName(int stream) const;
+ void setStreamName(int nStream, const char* psn);
+
+ SuperIndexChunk& superIndexChunk(int stream);
+ const SuperIndexChunk& superIndexChunk(int stream) const;
+
+ int superIndexEntryCount(int stream) const;
+
+ offset_t tell() const;
+
+ void seek(offset_t) const;
+
+ void seekCurrent(offset_t) const;
+
+ offset_t dataOffset() const;
+
+ offset_t idx1Offset() const;
+ length_t idx1Size() const;
+
+ void rewriteHeaders();
+ //For use by header updaters, throws if position of movi list
+ //changes, positions at beginning of data.
+
+ void seekMainHeader();
+ void writeMainHeader();
+
+ length_t seekStreamHeader(int stream);
+ void writeStreamHeader(int stream);
+
+ void seekVideoFormat(int stream);
+ void writeVideoFormat(int stream);
+
+ void seekAudioFormat(int stream);
+ void writeAudioFormat(int stream);
+
+ void seekStreamData(int stream);
+ void writeStreamData(int stream);
+
+ void seekSuperIndexChunk(int stream);
+ void writeSuperIndexChunk(int stream);
+
+ int indexCount() const;
+ void seekIndex() const;
+ void read(IndexEntry&) const;
+
+ void load(int stream, IEVector& index) const;
+ void load(int stream, FrameIndex& index) const;
+
+ void loadIndex(int, FrameIndex&) const;
+ void loadIndexEx(int, FrameIndex&) const;
+
+ void writeIndexChunkHeader(int number_of_index_entries);
+
+ void write(const IndexEntry&) const;
+
+ void writeIndexChunk(const IEVector& index);
+
+ void writeIndexChunk(
+ const FourCC& chunkId,
+ const FrameIndex& index);
+
+ void writeStandardIndexChunk(
+ int stream,
+ const FrameIndex& index,
+ offset_t baseOffset);
+
+ void writeStandardIndexChunk(
+ int stream,
+ const FrameIndex& index);
+
+ size_t makeSegment();
+ int segmentCount() const;
+ offset_t segmentOffset() const;
+
+ const FourCC readFourCC() const;
+ void writeFourCC(const FourCC&);
+
+ const FourCC testFourCC() const;
+
+ length_t readLength() const;
+ void writeLength(length_t length);
+
+ void read(void* buffer, size_t size) const;
+ void write(const void* data, size_t size, bool adjust = true);
+
+ void writeJunkChunk(length_t);
+
+ int countIndexEntries(int stream) const;
+
+ bool indexIsRelative() const;
+
+ offset_t size() const;
+
+ private:
+
+ File(const File& rhs);
+ File& operator=(const File& rhs);
+
+ //void readUnknownChunk() const;
+ void readJunkChunk() const;
+
+ bool readInit();
+ bool readHeaderList();
+ void readMainHeader();
+ void readExtraHeaders();
+ void readStreamHeaderList();
+ void readStreamHeader(StreamHeader& h);
+ void readStreamVideoFormat(BitmapInfoHeader& f);
+ struct StreamInfoVideo;
+ void readStreamVideoFormat(StreamInfoVideo* psiv);
+ void readStreamAudioFormat(WaveFormatEx& f);
+ void readStreamName(std::string& name);
+
+ void readExtendedAVIHeader();
+ void writeExtendedAVIHeader();
+
+ bool readDataList();
+ void readDataRecChunk() const;
+ void readDataChunk() const;
+
+ void readIndexList();
+
+ void writeInit();
+ void writeFinal();
+
+ void writeHeader();
+ void writeStreamHeaderList(int stream);
+ void writeStreamHeader(const StreamHeader& h);
+
+ void writeStreamVideoFormatChunk(const BitmapInfoHeader& f);
+ void writeStreamVideoFormat(const BitmapInfoHeader& f);
+
+ void writeStreamVideoFormatChunk(const unsigned char* pData, size_t sizeData);
+ void writeStreamVideoFormat(const unsigned char* pData, size_t sizeData);
+
+ void writeStreamAudioFormatChunk(const WaveFormatEx&);
+ void writeStreamAudioFormat(const WaveFormatEx&);
+
+ int headerLength() const;
+ int streamHeaderLength(int stream) const;
+
+ void load(const SuperIndexChunk::Entry&, FrameIndex&) const;
+
+ class handle_t
+ {
+ public:
+
+ handle_t();
+
+ void open(const char*, mode_t, dword) throw (FileError);
+ void close();
+
+ bool isOpen() const;
+ offset_t size() const;
+
+ void read(void*, size_t) const;
+ void write(const void*, size_t) const;
+
+ void truncate() const;
+
+ void seekCurrent(offset_t) const;
+ void seek(offset_t) const;
+
+ offset_t tell() const;
+
+ void mapinit();
+ void mapfinal();
+
+ unsigned long map(
+ offset_t offset,
+ length_t size,
+ unsigned char*& view,
+ length_t& viewSize,
+ length_t& offsetWithinView) const;
+
+ void unmap(unsigned char*, length_t) const;
+
+ private:
+#if defined WIN32
+ HANDLE m_hFile;
+ HANDLE m_hFileMappingObject;
+#elif defined LINUX
+ int m_fd;
+#endif
+ };
+
+ handle_t m_handle;
+
+ mode_t m_mode;
+
+ std::string m_name;
+
+ OutputType m_ot;
+
+ MainHeader m_mainHeader;
+
+ ExtraHeaderVector m_extraHeaderVector;
+
+ class indx_t
+ {
+ public:
+
+ indx_t();
+ indx_t(int entryCount);
+
+ ~indx_t();
+
+ int entryCount() const;
+
+ size_t size() const;
+
+ operator SuperIndexChunk&() const;
+
+ void read(File&);
+ void write(File&) const;
+
+ private:
+
+ indx_t(const indx_t&);
+ indx_t& operator=(const indx_t&);
+
+ dword* m_rep;
+
+ };
+
+ struct StreamInfo
+ {
+ virtual ~StreamInfo();
+
+ void write(File&) const;
+
+ int length() const;
+
+ StreamHeader header;
+
+ typedef std::vector<unsigned char> data_t;
+
+ data_t m_data;
+
+ std::string m_name;
+
+ ExtraHeaderVector m_extraHeaderVector;
+
+ indx_t m_indx;
+
+ protected:
+
+ StreamInfo(int);
+ StreamInfo(const StreamHeader&);
+
+ virtual int strf_length() const = 0;
+ virtual void strf_write(File&) const = 0;
+
+ private:
+
+ StreamInfo(const StreamInfo&);
+ StreamInfo& operator=(const StreamInfo&);
+
+ };
+
+ struct StreamInfoVideo : public StreamInfo
+ {
+ StreamInfoVideo(int entryCount);
+ StreamInfoVideo(const StreamHeader&);
+
+ ~StreamInfoVideo();
+
+// BitmapInfoHeader m_strf;
+ unsigned char* m_strf;
+ size_t m_strfSize;
+ protected:
+ int strf_length() const;
+ void strf_write(File&) const;
+ };
+
+ struct StreamInfoAudio : public StreamInfo
+ {
+ StreamInfoAudio(int entryCount);
+ StreamInfoAudio(const StreamHeader&);
+
+ WaveFormatEx m_strf;
+ protected:
+ int strf_length() const;
+ void strf_write(File&) const;
+ };
+
+ friend struct StreamInfo;
+ friend struct StreamInfoVideo;
+ friend struct StreamInfoAudio;
+
+ void readStreamData(StreamInfo::data_t&);
+
+ typedef std::vector<StreamInfo*> infoVector_t;
+ infoVector_t infoVector;
+
+ dword m_totalFrames;
+
+ offset_t m_dataPosn;
+
+ offset_t m_indexPosn;
+ int m_indexCount;
+ length_t m_idx1Size;
+
+ struct SegmentInfo
+ {
+ offset_t offset;
+ size_t size;
+
+ SegmentInfo() {}
+ SegmentInfo(offset_t offset_) : offset(offset_) {}
+ };
+
+ typedef std::vector<SegmentInfo> SegmentInfoVector;
+ SegmentInfoVector m_segmentInfo;
+ };
+
+#if defined WIN32
+ class MappedFile
+ {
+ public:
+
+ enum { invalid_offset = -1 };
+
+ MappedFile();
+ MappedFile(const char* name);
+
+ ~MappedFile();
+
+ void open(const char* name);
+ void close();
+
+ bool isOpen() const;
+ const char* name() const;
+
+ const MainHeader& mainHeader() const;
+
+ const StreamHeader& streamHeader(int stream) const;
+
+ const BitmapInfoHeader& videoFormat(int stream) const;
+
+ const WaveFormatEx& audioFormat(int stream) const;
+
+ const char* streamName(int stream) const;
+
+ dword totalFrames() const;
+
+ offset_t dataOffset() const;
+
+ offset_t indexOffset() const;
+ size_t indexSize() const;
+
+ offset_t indexChunkExOffset(int stream) const;
+ size_t indexChunkExSize(int stream) const;
+
+ const void* map(offset_t, size_t) const;
+ void unmap(const void*) const;
+
+ void load(int stream, FrameIEVector& index) const;
+
+ private:
+
+ MappedFile(const MappedFile&);
+ MappedFile& operator=(const MappedFile&);
+
+ void init();
+ void unmapAllViews();
+
+ offset_t offset() const;
+ void setFilePointerCurrent(LONG) const;
+
+ const FourCC readFourCC() const;
+ const FourCC queryFourCC() const;
+
+ dword readLength() const;
+
+ void readHeaderList();
+ void readDataList();
+ void readIndexList();
+ void readJunkChunk() const;
+ void readUnknownChunk() const;
+ void readMainHeaderChunk();
+ void readStreamHeaderList(int stream);
+ void readStreamHeaderChunk(StreamHeader&) const;
+ void readStreamVideoFormatChunk(BitmapInfoHeader&) const;
+ void readStreamAudioFormatChunk(WaveFormatEx&) const;
+ void readStreamNameChunk(std::string&) const;
+ void readIndexChunkEx(offset_t&, size_t&) const;
+ void readExtendedAVIHeaderList() const;
+
+ std::string m_name;
+
+ HANDLE m_file;
+ HANDLE m_fileMappingObject;
+
+ DWORD m_allocationGranularity;
+
+ MainHeader m_mainHeader;
+
+ struct StreamInfo
+ {
+ StreamHeader streamHeader;
+
+ union
+ {
+ BitmapInfoHeader* videoFormat;
+ WaveFormatEx* audioFormat;
+ };
+
+ std::string name;
+
+ offset_t indexChunkExOffset;
+ size_t indexChunkExSize;
+ };
+
+
+ typedef std::vector<StreamInfo> StreamInfoVector;
+ StreamInfoVector m_streamInfoVector;
+
+ size_t readChunkSize(offset_t) const;
+ int countEntries(int, const IndexEntry*, int) const;
+ int countEntries(const SuperIndexChunk&) const;
+ void loadIndex(int, FrameIEVector&) const;
+ void loadIndexEx(int, FrameIEVector&) const;
+ void load(const SuperIndexChunk::Entry&, FrameIEVector&) const;
+
+ mutable dword m_totalFrames;
+
+ offset_t m_dataOffset;
+
+ offset_t m_indexOffset;
+ size_t m_indexSize;
+
+ struct ViewInfo
+ {
+ unsigned char* pView;
+ unsigned char* pChunk;
+ };
+
+ typedef std::list<ViewInfo> Views;
+ mutable Views m_views;
+
+ Views::iterator findView(const void*) const;
+ };
+#endif
+
+}
+
+//inline HANDLE AVI::File::handle() const
+//{
+// return m_handle;
+//}
+
+inline AVI::Chunk::Chunk(
+ const FourCC fcc,
+ length_t length,
+ const unsigned char* d)
+ : m_fcc(fcc)
+{
+// if (m_length > 0)
+// {
+// m_data = new unsigned char[m_length];
+// if (m_data == 0)
+// {
+// throw FileError("Error allocating Chunk data.");
+// }
+// if (data != 0)
+// {
+// memcpy(m_data, data, m_length);
+// }
+// }
+
+ if (length)
+ {
+ if (d)
+ {
+ //typedef data_t::const_iterator iter_t;
+
+ //const iter_t first = iter_t(d);
+
+ //const data_t::size_type n = length;
+
+ //const iter_t last = first + n;
+
+ m_data.assign(d, d + length);
+ }
+ else
+ {
+ const data_t::size_type n = length;
+
+ m_data.assign(n, 0);
+ }
+ }
+ else
+ {
+ m_data.assign(data_t::size_type(0), 0);
+ }
+}
+
+inline const FourCC AVI::Chunk::fcc() const
+{
+ return m_fcc;
+}
+
+inline AVI::length_t AVI::Chunk::length() const
+{
+ const data_t::size_type n = m_data.size();
+
+ return n;
+}
+
+inline const unsigned char* AVI::Chunk::data() const
+{
+ return &m_data[0];
+}
+
+inline unsigned char* AVI::Chunk::data()
+{
+ return &m_data[0];
+}
+
+inline void AVI::Chunk::data(const unsigned char* d)
+{
+ //typedef data_t::const_iterator iter_t;
+
+ //const iter_t first = iter_t(d);
+
+ //const data_t::size_type n = m_data.size();
+
+ //const iter_t last = first + n;
+
+ m_data.assign(d, d + m_data.size());
+}
+
+inline AVI::dword AVI::FileError::id() const
+{
+ return m_id;
+}
+
+
+#endif
diff --git a/Src/libvp6/include/Aud.hpp b/Src/libvp6/include/Aud.hpp
new file mode 100644
index 00000000..1dd97687
--- /dev/null
+++ b/Src/libvp6/include/Aud.hpp
@@ -0,0 +1,79 @@
+#ifndef AUD_HPP
+#define AUD_HPP
+
+#include <exception>
+#include <string>
+#include <io.h>
+
+namespace Aud
+{
+ class FileError : public exception
+ {
+ public:
+ explicit FileError(const char* message);
+ const char* what() const;
+ private:
+ const std::string message;
+ };
+
+
+ enum { samplesPerSec = 48000 };
+
+ enum { sampleSizeInBits = 16, sampleSizeInBytes = 2 };
+
+ enum { numberOfChannels = 2 };
+
+ enum { blockAlign = numberOfChannels * sampleSizeInBytes };
+
+
+ class File
+ {
+ public:
+
+ enum mode_t { in, out };
+
+ File();
+ File(const char* name, mode_t mode);
+
+ ~File();
+
+ void open(const char* name, mode_t mode);
+ void close();
+
+ bool isOpen() const;
+ bool eof() const;
+
+ mode_t mode() const;
+ const char* name() const;
+
+ int sampleCount() const;
+
+ void seekSample(int sampleNum) const;
+
+ size_t read(void* buffer, size_t size) const;
+
+ void write(const void* buffer, size_t size);
+
+ typedef __int64 offset_t;
+ offset_t offset() const;
+
+ void seekOffset(offset_t) const;
+
+ private:
+
+ File(const File&);
+ File& operator=(const File&);
+
+ void init();
+
+ int handle_;
+
+ char name_[_MAX_PATH];
+ mode_t mode_;
+
+ int m_sampleCount;
+ };
+
+} //end namespace Aud
+
+#endif
diff --git a/Src/libvp6/include/CPUIdLib.h b/Src/libvp6/include/CPUIdLib.h
new file mode 100644
index 00000000..9a95b065
--- /dev/null
+++ b/Src/libvp6/include/CPUIdLib.h
@@ -0,0 +1,57 @@
+/****************************************************************************
+*
+* Module Title : CPUIdLib.h
+*
+* Description : CPU specific definitions.
+*
+****************************************************************************/
+#ifndef __INC_CPUIDLIB_H
+#define __INC_CPUIDLIB_H
+
+/****************************************************************************
+* Typedefs
+****************************************************************************/
+typedef enum PROCTYPE
+{
+ X86 = 0, /* 486, Pentium plain, or any other x86 compatible */
+ PMMX = 1, /* Pentium with MMX */
+ PPRO = 2, /* Pentium Pro */
+ PII = 3, /* Pentium II */
+ C6X86 = 4,
+ C6X86MX = 5,
+ AMDK63D = 6,
+ AMDK6 = 7,
+ AMDK5 = 8,
+ MACG3 = 9,
+ MAC68K = 10,
+ XMM = 11, /* SIMD instructions */
+ WMT = 12, /* Willamette Processor */
+ SpecialProc = -1 /* Will NEVER be returned by CPUID, function dependent meaning */
+} PROCTYPE;
+
+/****************************************************************************
+* Exports
+****************************************************************************/
+
+/****************************************************************************
+ *
+ * ROUTINE : findCPUId
+ *
+ * INPUTS : None
+ *
+ * OUTPUTS : None.
+ *
+ * RETURNS : PROCTYPE: processor type.
+ *
+ * FUNCTION : Returns type of CPU in your system.
+ *
+ * SPECIAL NOTES : None.
+ *
+ ****************************************************************************/
+#ifdef __cplusplus /* this ifdef only works correctly for Microsoft visual C compilers */
+extern "C" PROCTYPE findCPUId ( void );
+#else
+extern PROCTYPE findCPUId ( void );
+#endif
+
+#endif
diff --git a/Src/libvp6/include/DRMInfo.hpp b/Src/libvp6/include/DRMInfo.hpp
new file mode 100644
index 00000000..b933c8b3
--- /dev/null
+++ b/Src/libvp6/include/DRMInfo.hpp
@@ -0,0 +1,85 @@
+#if !defined(DRMINFO_HPP)
+#define DRMINFO_HPP
+//______________________________________________________________________________
+//
+// DRMInfo.hpp
+//
+
+//______________________________________________________________________________
+// Include Files and Forward Declarations
+
+#include <string>
+#include <exception>
+#include <iosfwd>
+#include "FourCC.hpp"
+
+namespace on2vp
+{
+
+//______________________________________________________________________________
+// Macro, Enumeration, and Constant Definitions
+
+//______________________________________________________________________________
+// Type, Struct, and Class Definitions
+
+ //--------------------------------------
+ class DRMInfo
+ {
+ friend std::ostream& operator<<(std::ostream& os, const DRMInfo& drmi);
+
+ public:
+ class Exception : public std::exception
+ {
+ public:
+ Exception(const std::string& strText);
+ ~Exception() throw();
+ const char* what() const throw();
+ private:
+ std::string m_strText;
+ };
+ DRMInfo();
+ DRMInfo(const DRMInfo& drmi);
+ ~DRMInfo();
+
+ DRMInfo& operator=(const DRMInfo& drmi);
+
+ const FourCC scheme() const;
+ long scope() const;
+ long amount() const;
+ const unsigned char* data() const;
+ long dataSize() const;
+ const unsigned char* drmx() const;
+ long drmxSize() const;
+
+ void scheme(FourCC fccScheme);
+ void scope(long lScope);
+ void amount(long lAmount);
+ void data(const unsigned char* pData, long lDataSize);
+
+ void init(FourCC fccScheme, long lScope, long lAmount, const unsigned char* pData, long lDataSize);
+ void drmx(const unsigned char* pDRMX, long lDRMXSize);
+
+ private:
+ enum
+ {
+ DRMXHeaderSize = 16
+ };
+
+ FourCC m_fccScheme;
+ long m_lScope;
+ long m_lAmount;
+ unsigned char* m_pData;
+ long m_lDataSize;
+ mutable unsigned char* m_pDRMX;
+ long m_lDRMXSize;
+ };
+
+//______________________________________________________________________________
+// Object and Function Declarations
+
+//______________________________________________________________________________
+// Object and Function Definitions
+
+} // namespace on2vp
+
+#endif // DRMINFO_HPP
diff --git a/Src/libvp6/include/FourCC.hpp b/Src/libvp6/include/FourCC.hpp
new file mode 100644
index 00000000..ab51feba
--- /dev/null
+++ b/Src/libvp6/include/FourCC.hpp
@@ -0,0 +1,110 @@
+#ifndef FOURCC_HPP
+#define FOURCC_HPP
+
+#include <iosfwd>
+#include <cstring>
+
+
+#if defined(__POWERPC__) || defined(__APPLE__) || defined(__MERKS__)
+using namespace std;
+#endif
+
+class FourCC
+{
+public:
+
+ FourCC();
+ FourCC(const char*);
+ explicit FourCC(unsigned long);
+
+ bool operator==(const FourCC&) const;
+ bool operator!=(const FourCC&) const;
+
+ bool operator==(const char*) const;
+ bool operator!=(const char*) const;
+
+ operator unsigned long() const;
+ unsigned long asLong() const;
+
+ FourCC& operator=(unsigned long);
+
+ char operator[](int) const;
+
+ std::ostream& put(std::ostream&) const;
+
+ bool printable() const;
+
+private:
+
+ union
+ {
+ char code[4];
+ unsigned long codeAsLong;
+ };
+
+};
+
+
+inline FourCC::FourCC()
+{
+}
+
+inline FourCC::FourCC(unsigned long x)
+ : codeAsLong(x)
+{
+}
+
+inline FourCC::FourCC(const char* str)
+{
+ memcpy(code, str, 4);
+}
+
+
+inline bool FourCC::operator==(const FourCC& rhs) const
+{
+ return codeAsLong == rhs.codeAsLong;
+}
+
+inline bool FourCC::operator!=(const FourCC& rhs) const
+{
+ return !operator==(rhs);
+}
+
+inline bool FourCC::operator==(const char* rhs) const
+{
+ return (memcmp(code, rhs, 4) == 0);
+}
+
+inline bool FourCC::operator!=(const char* rhs) const
+{
+ return !operator==(rhs);
+}
+
+
+inline FourCC::operator unsigned long() const
+{
+ return codeAsLong;
+}
+
+inline unsigned long FourCC::asLong() const
+{
+ return codeAsLong;
+}
+
+inline char FourCC::operator[](int i) const
+{
+ return code[i];
+}
+
+inline FourCC& FourCC::operator=(unsigned long val)
+{
+ codeAsLong = val;
+ return *this;
+}
+
+inline std::ostream& operator<<(std::ostream& os, const FourCC& rhs)
+{
+ return rhs.put(os);
+}
+
+#endif
diff --git a/Src/libvp6/include/IntTypes.cpp b/Src/libvp6/include/IntTypes.cpp
new file mode 100644
index 00000000..d23e8cb7
--- /dev/null
+++ b/Src/libvp6/include/IntTypes.cpp
@@ -0,0 +1,43 @@
+#include "IntTypes.hpp"
+#pragma warning(disable:4710)
+#pragma warning(push,3)
+#include <iostream>
+#pragma warning(pop)
+
+using std::ostream;
+
+
+ostream& operator<<(ostream& os, IntTypes::int64_t i)
+{
+ char buf[65];
+
+ _i64toa(i, buf, 10);
+
+ return os << buf;
+}
+
+ostream& operator<<(ostream& os, IntTypes::uint64_t i)
+{
+ char buf[65];
+
+ _ui64toa(i, buf, 10);
+
+ return os << buf;
+}
+
+ostream& operator<<(ostream& os, IntTypes::uint32_t i)
+{
+ return os << static_cast<unsigned int>(i);
+}
+
+
+ostream& operator<<(ostream& os, IntTypes::uint16_t i)
+{
+ char buf[33];
+
+ _ultoa(i, buf, 10);
+
+ return os << buf;
+}
+
+
diff --git a/Src/libvp6/include/IntTypes.hpp b/Src/libvp6/include/IntTypes.hpp
new file mode 100644
index 00000000..2ef1d800
--- /dev/null
+++ b/Src/libvp6/include/IntTypes.hpp
@@ -0,0 +1,28 @@
+#ifndef INTTYPES_HPP
+#define INTTYPES_HPP
+
+#include <iosfwd>
+
+namespace IntTypes
+{
+ typedef __int8 int8_t;
+ typedef unsigned __int8 uint8_t;
+
+ typedef __int16 int16_t;
+ typedef unsigned __int16 uint16_t;
+
+ typedef __int32 int32_t;
+ typedef unsigned __int32 uint32_t;
+
+ typedef __int64 int64_t;
+ typedef unsigned __int64 uint64_t;
+
+}
+
+std::ostream& operator<<(std::ostream&, IntTypes::int64_t);
+std::ostream& operator<<(std::ostream&, IntTypes::uint64_t);
+std::ostream& operator<<(std::ostream&, IntTypes::uint32_t);
+std::ostream& operator<<(std::ostream&, IntTypes::uint16_t);
+
+#endif
+
diff --git a/Src/libvp6/include/MP3.hpp b/Src/libvp6/include/MP3.hpp
new file mode 100644
index 00000000..1ac9ede0
--- /dev/null
+++ b/Src/libvp6/include/MP3.hpp
@@ -0,0 +1,109 @@
+#ifndef MP3_HPP
+#define MP3_HPP
+//______________________________________________________________________________
+//
+// MP3.hpp
+//
+
+//______________________________________________________________________________
+//
+
+#pragma warning(disable:4786)
+
+#include "mp3header.hpp"
+#include <windows.h>
+#include <string>
+#include <exception>
+#include <iosfwd>
+
+namespace MP3
+{
+
+//______________________________________________________________________________
+//
+
+ typedef __int64 offset_t;
+
+ //--------------------------------------
+ class Exception : public std::exception
+ {
+ public:
+ Exception(DWORD dwMessage);
+ Exception(const char* szMessage);
+ const char* what() const;
+ private:
+ std::string m_strMessage;
+ };
+
+ //--------------------------------------
+ struct Header
+ {
+ unsigned long m_ulChannels;
+ unsigned long m_ulSamplesPerSecond;
+ unsigned long m_ulSamplesPerBlock;
+ unsigned long m_ulBytesPerBlock;
+ unsigned long m_ulBlocks;
+
+ void clear();
+ };
+
+ std::ostream& operator<<(std::ostream& os, const Header& h);
+
+ //--------------------------------------
+ class File
+ {
+ public:
+
+ enum mode_t {in, out, inout};
+
+ File();
+ File(const char* szName, mode_t mode);
+
+ ~File();
+
+ void open(const char* szName, mode_t mode, DWORD dwFlags = 0);
+ void close();
+
+ bool isOpen() const;
+ bool eof() const;
+
+ const char* name() const;
+ mode_t mode() const;
+
+ unsigned long channels() const;
+ unsigned long samplesPerSecond() const;
+ unsigned long samplesPerBlock() const;
+ unsigned long bytesPerBlock() const;
+ unsigned long blocks() const;
+
+ const Header& header() const;
+
+ void read(void* pBuffer, size_t size) const;
+ void write(const void* pBuffer, size_t size);
+
+ void seek(offset_t) const;
+
+ private:
+
+ File(const File& f); // Not implemented
+ File& operator=(const File& f); // Not implemented
+
+ int readHeader();
+
+ offset_t size() const;
+ offset_t tell() const;
+
+ HANDLE m_handle;
+
+ std::string m_strName;
+ mode_t m_mode;
+
+ Header m_header;
+
+ offset_t m_fileSize;
+ offset_t m_fileOffset;
+ };
+
+} // namespace MP3
+
+#endif // MP3_HPP
diff --git a/Src/libvp6/include/MediaInfo.hpp b/Src/libvp6/include/MediaInfo.hpp
new file mode 100644
index 00000000..b31d81ae
--- /dev/null
+++ b/Src/libvp6/include/MediaInfo.hpp
@@ -0,0 +1,87 @@
+#if !defined(MEDIAINFO_HPP)
+#define MEDIAINFO_HPP
+//______________________________________________________________________________
+//
+// MediaInfo.hpp
+//
+
+#include "FourCC.hpp"
+
+#include <string>
+#include <exception>
+#include <iosfwd>
+
+namespace on2vp
+{
+
+ //--------------------------------------
+ class MediaInfo
+ {
+ friend std::ostream& operator<<(std::ostream& os, const MediaInfo& mi);
+
+ public:
+ class Exception : public std::exception
+ {
+ public:
+ Exception(const std::string& strText);
+ ~Exception() throw();
+ const char* what() const throw();
+ private:
+ std::string m_strText;
+ };
+
+ MediaInfo();
+ MediaInfo(const MediaInfo& mi);
+ ~MediaInfo();
+
+ MediaInfo& operator=(const MediaInfo& mi);
+
+ void parse(const std::string& strMediaInfo);
+
+ const unsigned char* data() const;
+ unsigned long dataSize() const;
+
+ private:
+
+ enum
+ {
+ DataSizeMax = 16384
+ };
+
+ void init_();
+ void copy_(const MediaInfo& mi);
+ void extract_(const std::string& strMediaInfo);
+ void update_();
+ unsigned long append_(FourCC fcc, const std::string& strData, char*& pData);
+
+ std::string m_strArchivalLocation;
+ std::string m_strArtist;
+ std::string m_strCommissioned;
+ std::string m_strComments;
+ std::string m_strCopyright;
+ std::string m_strCreationDate;
+ std::string m_strCropped;
+ std::string m_strDimensions;
+ std::string m_strDotsPerInch;
+ std::string m_strEngineer;
+ std::string m_strGenre;
+ std::string m_strKeywords;
+ std::string m_strLightness;
+ std::string m_strMedium;
+ std::string m_strName;
+ std::string m_strPaletteSetting;
+ std::string m_strProduct;
+ std::string m_strSubject;
+ std::string m_strSoftware;
+ std::string m_strSharpness;
+ std::string m_strSource;
+ std::string m_strSourceForm;
+ std::string m_strTechnician;
+
+ unsigned char* m_pData;
+ unsigned long m_ulDataSize;
+ };
+
+} // namespace on2vp
+
+#endif // MEDIAINFO_HPP
diff --git a/Src/libvp6/include/Mp3Header.hpp b/Src/libvp6/include/Mp3Header.hpp
new file mode 100644
index 00000000..bfc72035
--- /dev/null
+++ b/Src/libvp6/include/Mp3Header.hpp
@@ -0,0 +1,63 @@
+#if !defined(MP3HEADER_HPP)
+#define MP3HEADER_HPP
+
+#include <iosfwd>
+
+class Mp3Header
+{
+public:
+ Mp3Header(unsigned long);
+ unsigned long id;
+ unsigned long layer;
+ unsigned long protectionBit;
+ unsigned long bitRateIndex;
+ unsigned long samplingFrequency;
+ unsigned long paddingBit;
+ unsigned long privateBit;
+ unsigned long mode;
+ unsigned long modeExtension;
+ unsigned long copyright;
+ unsigned long originalOrCopy;
+ unsigned long emphasis;
+ unsigned long nch;
+ unsigned long sampleRate;
+ unsigned long bitRate;
+ unsigned long frameSize;
+ unsigned short outFrameSize;
+
+ enum { BITRATE_FREE = 0 };
+ enum { MPEG_FORBIDDEN = -1};
+ enum { SAMPLING_FREQUENCY_RESERVED = -1};
+
+ enum IdTypes
+ {
+ MPEG1 = 1,
+ MPEG2 = 2
+ };
+
+ enum AudioMode
+ {
+ STEREO_MODE = 0,
+ JOINT_STEREO_MODE = 1,
+ DUAL_CHANNEL_MODE = 2,
+ SINGLE_CHANNEL_MODE = 3
+ };
+
+ /* layer code, very bad design */
+ enum AudioLayer
+ {
+ AUDIO_LAYER_1 = 3,
+ AUDIO_LAYER_2 = 2,
+ AUDIO_LAYER_3 = 1,
+ AUDIO_LAYER_RESERVED = 0
+ };
+ friend std::ostream& operator<<(std::ostream& os, const Mp3Header& mp3);
+
+private:
+ static const unsigned short samplingFrequencyTable[2][4];
+ static const short m1BitRateTable[3][16];
+ static const short m2BitRateTable[3][16];
+ static const unsigned short outFrameSizes[2][4];
+
+};
+#endif \ No newline at end of file
diff --git a/Src/libvp6/include/NSV.hpp b/Src/libvp6/include/NSV.hpp
new file mode 100644
index 00000000..e6a9fd39
--- /dev/null
+++ b/Src/libvp6/include/NSV.hpp
@@ -0,0 +1,381 @@
+#if !defined(NSV_HPP)
+#define NSV_HPP
+//______________________________________________________________________________
+//
+// NSV.hpp
+// NSV File I/O Classes
+
+#include <FourCC.hpp>
+
+#include <exception>
+#include <string>
+#include <vector>
+#include <fstream>
+#include <iosfwd>
+
+namespace NSV
+{
+
+#if (defined(__POWERPC__) || defined(__APPLE__))
+ typedef long long INT64;
+ typedef long long POS_TYPE;
+ typedef std::ios IOS_BASE;
+#elif (defined(__linux) || defined(linux))
+ typedef long long INT64; // Assumes WIN32
+ typedef std::ios::pos_type POS_TYPE;
+ typedef std::ios_base IOS_BASE;
+#else
+ typedef __int64 INT64; // Assumes WIN32
+ typedef std::ios::pos_type POS_TYPE;
+ typedef std::ios_base IOS_BASE;
+#endif
+
+ enum
+ {
+ FrameRates = 256
+ };
+
+ double frameRate(int nFrameRate);
+ int frameRate(unsigned int uiRateNum, unsigned int uiRateDenom);
+ bool video(FourCC fccNSV);
+ bool audio(FourCC fccNSV);
+ FourCC videoFormat(FourCC fccCompression);
+ FourCC audioFormat(unsigned short wFormatTag);
+ FourCC videoCompression(FourCC fccNSV);
+ int videoBitCount(FourCC fccNSV);
+ unsigned short audioFormatTag(FourCC fccNSV);
+
+ //--------------------------------------
+ class Exception : public std::exception
+ {
+ public:
+ Exception();
+ Exception(const std::string& strException);
+ Exception(const Exception& e);
+ ~Exception() throw();
+
+ Exception& operator=(const Exception& e);
+
+ const char* what() const throw();
+
+ private:
+ std::string m_strException;
+ };
+
+ //--------------------------------------
+ class IndexEntry
+ {
+ public:
+ IndexEntry(POS_TYPE posOffset = 0, size_t sizeData = -1, bool bKeyFrame = false) :
+ m_posOffset(posOffset),
+ m_sizeData(sizeData),
+ m_bKeyFrame(bKeyFrame)
+ {
+ }
+
+ //private:
+ POS_TYPE m_posOffset;
+ size_t m_sizeData;
+ bool m_bKeyFrame;
+ };
+
+ typedef std::vector<IndexEntry> Index;
+
+ //--------------------------------------
+ class FileHeader
+ {
+ public:
+ friend std::ostream& operator<<(std::ostream& os, const FileHeader& fh);
+
+ FileHeader() :
+ m_fccSignature(0UL),
+ m_sizeHeader(0),
+ m_sizeFile(0),
+ m_iFileSize_ms(0),
+ m_sizeMetaData(0),
+ m_nTOCAlloc(0),
+ m_nTOCSize(0),
+ m_strMetaData(),
+ m_index()
+ {
+ }
+
+ //private:
+ FourCC m_fccSignature;
+ size_t m_sizeHeader;
+ size_t m_sizeFile;
+ int m_iFileSize_ms;
+ size_t m_sizeMetaData;
+ int m_nTOCAlloc;
+ int m_nTOCSize;
+ std::string m_strMetaData;
+ std::vector<size_t> m_index;
+ };
+
+ //--------------------------------------
+ class FrameHeader
+ {
+ public:
+ friend std::ostream& operator<<(std::ostream& os, const FrameHeader& fh);
+
+ FrameHeader() :
+ m_fccSignature(0UL),
+ m_fccVideo(0UL),
+ m_fccAudio(0UL),
+ m_iWidth(0),
+ m_iHeight(0),
+ m_iFrameRate(0),
+ m_iSyncOffset_ms(0),
+ m_bKeyFrame(false)
+ {
+ }
+
+ //private:
+ FourCC m_fccSignature;
+ FourCC m_fccVideo;
+ FourCC m_fccAudio;
+ int m_iWidth;
+ int m_iHeight;
+ int m_iFrameRate;
+ int m_iSyncOffset_ms;
+ bool m_bKeyFrame;
+ };
+
+ class Stream;
+
+ //--------------------------------------
+ class File
+ {
+ friend std::ostream& operator<<(std::ostream& os, const File& f);
+
+ public:
+ File();
+ ~File();
+
+ // File header
+ void header(const std::string& strMetaData, int nIndexEntries);
+ void metaData(const std::string& strMetaData);
+ const std::string& metaData() const;
+
+ void indexEntry(int nEntry, POS_TYPE posOffset, size_t sizeData = -1, bool bKeyFrame = false);
+ void appendIndexEntry(POS_TYPE posOffset, size_t sizeData = -1, bool bKeyFrame = false);
+ Index& index(); // Relative index
+ int indexEntriesUsed() const;
+
+ // Synchronization frame header
+ FourCC videoFormat() const;
+ FourCC audioFormat() const;
+
+ void size(int iWidth, int iHeight);
+ int width()const;
+ int height() const;
+
+ void frameRate(unsigned char ucFrameRate);
+ unsigned char frameRate() const;
+
+ void rate(unsigned int uiRateNum, unsigned int uiRateDenom);
+ unsigned int rateNum() const;
+ unsigned int rateDenom() const;
+
+ void syncOffset(int iSyncOffset_ms);
+ int syncOffset() const;
+ void finalizeSyncOffset();
+
+ void frames(INT64 nFrames);
+ INT64 frames() const;
+
+ Stream& newStream(FourCC fccDataType, unsigned int uiRateNum = 0, unsigned int uiRateDenom = 0, INT64 nSamples = -1);
+ int streams() const;
+ int streamsAux() const;
+ Stream& stream(int nStream);
+ const Stream& stream(int nStream) const;
+
+ int streamVideo() const;
+ int streamAudio() const;
+ int streamAux(int nAux) const;
+
+ void dataOffset(POS_TYPE posDataOffset);
+ POS_TYPE dataOffset();
+
+ private:
+ File(const File& f); // Not implemented
+ File& operator=(const File& f); // Not implemented
+
+ std::string m_strMetaData;
+ Index m_index;
+ int m_nIndexEntriesUsed;
+
+ int m_iWidth;
+ int m_iHeight;
+
+ unsigned int m_uiRateNum;
+ unsigned int m_uiRateDenom;
+ unsigned char m_ucFrameRate;
+
+ int m_iSyncOffset_ms;
+
+ std::vector<Stream> m_vStream;
+
+ POS_TYPE m_posDataOffset;
+
+ int m_nStreamVideo;
+ int m_nStreamAudio;
+
+ INT64 m_nFrames;
+ };
+
+ //--------------------------------------
+ class Stream
+ {
+ friend std::ostream& operator<<(std::ostream& os, const Stream& s);
+
+ public:
+ Stream(File* pFile, int nStream, FourCC fccDataType, unsigned int uiRateNum, unsigned int uiRateDenom, INT64 nSamples);
+ Stream(const Stream& s);
+ ~Stream();
+
+ Stream& operator=(const Stream& s);
+
+ void open();
+ void close();
+
+ int stream() const;
+ FourCC type() const; // Returns AVI types, vids, auds, ...
+ FourCC dataType() const;
+
+ void samples(INT64 nSamples);
+ INT64 samples() const;
+
+ void sample(INT64 nSample);
+ INT64 sample() const;
+
+ void rate(unsigned int uiRateNum, unsigned int uiRateDenom);
+ unsigned int rateNum() const;
+ unsigned int rateDenom() const;
+
+ void dataSize(size_t sizeData);
+ void data(const unsigned char* pData, size_t sizeData);
+ unsigned char* data();
+ size_t dataSize() const;
+
+ void keyFrame(bool bKeyFrame);
+ bool keyFrame() const;
+
+
+ private:
+ File* m_pFile;
+ int m_nStream;
+ FourCC m_fccDataType;
+ INT64 m_nSamples;
+ INT64 m_nSample;
+
+ unsigned int m_uiRateNum;
+ unsigned int m_uiRateDenom;
+
+ unsigned char* m_pBuffer;
+ size_t m_sizeBuffer;
+ size_t m_sizeData;
+
+ bool m_bKeyFrame;
+ };
+
+/*
+ //--------------------------------------
+ class Reader
+ {
+ public:
+ Reader(File& f);
+ Reader(File& f, const std::string& strFile);
+ ~Reader();
+
+ void open(const std::string& strFile);
+ void open();
+ void close();
+
+ File& file();
+ const std::string& fileName() const;
+
+ void readFileHeader();
+ void readFrame();
+ void readFrameInfo();
+ void readFrameHeader();
+ void readPayload();
+ void readPayloadInfo();
+ void readPayloadHeader(int& nAux, int& iAuxPlusVideo, int& iAudio);
+
+ INT64 frames() const;
+ INT64 frame() const;
+ void seek(INT64 nFrame);
+ void readSample(int nStream, unsigned char* pData, size_t sizeDataMax, size_t& sizeData, bool& bKeyFrame);
+ bool eof();
+
+ const FileHeader& fileHeader() const;
+ const FrameHeader& frameHeader() const;
+
+ private:
+ Reader(const Reader& r); // Not implemented
+ Reader& operator=(const Reader& r); // Not implemented
+
+ short read_i16();
+ unsigned short read_ui16();
+ int read_i32();
+ unsigned int read_ui32();
+
+ File& m_file;
+ std::string m_strFile;
+ std::ifstream m_ifs;
+
+ FileHeader m_fileHeader;
+ FrameHeader m_frameHeader;
+ bool m_bFrameHeader;
+
+ INT64 m_nFrame;
+ };
+*/
+
+ //--------------------------------------
+ class Writer
+ {
+ public:
+ Writer(File& f);
+ Writer(File& f, const std::string& strFile);
+ ~Writer();
+
+ void open(const std::string& strFile);
+ void open();
+ void close();
+
+ File& file();
+ const std::string& fileName() const;
+
+ INT64 frame() const;
+ void seek(POS_TYPE posOffset);
+
+ void header(const std::string& strMetaData, int nIndexEntries);
+ void sample(int nStream, const unsigned char* pData, size_t sizeData, bool bKeyframe);
+ void writeFrame();
+
+ private:
+ Writer(const Writer& w); // Not implemented
+ Writer& operator=(const Writer& w); // Not implemented
+
+ void writeFileHeader();
+ void writeFrameHeader(bool bKeyFrame);
+ void writePayloadHeader();
+
+ void write_i16(short i16);
+ void write_ui16(unsigned short ui16);
+ void write_i32(int i32);
+ void write_ui32(unsigned int ui32);
+
+ File& m_file;
+ std::string m_strFile;
+ std::ofstream m_ofs;
+
+ INT64 m_nFrame;
+ bool m_bKeyFrame;
+ };
+
+} // namespace NSV
+
+#endif // NSV_HPP
diff --git a/Src/libvp6/include/NSV_Reader.hpp b/Src/libvp6/include/NSV_Reader.hpp
new file mode 100644
index 00000000..7521166a
--- /dev/null
+++ b/Src/libvp6/include/NSV_Reader.hpp
@@ -0,0 +1,688 @@
+#if !defined(NSV_READER_HPP)
+#define NSV_READER_HPP
+//______________________________________________________________________________
+//
+// NSV_Reader.hpp
+// NSV Reader Class
+
+#include "NSV.hpp"
+#include "endian.hpp"
+
+#include <string>
+#include <memory>
+#include <fstream>
+#include <sstream>
+#include <cassert>
+
+namespace NSV
+{
+
+ //--------------------------------------
+ // Defines the interface for the basic_Reader template instantiations
+ class Reader_base
+ {
+ public:
+ virtual ~Reader_base()
+ {
+ }
+
+ virtual void open(const std::string& strFile) = 0;
+ virtual void close() = 0;
+
+ virtual File& file() = 0;
+ virtual const std::string& fileName() const = 0;
+
+ virtual void readFileHeader() = 0;
+ virtual void readFrame() = 0;
+ virtual void readFrameInfo() = 0;
+ virtual void readFrameHeader() = 0;
+ virtual void readPayload() = 0;
+ virtual void readPayloadInfo() = 0;
+ virtual void readPayloadHeader(int& nAux, int& iAuxPlusVideo, int& iAudio) = 0;
+
+ virtual void buildIndex(int nIndexEntries) = 0;
+
+ virtual INT64 frames() const = 0;
+ virtual INT64 frame() const = 0;
+ virtual void seek(INT64 nFrame) = 0;
+ virtual void readSample(int nStream, unsigned char* pData, size_t sizeDataMax, size_t& sizeData, bool& bKeyFrame) = 0;
+ virtual bool eof() = 0;
+
+ virtual const FileHeader& fileHeader() const = 0;
+ virtual const FrameHeader& frameHeader() const = 0;
+
+ virtual void* get_ifs() = 0;
+ };
+
+ //--------------------------------------
+ template<typename T>
+ class basic_Reader : public Reader_base
+ {
+ public:
+ basic_Reader(File& f);
+ ~basic_Reader();
+
+ void open(const std::string& strFile);
+ void close();
+
+ File& file();
+ const std::string& fileName() const;
+
+ void readFileHeader();
+ void readFrame();
+ void readFrameInfo();
+ void readFrameHeader();
+ void readPayload();
+ void readPayloadInfo();
+ void readPayloadHeader(int& nAux, int& iAuxPlusVideo, int& iAudio);
+
+ void buildIndex(int nIndexEntries = 0); // index all frames by default
+
+ INT64 frames() const;
+ INT64 frame() const;
+ void seek(INT64 nFrame);
+ void readSample(int nStream, unsigned char* pData, size_t sizeDataMax, size_t& sizeData, bool& bKeyFrame);
+ bool eof();
+
+ const FileHeader& fileHeader() const;
+ const FrameHeader& frameHeader() const;
+
+ void* get_ifs();
+
+ private:
+ basic_Reader(const basic_Reader& r); // Not implemented
+ basic_Reader& operator=(const basic_Reader& r); // Not implemented
+
+ short read_i16();
+ unsigned short read_ui16();
+ int read_i32();
+ unsigned int read_ui32();
+
+ File& m_file;
+ std::string m_strFile;
+ T m_ifs;
+
+ FileHeader m_fileHeader;
+ FrameHeader m_frameHeader;
+ bool m_bFrameHeader;
+
+ INT64 m_nFrame;
+ };
+
+ //--------------------------------------
+ template<typename T>
+ basic_Reader<T>::basic_Reader(File& f) :
+ m_file(f),
+ m_strFile(),
+ m_fileHeader(),
+ m_frameHeader(),
+ m_bFrameHeader(false),
+ m_nFrame(0)
+ {
+ }
+
+ //--------------------------------------
+ template<typename T>
+ basic_Reader<T>::~basic_Reader()
+ {
+ close();
+ }
+
+ //--------------------------------------
+ template<typename T>
+ void basic_Reader<T>::open(const std::string& strFile)
+ {
+ m_strFile = strFile;
+
+ m_ifs.open(m_strFile.c_str(), IOS_BASE::binary);
+ if (!m_ifs)
+ {
+ std::ostringstream ossError;
+ ossError << "Error opening file " << m_strFile;
+ throw Exception(ossError.str());
+ }
+
+ readFileHeader();
+
+ return;
+ }
+
+ //--------------------------------------
+ template<typename T>
+ void basic_Reader<T>::close()
+ {
+ if (m_ifs)
+ {
+ m_ifs.close();
+ }
+
+ m_strFile.erase();
+
+ return;
+ }
+
+ //--------------------------------------
+ template<typename T>
+ File& basic_Reader<T>::file()
+ {
+ return m_file;
+ }
+
+ //--------------------------------------
+ template<typename T>
+ const std::string& basic_Reader<T>::fileName() const
+ {
+ return m_strFile;
+ }
+
+ //--------------------------------------
+ template<typename T>
+ void basic_Reader<T>::readFileHeader()
+ {
+ assert(m_ifs);
+
+ // Read file header signature
+ char cSignature[5];
+ m_ifs.read(cSignature, 4);
+ if (strncmp(cSignature, "NSVf", 4) == 0)
+ {
+ cSignature[4] = '\0';
+ m_fileHeader.m_fccSignature = cSignature;
+ m_fileHeader.m_sizeHeader = read_i32();
+ m_fileHeader.m_sizeFile = read_i32();
+ m_fileHeader.m_iFileSize_ms = read_i32();
+ m_fileHeader.m_sizeMetaData = read_i32();
+ m_fileHeader.m_nTOCAlloc = read_i32();
+ m_fileHeader.m_nTOCSize = read_i32();
+
+ if ((m_fileHeader.m_sizeFile > 0 && m_fileHeader.m_sizeFile < m_fileHeader.m_sizeHeader)
+ || m_fileHeader.m_nTOCSize > m_fileHeader.m_nTOCAlloc)
+ {
+ throw Exception("Invalid NSV file header");
+ }
+
+ if (m_fileHeader.m_sizeMetaData > 0)
+ {
+ std::auto_ptr<char> apcMetaData(new char[m_fileHeader.m_sizeMetaData + 1]);
+ char* pcMetaData = apcMetaData.get();
+ if (pcMetaData == 0)
+ {
+ throw Exception("Out of memory");
+ }
+
+ m_ifs.read(pcMetaData, m_fileHeader.m_sizeMetaData);
+ pcMetaData[m_fileHeader.m_sizeMetaData] = '\0';
+
+ m_file.header(pcMetaData, m_fileHeader.m_nTOCSize);
+ }
+ else
+ {
+ m_file.header("", m_fileHeader.m_nTOCSize);
+ }
+
+ for (int nEntry = 0; nEntry < m_fileHeader.m_nTOCSize; ++nEntry)
+ {
+ POS_TYPE posOffset;
+ posOffset = read_ui32();
+ m_file.indexEntry(nEntry, posOffset);
+ }
+
+ m_ifs.ignore((m_fileHeader.m_nTOCAlloc - m_fileHeader.m_nTOCSize) * 4);
+
+ if (m_ifs.tellg() > static_cast<POS_TYPE>(m_fileHeader.m_sizeHeader))
+ {
+ throw Exception("Invalid NSV file header");
+ }
+
+ m_file.dataOffset(m_fileHeader.m_sizeHeader);
+ m_ifs.seekg(m_file.dataOffset());
+ }
+ else // No file header present
+ {
+ m_fileHeader.m_sizeHeader = 0;
+ m_ifs.seekg(0, IOS_BASE::end);
+ m_fileHeader.m_sizeFile = m_ifs.tellg();
+
+ m_fileHeader.m_iFileSize_ms = 0;
+ m_fileHeader.m_nTOCAlloc = 0;
+ m_file.header("", 0);
+
+ m_file.dataOffset(0);
+ m_ifs.seekg(m_file.dataOffset());
+ }
+
+ // Read stream info from first frame header
+ readFrameHeader();
+ int nAux;
+ int iAuxPlusVideo;
+ int iAudio;
+ readPayloadHeader(nAux, iAuxPlusVideo, iAudio);
+
+ m_file.size(m_frameHeader.m_iWidth, m_frameHeader.m_iHeight);
+ m_file.frameRate(m_frameHeader.m_iFrameRate);
+
+ if (m_fileHeader.m_iFileSize_ms > 0)
+ {
+ INT64 nFramesDenom = static_cast<INT64>(m_file.rateDenom()) * 1000;
+ INT64 nFrames = (static_cast<INT64>(m_fileHeader.m_iFileSize_ms) * static_cast<INT64>(m_file.rateNum()) + nFramesDenom / 2) / nFramesDenom;
+ m_file.frames(nFrames);
+ }
+
+ // Set up primary video and audio streams
+ m_file.newStream(m_frameHeader.m_fccVideo);
+ m_file.newStream(m_frameHeader.m_fccAudio);
+ m_file.stream(0).rate(m_file.rateNum(), m_file.rateDenom());
+ m_file.stream(0).samples(m_file.frames());
+
+ // Set up aux streams
+ for (int n = 0; n < nAux; ++n)
+ {
+ unsigned short uh = read_ui16();
+ unsigned long ul = read_ui32();
+ m_ifs.ignore(uh);
+
+ m_file.newStream(FourCC(ul));
+ // More info ...
+ }
+
+ m_ifs.seekg(m_file.dataOffset());
+
+ return;
+ }
+
+ //--------------------------------------
+ template<typename T>
+ void basic_Reader<T>::readFrame()
+ {
+ readFrameHeader();
+ readPayload();
+
+ return;
+ }
+
+ //--------------------------------------
+ template<typename T>
+ void basic_Reader<T>::readFrameInfo()
+ {
+ readFrameHeader();
+ readPayloadInfo();
+
+ return;
+ }
+
+ //--------------------------------------
+ template<typename T>
+ void basic_Reader<T>::readFrameHeader()
+ {
+ assert(m_ifs);
+
+ // Read frame header signature
+ char cSignature[5];
+ m_ifs.read(cSignature, 2);
+ if (strncmp(cSignature, "\xef\xbe", 2) == 0)
+ {
+ m_frameHeader.m_fccSignature = 0UL;
+ m_frameHeader.m_bKeyFrame = false;
+ m_file.syncOffset(0);
+ return;
+ }
+
+ m_ifs.read(&cSignature[2], 2);
+ if (strncmp(cSignature, "NSVs", 4) != 0)
+ {
+ throw Exception("Invalid NSV frame header");
+ }
+
+ cSignature[4] = '\0';
+ m_frameHeader.m_fccSignature = cSignature;
+ m_ifs.read(reinterpret_cast<char*>(&m_frameHeader.m_fccVideo), 4);
+ m_ifs.read(reinterpret_cast<char*>(&m_frameHeader.m_fccAudio), 4);
+ m_frameHeader.m_iWidth = read_i16();
+ m_frameHeader.m_iHeight = read_i16();
+ unsigned char uc;
+ m_ifs.read(reinterpret_cast<char*>(&uc), 1);
+ m_frameHeader.m_iFrameRate = uc;
+ m_frameHeader.m_iSyncOffset_ms = read_i16();
+ m_frameHeader.m_bKeyFrame = true;
+
+ if (!m_bFrameHeader)
+ {
+// m_file.newStream(m_frameHeader.m_fccVideo);
+// m_file.newStream(m_frameHeader.m_fccAudio);
+// m_file.size(m_frameHeader.m_iWidth, m_frameHeader.m_iHeight);
+// m_file.frameRate(m_frameHeader.m_iFrameRate);
+
+ m_bFrameHeader = true;
+ }
+ else
+ {
+ if ((m_file.streamVideo() >= 0 && m_file.videoFormat() != m_frameHeader.m_fccVideo)
+ || (m_file.streamAudio() >= 0 && m_file.audioFormat() != m_frameHeader.m_fccAudio)
+ || m_file.width() != m_frameHeader.m_iWidth
+ || m_file.height() != m_frameHeader.m_iHeight
+ || m_file.frameRate() != m_frameHeader.m_iFrameRate)
+ {
+ throw Exception("Invalid NSV frame header");
+ }
+ }
+
+ m_file.syncOffset(m_frameHeader.m_iSyncOffset_ms);
+
+ return;
+ }
+
+ //--------------------------------------
+ template<typename T>
+ void basic_Reader<T>::readPayload()
+ {
+ assert(m_ifs);
+
+ int nAux;
+ int iAuxPlusVideo;
+ int iAudio;
+ readPayloadHeader(nAux, iAuxPlusVideo, iAudio);
+
+ int iAux = 0;
+
+ for (int n = 0; n < nAux; ++n)
+ {
+ unsigned short uh = read_ui16();
+ unsigned int ui = read_ui32();
+
+ Stream& s = m_file.stream(m_file.streamAux(n));
+ s.dataSize(uh);
+ m_ifs.read(reinterpret_cast<char*>(s.data()), uh);
+
+ iAux += uh;
+ }
+
+ if (m_file.streamVideo() >= 0)
+ {
+ int iVideo = iAuxPlusVideo - iAux;
+ Stream& sVideo = m_file.stream(m_file.streamVideo());
+ sVideo.dataSize(iVideo);
+ m_ifs.read(reinterpret_cast<char*>(sVideo.data()), iVideo);
+ sVideo.keyFrame(m_frameHeader.m_bKeyFrame);
+ }
+ else
+ {
+ m_ifs.seekg(iAuxPlusVideo - iAux, IOS_BASE::cur);
+ }
+
+ if (m_file.streamAudio() >= 0)
+ {
+ Stream& sAudio = m_file.stream(m_file.streamAudio());
+ sAudio.dataSize(iAudio);
+ m_ifs.read(reinterpret_cast<char*>(sAudio.data()), iAudio);
+ sAudio.keyFrame(true);
+ }
+ else
+ {
+ m_ifs.seekg(iAudio, IOS_BASE::cur);
+ }
+
+ return;
+ }
+
+ //--------------------------------------
+ template<typename T>
+ void basic_Reader<T>::readPayloadInfo()
+ {
+ assert(m_ifs);
+
+ int nAux;
+ int iAuxPlusVideo;
+ int iAudio;
+ readPayloadHeader(nAux, iAuxPlusVideo, iAudio);
+
+ int iAux = 0;
+
+ for (int n = 0; n < nAux; ++n)
+ {
+ unsigned short uh = read_ui16();
+ unsigned int ui = read_ui32();
+ m_ifs.ignore(uh);
+
+ Stream& s = m_file.stream(m_file.streamAux(n));
+ s.dataSize(uh);
+
+ iAux += uh;
+ }
+
+ if (m_file.streamVideo() >= 0)
+ {
+ int iVideo = iAuxPlusVideo - iAux;
+ Stream& sVideo = m_file.stream(m_file.streamVideo());
+ sVideo.dataSize(iVideo);
+ sVideo.keyFrame(m_frameHeader.m_bKeyFrame);
+ }
+
+ if (m_file.streamAudio() >= 0)
+ {
+ Stream& sAudio = m_file.stream(m_file.streamAudio());
+ sAudio.dataSize(iAudio);
+ sAudio.keyFrame(true);
+ }
+
+ return;
+ }
+
+ //--------------------------------------
+ template<typename T>
+ void basic_Reader<T>::readPayloadHeader(int& nAux, int& iAuxPlusVideo, int& iAudio)
+ {
+ assert(m_ifs);
+
+ char c;
+ unsigned short uh;
+ unsigned short uhAudio;
+
+ m_ifs.get(c);
+ uh = read_ui16();
+ uhAudio = read_ui16();
+
+ nAux = c & 0xf;
+ iAuxPlusVideo = (static_cast<int>(uh) << 4) | ((c >> 4) & 0xf);
+ iAudio = uhAudio;
+
+ return;
+ }
+
+ //--------------------------------------
+ template<typename T>
+ void basic_Reader<T>::buildIndex(int nIndexEntries)
+ {
+ assert(nIndexEntries == 0); // Only creates full index for now ...
+
+ m_file.index().clear();
+ m_file.frames(0);
+
+ m_ifs.seekg(m_file.dataOffset());
+
+ INT64 nFrames = 0;
+ for (; !eof(); ++nFrames)
+ {
+ m_file.appendIndexEntry(static_cast<POS_TYPE>(m_ifs.tellg()) - m_file.dataOffset());
+
+ readFrameHeader();
+ int nAux;
+ int iAuxPlusVideo;
+ int iAudio;
+ readPayloadHeader(nAux, iAuxPlusVideo, iAudio);
+ m_ifs.seekg(iAuxPlusVideo + iAudio, IOS_BASE::cur);
+ }
+
+ m_file.frames(nFrames);
+
+ m_ifs.seekg(m_file.dataOffset());
+
+ return;
+ }
+
+ //--------------------------------------
+ template<typename T>
+ INT64 basic_Reader<T>::frames() const
+ {
+ return m_file.frames();
+ }
+
+ //--------------------------------------
+ template<typename T>
+ INT64 basic_Reader<T>::frame() const
+ {
+ return m_nFrame;
+ }
+
+ //--------------------------------------
+ template<typename T>
+ void basic_Reader<T>::seek(INT64 nFrame)
+ {
+ assert(m_ifs);
+ INT64 nFrames = m_file.frames();
+ assert(nFrame < nFrames || nFrames == -1);
+
+ int nIndexEntries = m_file.index().size();
+
+ if (nIndexEntries > 0)
+ {
+ int nIndexEntry = nIndexEntries * nFrame / nFrames;
+ INT64 nFrameIndex = (nIndexEntry * nFrames + nIndexEntries / 2) / nIndexEntries;
+
+ m_ifs.seekg(m_file.dataOffset() + m_file.index()[nIndexEntry].m_posOffset);
+
+ for (; nFrameIndex < nFrame; ++nFrameIndex)
+ {
+ readFrameHeader();
+ int nAux;
+ int iAuxPlusVideo;
+ int iAudio;
+ readPayloadHeader(nAux, iAuxPlusVideo, iAudio);
+ m_ifs.seekg(iAuxPlusVideo + iAudio, IOS_BASE::cur);
+ }
+
+ m_nFrame = nFrame;
+ }
+ else
+ {
+ m_ifs.seekg(m_file.dataOffset());
+
+ for (m_nFrame = 0; m_nFrame < nFrame; ++m_nFrame)
+ {
+ readFrameHeader();
+ int nAux;
+ int iAuxPlusVideo;
+ int iAudio;
+ readPayloadHeader(nAux, iAuxPlusVideo, iAudio);
+ m_ifs.seekg(iAuxPlusVideo + iAudio, IOS_BASE::cur);
+ }
+
+ assert(m_nFrame == nFrame);
+ }
+
+ return;
+ }
+
+ //--------------------------------------
+ template<typename T>
+ void basic_Reader<T>::readSample(int nStream, unsigned char* pData, size_t sizeDataMax, size_t& sizeData, bool& bKeyFrame)
+ {
+ assert(m_ifs);
+ assert(pData != 0);
+
+ readFrame();
+
+ Stream& s = m_file.stream(nStream);
+
+ size_t size = s.dataSize();
+ if (sizeDataMax < s.dataSize())
+ {
+ size = sizeDataMax;
+ }
+
+ memcpy(pData, s.data(), size);
+ sizeData = s.dataSize();
+
+ bKeyFrame = s.keyFrame();
+
+ return;
+ }
+
+ //--------------------------------------
+ template<typename T>
+ bool basic_Reader<T>::eof()
+ {
+ return m_ifs.tellg() >= m_fileHeader.m_sizeFile;
+ }
+
+ //--------------------------------------
+ template<typename T>
+ const FileHeader& basic_Reader<T>::fileHeader() const
+ {
+ return m_fileHeader;
+ }
+
+ //--------------------------------------
+ template<typename T>
+ const FrameHeader& basic_Reader<T>::frameHeader() const
+ {
+ return m_frameHeader;
+ }
+
+ //--------------------------------------
+ template<typename T>
+ void* basic_Reader<T>::get_ifs()
+ {
+ return &m_ifs;
+ }
+
+ //--------------------------------------
+ template<typename T>
+ short basic_Reader<T>::read_i16()
+ {
+ assert(m_ifs);
+
+ short i16;
+ m_ifs.read(reinterpret_cast<char*>(&i16), 2);
+
+ return native_endian(i16, false);
+ }
+
+ //--------------------------------------
+ template<typename T>
+ unsigned short basic_Reader<T>::read_ui16()
+ {
+ assert(m_ifs);
+
+ unsigned short ui16;
+ m_ifs.read(reinterpret_cast<char*>(&ui16), 2);
+
+ return native_endian(ui16, false);
+ }
+
+ //--------------------------------------
+ template<typename T>
+ int basic_Reader<T>::read_i32()
+ {
+ assert(m_ifs);
+
+ int i32;
+ m_ifs.read(reinterpret_cast<char*>(&i32), 4);
+
+ return native_endian(i32, false);
+ }
+
+ //--------------------------------------
+ template<typename T>
+ unsigned int basic_Reader<T>::read_ui32()
+ {
+ assert(m_ifs);
+
+ unsigned int ui32;
+ m_ifs.read(reinterpret_cast<char*>(&ui32), 4);
+
+ return native_endian(ui32, false);
+ }
+
+} // namespace NSV
+
+#endif // NSV_READER_HPP
diff --git a/Src/libvp6/include/On2Crypt.h b/Src/libvp6/include/On2Crypt.h
new file mode 100644
index 00000000..5c1014d2
--- /dev/null
+++ b/Src/libvp6/include/On2Crypt.h
@@ -0,0 +1,132 @@
+//==========================================================================
+//
+// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
+// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
+// PURPOSE.
+//
+// Copyright (c) 1999 - 2001 On2 Technologies Inc. All Rights Reserved.
+//
+//--------------------------------------------------------------------------
+#if !defined(ON2CRYPT_H)
+#define ON2CRYPT_H
+
+//______________________________________________________________________________
+//
+// On2Crypt.h
+// API to on2comp's encryption dll
+//--------------------------------------------------------------------------
+
+
+#ifdef _USRDLL
+#define DLLExport __declspec(dllexport)
+#else
+#define DLLExport
+#endif
+
+#define DLLCC __stdcall
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+typedef void* HOn2Encryptor;
+
+DLLExport int DLLCC MakeEncryptor(unsigned char* pString, int iLength, HOn2Encryptor* phOn2Encryptor);
+//***************************************************************************************
+// Name : MakeEncryptor
+// Description: set up an encryption session
+// Inputs : pString -> information to be used by encryptor to set up encryption session
+// iLength -> number of bytes used in pString
+// Outputs : phOn2Encryptor -> pointer to an encryption session
+// Returns : 0 = success
+//***************************************************************************************
+
+DLLExport int DLLCC GetEncryptionCode(char* pfccCode); // size of szCode must be >= 4
+//***************************************************************************************
+// Name : GetEncryptionCode
+// Description: get the 4 character code to use as a reference for this encryption dll
+// Inputs :
+// Outputs : pfccCode 4 character code
+// Returns : 0 = success
+//***************************************************************************************
+
+
+DLLExport int DLLCC GetDRMXLength(HOn2Encryptor hOn2Encryptor, int* piLength);
+//***************************************************************************************
+// Name : GetDRMXLength
+// Description: calculates the length of decryption chunk to be produced
+// Inputs : hOn2Encryptor -> handle of encryption sesion to use ( from make encryptor)
+// Outputs : piLength -> filled with length of extra information
+// Returns : 0 = success
+//***************************************************************************************
+
+DLLExport int DLLCC GenerateDRMX(HOn2Encryptor hOn2Encryptor, unsigned char* pBuffer);
+//***************************************************************************************
+// Name : GenerateDRMX
+// Description: generates a decryption chunk
+// Inputs : hOn2Encryptor -> handle of encryption sesion to use ( from make encryptor)
+// Outputs : pBuffer is filled with information necessary to decrypt the file we are
+// encrypting
+// Returns : 0 = success
+//***************************************************************************************
+
+DLLExport int DLLCC EncryptedSize(HOn2Encryptor hOn2Encryptor, int iSizeIn, int* piSizeOut);
+//***************************************************************************************
+// Name : EncryptedSize
+// Description: returns size that an encrypted chunk will be given a size in
+// Inputs : hOn2Encryptor -> handle of encryption sesion to use ( from make encryptor)
+// : iSizeIn -> size of input data
+// Outputs : piSizeOut -> size of output data
+// Returns : 0 = success
+//***************************************************************************************
+
+DLLExport int DLLCC EncryptBytes(HOn2Encryptor hOn2Encryptor, unsigned char* pBufferIn, int iSizeIn, unsigned char* pBufferOut, int iSizeOutMax, int* piSizeOut);
+//***************************************************************************************
+// Name : EncryptBytes
+// Description: encrypts bytes in input buffer and stores them to the output buffer
+// Inputs : hOn2Encryptor -> handle of encryption sesion to use ( from make encryptor)
+// : pBufferIn -> buffer holding bytes to encrypt
+// iSizeIn -> number of bytes to encrypt of that buffer
+// Outputs : pBufferOut -> buffer for holding encrypted bytes
+// iSizeOutMax -> maximum number of bytes to write to pBufferOut
+// piSizeOut -> number of bytes actually written to pbufferout
+// Returns : 0 = success
+//***************************************************************************************
+
+
+DLLExport int DLLCC EncryptorError(char* szError, int nErrorMax);
+//***************************************************************************************
+// Name : EncryptorError
+// Description: gets a string description of the last error
+// Inputs : szError -> pointer to string
+// nErrorMax -> the largest number of bytes to fill in in szerror
+// Outputs :
+// Returns : 0 = success
+//***************************************************************************************
+
+
+DLLExport int DLLCC DeleteEncryptor(HOn2Encryptor hOn2Encryptor);
+//***************************************************************************************
+// Name : DeleteEncryptor
+// Description: ends the encryption session and cleans up
+// Inputs : hOn2Encryptor -> handle of encryption sesion to use ( from make encryptor)
+// Outputs :
+// Returns : 0 = success
+//***************************************************************************************
+
+typedef int (DLLCC *PFNMakeEncryptor)(unsigned char* pString, int iLength, HOn2Encryptor* phOn2Encryptor);
+typedef int (DLLCC *PFNGetEncryptionCode)(char* pfccCode); // size of szCode must be >= 4
+typedef int (DLLCC *PFNGetDRMXLength)(HOn2Encryptor hOn2Encryptor, int* piLength);
+typedef int (DLLCC *PFNGenerateDRMX)(HOn2Encryptor hOn2Encryptor, unsigned char* pBuffer);
+typedef int (DLLCC *PFNEncryptedSize)(HOn2Encryptor hOn2Encryptor, int iSizeIn, int* piSizeOut);
+typedef int (DLLCC *PFNEncryptBytes)(HOn2Encryptor hOn2Encryptor, unsigned char* pBufferIn, int iSizeIn, unsigned char* pBufferOut, int iSizeOutMax, int* piSizeOut);
+typedef int (DLLCC *PFNEncryptorError)(char* szError, int nErrorMax);
+typedef int (DLLCC *PFNDeleteEncryptor)(HOn2Encryptor hOn2Encryptor);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // ON2CRYPT_H
diff --git a/Src/libvp6/include/On2Decrypt.h b/Src/libvp6/include/On2Decrypt.h
new file mode 100644
index 00000000..58bd18c5
--- /dev/null
+++ b/Src/libvp6/include/On2Decrypt.h
@@ -0,0 +1,75 @@
+//==========================================================================
+//
+// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
+// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
+// PURPOSE.
+//
+// Copyright (c) 1999 - 2001 On2 Technologies Inc. All Rights Reserved.
+//
+//--------------------------------------------------------------------------
+#if !defined(ON2DECRYPT_H)
+#define ON2DECRYPT_H
+
+//______________________________________________________________________________
+//
+// On2Decrypt.h
+// test api for testing the encryption code in on2crypt.h
+//--------------------------------------------------------------------------
+
+#ifdef _USRDLL
+#define DLLExport __declspec(dllexport)
+#else
+#define DLLExport
+#endif
+
+#define DLLCC __stdcall
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+typedef void* HOn2Decryptor;
+
+DLLExport int DLLCC MakeDecryptor(unsigned char* pDRMX, int iDRMXLength, HOn2Decryptor* phOn2Decryptor);
+//***************************************************************************************
+// Name : MakeDecryptor
+// Description: set up an decryption session
+// Inputs : pDRMX -> information to be used by decryptor to set up decryption session
+// iDRMXLength -> number of bytes used in pDRMX
+// Outputs : phOn2Decryptor -> pointer to an decryption session
+// Returns : 0 = success
+//***************************************************************************************
+
+DLLExport int DLLCC DecryptBytes(HOn2Decryptor hOn2Decryptor, unsigned char* pBufferIn, int iSizeIn, unsigned char* pBufferOut, int iSizeOutMax, int* piSizeOut);
+//***************************************************************************************
+// Name : DecryptBytes
+// Description: decrypts bytes in input buffer and stores them to the output buffer
+// Inputs : hOn2Decryptor -> handle of decryption sesion to use ( from make decryptor)
+// : pBufferIn -> buffer holding bytes to decrypt
+// iSizeIn -> number of bytes to decrypt of that buffer
+// Outputs : pBufferOut -> buffer for holding decrypted bytes
+// iSizeOutMax -> maximum number of bytes to write to pBufferOut
+// piSizeOut -> number of bytes actually written to pbufferout
+// Returns : 0 = success
+//***************************************************************************************
+
+DLLExport int DLLCC DeleteDecryptor(HOn2Decryptor hOn2Decryptor);
+//***************************************************************************************
+// Name : DeleteDecryptor
+// Description: ends the decryption session and cleans up
+// Inputs : hOn2Decryptor -> handle of decryption sesion to use ( from make decryptor)
+// Outputs :
+// Returns : 0 = success
+//***************************************************************************************
+
+typedef int (DLLCC *PFNMakeDecryptor)(unsigned char* pDRMX, int iDRMXLength, HOn2Decryptor* phOn2Decryptor);
+typedef int (DLLCC *PFNDecryptBytes)(HOn2Decryptor hOn2Decryptor, unsigned char* pBufferIn, int iSizeIn, unsigned char* pBufferOut, int iSizeOutMax, int* piSizeOut);
+typedef int (DLLCC *PFNDeleteDecryptor)(HOn2Decryptor hOn2Decryptor);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // ON2DECRYPT_H
diff --git a/Src/libvp6/include/PlayerModel.hpp b/Src/libvp6/include/PlayerModel.hpp
new file mode 100644
index 00000000..b29c09be
--- /dev/null
+++ b/Src/libvp6/include/PlayerModel.hpp
@@ -0,0 +1,112 @@
+#if !defined(PLAYERMODEL_HPP)
+#define PLAYERMODEL_HPP
+//______________________________________________________________________________
+//
+// PlayerModel.hpp
+//
+
+#include <string>
+#include <exception>
+#include <iosfwd>
+
+namespace on2vp
+{
+
+ //--------------------------------------
+ class PlayerModel
+ {
+ friend std::ostream& operator<<(std::ostream& os, const PlayerModel& pm);
+
+ public:
+ class Exception : public std::exception
+ {
+ public:
+ Exception(const std::string& strText);
+ ~Exception() throw();
+ const char* what() const throw();
+ private:
+ std::string m_strText;
+ };
+
+ // Any changes made to AspectRatio need to be reflected in XSAspectRatio defined in On2XS.h and On2XS.bas
+ enum AspectRatio
+ {
+ AR_Null,
+ AR_PC,
+ AR_NTSC,
+ AR_PAL
+ };
+
+ enum
+ {
+ Auto = -2,
+ Null = -1
+ };
+
+ PlayerModel(long lRateNum = 0, long lRateDenom = 0);
+ PlayerModel(const PlayerModel& pm);
+ ~PlayerModel();
+
+ PlayerModel& operator=(const PlayerModel& pm);
+
+ long bitrate() const;
+ long bufferMax() const;
+ long prebufferMax() const;
+ bool bufferPad() const;
+ long bufferRequired() const;
+ long prebufferRequired() const;
+ long rebufferRequired() const;
+ AspectRatio sourceAspectRatio() const;
+ int frameWidth() const;
+ int frameHeight() const;
+
+ void bitrate(long lBitrate);
+ void bufferMax(long lBufferMax);
+ void prebufferMax(long lPrebufferMax);
+ void bufferPad(bool bBufferPad);
+ void bufferRequired(long lBufferRequired);
+ void prebufferRequired(long lPrebufferRequired);
+ void rebufferRequired(long lRebufferRequired);
+ void frameSize(AspectRatio arSource, int iFrameWidth, int iFrameHeight);
+
+ void rate(long lRateNum, long lRateDenom);
+ void initialize(int iWidthOrig, int iHeightOrig);
+ void finalize();
+
+ void updateBuffer(long lBytesOut, long nSamples, bool bKeyFrame);
+ long bufferPadding(long lBytesOut, long nSamples);
+
+ private:
+
+ void initializeInternal();
+
+ void updateBuffer0(long lBytesOut, long nSamples, bool bKeyFrame);
+ void updateBuffer1(long lBytesOut, long nSamples, bool bKeyFrame); // Given bitrate, calculate buffer and prebuffer required
+ void updateBuffer2(long lBytesOut, long nSamples, bool bKeyFrame); // Given buffer and prebuffer size, calculate bitrate
+
+ long m_lBitrate;
+ long m_lBufferMax;
+ long m_lPrebufferMax;
+ bool m_bBufferPad;
+ long m_lBufferRequired;
+ long m_lPrebufferRequired;
+ long m_lRebufferRequired;
+ AspectRatio m_arSource;
+ int m_iFrameWidth;
+ int m_iFrameHeight;
+
+ long m_lRateNum;
+ long m_lRateDenom;
+ double m_dBytesIn;
+ double m_dBufferFilled; // Used to calculate buffer required and prebuffer required
+ double m_dBufferFilled2; // Used to calculate rebuffer required
+ bool m_bInitialized;
+ bool m_bInitializedInternal;
+ bool m_bFinalized;
+
+ void (PlayerModel::*m_updateBuffer)(long lBytesOut, long nSamples, bool bKeyFrame);
+ };
+
+} // namespace on2vp
+
+#endif // PLAYERMODEL_HPP
diff --git a/Src/libvp6/include/Rvd.hpp b/Src/libvp6/include/Rvd.hpp
new file mode 100644
index 00000000..078d6e32
--- /dev/null
+++ b/Src/libvp6/include/Rvd.hpp
@@ -0,0 +1,198 @@
+#ifndef RVD_HPP
+#define RVD_HPP
+
+#pragma warning(disable:4786)
+
+#include "FourCC.hpp"
+//#include <io.h>
+#include <windows.h>
+#include <exception>
+#include <cstdlib>
+#include <cstddef>
+#include <string>
+#include <map>
+
+namespace Rvd
+{
+ class FileError : public exception
+ {
+ public:
+ explicit FileError(const char*);
+ explicit FileError(DWORD);
+ const char* what() const;
+ private:
+ std::string message;
+ };
+
+ bool nameIsOK(const char* name);
+
+ enum Format { rgb24, rgb32, yuv12 };
+ const char* asStr(Format f);
+
+ struct Header
+ {
+ FourCC code;
+ __int32 width;
+ __int32 height;
+ __int32 blockSize;
+ FourCC compression;
+ __int32 unknown; //frame count?
+ __int32 rate;
+ __int32 scale;
+ __int8 pad[480];
+ };
+
+ typedef unsigned __int64 size_type;
+
+ size_type estimatedFileSize(
+ int width,
+ int height,
+ Format format,
+ int frameCount);
+
+
+ class File
+ {
+ public:
+
+ enum mode_t {in, out, inout};
+
+ File();
+ File(const char* name, mode_t mode);
+
+ ~File();
+
+ void open(const char* name, mode_t mode, DWORD flags = 0);
+ void close();
+
+ void setFormat(Format);
+
+ void setWidth(int w);
+ void setHeight(int h);
+
+ void setRate(int rate);
+ void setScale(int scale);
+
+ void reset(int frameNum) const;
+ void advance(int count) const;
+
+ void read(void* frame) const;
+ void write(const void* frame);
+
+ void writeHeader();
+
+ bool isOpen() const;
+ bool eof() const;
+
+ mode_t mode() const;
+ const char* name() const;
+
+ int frameNum() const;
+
+ int frameCount() const;
+ bool frameCountIsOK() const;
+
+ Format format() const;
+ const FourCC compression() const;
+
+ int width() const;
+ int height() const;
+
+ int rate() const;
+ int scale() const;
+
+ size_t frameSize() const;
+ size_t paddedFrameSize() const;
+
+ private:
+
+ File& operator=(const File&);
+ File(const File&);
+
+ //int file;
+ HANDLE m_handle;
+
+ mutable int frameNum_;
+ int frameCount_;
+ bool frameCountIsOK_;
+ char name_[_MAX_PATH];
+ mode_t mode_;
+
+ Header* const m_header;
+ Format format_;
+ size_t frameSize_;
+ size_t paddedFrameSize_;
+ size_t paddingSize_;
+
+ bool unbuffered;
+ };
+
+
+ class MappedFile
+ {
+ public:
+
+ MappedFile();
+ MappedFile(const char* name);
+
+ ~MappedFile();
+
+ void open(const char* name);
+ void close();
+
+ bool isOpen() const;
+ const char* name() const;
+
+ int frameCount() const;
+
+ Format format() const;
+
+ int width() const;
+ int height() const;
+
+ int rate() const;
+ int scale() const;
+
+ size_t frameSize() const;
+
+ void* map(int frameNum) const;
+
+ void unmap(int frameNum) const;
+ void unmap() const;
+
+ bool isMapped(int frameNum) const;
+
+ private:
+
+ MappedFile(const MappedFile&);
+ MappedFile& operator=(const MappedFile&);
+
+ void init();
+
+ Header header;
+ Format m_format;
+ size_t m_frameSize;
+ size_t m_paddedFrameSize;
+
+ std::string m_name;
+
+ HANDLE file;
+ HANDLE mapping;
+
+ DWORD allocationGranularity;
+
+ int m_frameCount;
+
+ struct ViewInfo
+ {
+ void* view;
+ void* frame;
+ };
+
+ typedef std::map<int, ViewInfo> Views;
+ mutable Views views;
+
+ };
+}
+
+#endif
diff --git a/Src/libvp6/include/VFWSetting.hpp b/Src/libvp6/include/VFWSetting.hpp
new file mode 100644
index 00000000..c7683a8c
--- /dev/null
+++ b/Src/libvp6/include/VFWSetting.hpp
@@ -0,0 +1,65 @@
+#if !defined(VFWSETTING_HPP)
+#define VFWSETTING_HPP
+//______________________________________________________________________________
+//
+// VFWSetting.hpp
+//
+
+#include "FourCC.hpp"
+#include <iosfwd>
+
+namespace on2vp
+{
+
+ //--------------------------------------
+ class VFWSetting
+ {
+ friend std::ostream& operator<<(std::ostream& os, const VFWSetting& vfws);
+
+ public:
+
+ enum Mode
+ {
+ M_Setting,
+ M_Config
+ };
+
+ enum
+ {
+ HeaderSize = 8,
+ Size = 16
+ };
+
+ VFWSetting(FourCC fcc);
+ ~VFWSetting();
+
+ FourCC fcc() const;
+ Mode mode() const;
+
+ int setting() const;
+ int value() const;
+ void settingValue(int iSetting, int iValue); // Sets mode to M_Setting
+
+ long size() const;
+ const void* data() const;
+ int data(const void* pData, unsigned long ulSize);
+
+ private:
+
+ VFWSetting(const VFWSetting& vfws); // Not implemented
+ VFWSetting& operator=(const VFWSetting& vfws); // Not implemented
+
+ int extract_(const void* pData, unsigned long ulSize);
+ void update_() const;
+
+ FourCC m_fcc;
+ Mode m_mode;
+ int m_iSetting;
+ int m_iValue;
+
+ mutable unsigned char m_pData[Size];
+ };
+
+} // namespace on2vp
+
+#endif // VFWSETTING_HPP
diff --git a/Src/libvp6/include/VP6VFWState.hpp b/Src/libvp6/include/VP6VFWState.hpp
new file mode 100644
index 00000000..6ee9d1ca
--- /dev/null
+++ b/Src/libvp6/include/VP6VFWState.hpp
@@ -0,0 +1,143 @@
+//------------------------------------------------------------------------------
+//
+// Copyright (c) 1999-2003 On2 Technologies Inc. All Rights Reserved.
+//
+//------------------------------------------------------------------------------
+//
+// $Workfile: VP6VFWState.hpp$
+// $Date: 2010/07/23 19:10:48 $
+// $Revision: 1.1 $
+//
+//------------------------------------------------------------------------------
+
+#if !defined(VP6VFWSTATE_HPP)
+#define VP6VFWSTATE_HPP
+
+#include "FourCC.hpp"
+#include <iosfwd>
+
+namespace on2vp
+{
+
+ //--------------------------------------
+ class VP6VFWState
+ {
+ friend std::ostream& operator<<(std::ostream& os, const VP6VFWState& vfws);
+
+ public:
+
+ enum Mode
+ {
+ M_Setting,
+ M_Config
+ };
+
+ enum
+ {
+ HeaderSize = 8
+ };
+
+ enum
+ {
+ ConfigUsed = 1724
+ };
+
+ struct VPConfig
+ {
+ unsigned int Used;
+ int Width;
+ int Height;
+ int TargetBitRate;
+ int Quality;
+ int RateNum;
+ int RateDenom;
+ int KeyFrameFrequency;
+ int KeyFrameDataTarget;
+ int AutoKeyFrameEnabled;
+ int AutoKeyFrameThreshold;
+ int MinimumDistanceToKeyFrame;
+ int ForceKeyFrameEvery;
+ int NoiseSensitivity;
+ int AllowDF;
+ int AllowSpatialResampling;
+ int HScale;
+ int HRatio;
+ int VScale;
+ int VRatio;
+ int ScalingMode;
+ int QuickCompress;
+ int Speed;
+ int Interlaced;
+ int FixedQ;
+ int StartingBufferLevel;
+ int OptimalBufferLevel;
+ int DropFramesWaterMark;
+ int ResampleDownWaterMark;
+ int ResampleUpWaterMark;
+ int OutputFrameRate;
+ int ErrorResilientMode;
+ int Profile;
+ int DisableGolden;
+ int VBMode;
+ int BestAllowedQ;
+ int UnderShootPct;
+ int MaxAllowedDatarate;
+ int MaximumBufferSize;
+ int TwoPassVBREnabled;
+ int TwoPassVBRBias;
+ int TwoPassVBRMaxSection;
+ int TwoPassVBRMinSection;
+ int Pass;
+ int Mode;
+ int EndUsage;
+ int Sharpness;
+ char FirstPassFile[512];
+ char SettingsFile[512];
+ char RootDirectory[512];
+
+ char Reserved[2048 - ConfigUsed];
+
+ VPConfig() :
+ Used(ConfigUsed)
+ {
+ }
+ };
+
+ VP6VFWState(FourCC fcc);
+ ~VP6VFWState();
+
+ FourCC fcc() const;
+ Mode mode() const;
+
+ static size_t nominalSize();
+
+ VPConfig& vpConfig();
+
+ size_t vpStateSize() const;
+ const void* vpState() const;
+ void vpState(const void* pVPState, size_t sizeVPState);
+
+ size_t size() const;
+ const void* data() const;
+ int data(const void* pData, size_t sizeData);
+
+ private:
+
+ VP6VFWState(const VP6VFWState& vfws); // Not implemented
+ VP6VFWState& operator=(const VP6VFWState& vfws); // Not implemented
+
+ int extract_(const void* pData, size_t sizeData);
+ void update_(const void* pVPState, size_t sizeVPState) const;
+
+ FourCC m_fcc;
+ Mode m_mode;
+
+ VPConfig m_vpConfig;
+
+ mutable void* m_pData;
+ mutable size_t m_sizeData;
+ };
+
+} // namespace on2vp
+
+#endif // VP6VFWSTATE_HPP
diff --git a/Src/libvp6/include/VPStreamData.hpp b/Src/libvp6/include/VPStreamData.hpp
new file mode 100644
index 00000000..e1705020
--- /dev/null
+++ b/Src/libvp6/include/VPStreamData.hpp
@@ -0,0 +1,117 @@
+#if !defined(VPSTREAMDATA_HPP)
+#define VPSTREAMDATA_HPP
+//______________________________________________________________________________
+//
+// VPStreamData.hpp
+//
+
+//______________________________________________________________________________
+// Include Files and Forward Declarations
+
+#include "PlayerModel.hpp"
+#include <vector>
+#include <iosfwd>
+
+namespace on2vp
+{
+
+//______________________________________________________________________________
+// Macro, Enumeration, and Constant Definitions
+
+//______________________________________________________________________________
+// Type, Struct, and Class Definitions
+
+ //--------------------------------------
+ class StreamData
+ {
+ friend std::ostream& operator<<(std::ostream& os, const StreamData& sd);
+
+ public:
+
+ StreamData();
+ StreamData(const unsigned char* const pData, unsigned long ulSize);
+ StreamData(const StreamData& sd);
+ ~StreamData();
+
+ StreamData& operator=(const StreamData& sd);
+
+ unsigned long versionOrig() const;
+ unsigned long sizeOrig() const;
+ unsigned long version() const;
+ unsigned long size() const;
+ const unsigned char* data() const;
+
+ int data(const unsigned char* pData, unsigned long ulSize);
+
+ // Interpreted data
+
+ const PlayerModel& playerModel() const;
+ PlayerModel& playerModel();
+
+ bool encrypted() const;
+ void encrypted(bool bEncrypted);
+
+ private:
+ class VersionInfo
+ {
+ public:
+ VersionInfo(long lVersion, long lSize, bool bExtra) :
+ m_lVersion(lVersion),
+ m_lSize(lSize),
+ m_bExtra(bExtra)
+ {
+ }
+
+ long version() const
+ {
+ return m_lVersion;
+ }
+
+ long size() const
+ {
+ return m_lSize;
+ }
+
+ bool extra() const
+ {
+ return m_bExtra;
+ }
+
+ private:
+ long m_lVersion;
+ long m_lSize;
+ bool m_bExtra;
+ };
+
+ enum
+ {
+ VersionMax = 6
+ };
+
+ void init_();
+ int extract_(const unsigned char* pData, unsigned long ulSize);
+ void update_();
+
+ static std::vector<VersionInfo> m_vVersionInfo;
+
+ unsigned long m_ulVersionOrig;
+ unsigned long m_ulSizeOrig;
+
+ unsigned char* m_pData;
+ long m_lDataSize;
+
+ // Interpreted data
+
+ PlayerModel m_pm;
+ bool m_bEncrypted;
+ };
+
+//______________________________________________________________________________
+// Object and Function Declarations
+
+//______________________________________________________________________________
+// Object and Function Definitions
+
+} // namespace on2vp
+
+#endif // VPSTREAMDATA_HPP
diff --git a/Src/libvp6/include/Vid.hpp b/Src/libvp6/include/Vid.hpp
new file mode 100644
index 00000000..beb336b8
--- /dev/null
+++ b/Src/libvp6/include/Vid.hpp
@@ -0,0 +1,167 @@
+#ifndef VID_HPP
+#define VID_HPP
+
+#pragma warning (disable:4786)
+
+#include <windows.h>
+#include <cstdlib>
+#include <string>
+#include <map>
+#include <exception>
+
+namespace Vid
+{
+
+ const enum Format { uyvy }; // format = uyvy;
+
+ enum { rate = 2997, scale = 100 };
+
+ class FileError : public exception
+ {
+ public:
+ explicit FileError(const char* message);
+ explicit FileError(DWORD id);
+ const char* what() const;
+ private:
+ std::string message;
+ };
+
+
+ bool nameIsOK(const char* name);
+
+ typedef __int64 offset_type;
+ typedef unsigned __int64 size_type;
+
+ class File
+ {
+ public:
+
+ static const Format format;
+
+ enum mode_t {in, out};
+
+ File();
+ File(const char* name, mode_t mode, int iWidth = 0, int iHeight = 0);
+ ~File();
+
+ void open(
+ const char* name,
+ mode_t mode,
+ DWORD flags = FILE_ATTRIBUTE_NORMAL);
+
+ void close();
+
+ void reset(int frameNum) const;
+ void advance(int count) const;
+
+ void read(void* frame) const;
+ void write(const void* frame);
+
+ bool isOpen() const;
+
+ bool eof() const;
+
+ mode_t mode() const;
+
+ const char* name() const;
+
+ int frameNum() const;
+
+ int frameCount() const;
+
+ size_type size() const;
+
+ void dimensions(int iWidth, int iHeight);
+ int width() const;
+ int height() const;
+ int frameSize() const;
+
+ private:
+
+ File& operator=(const File&);
+ File(const File&);
+
+ HANDLE m_handle;
+
+ // When opening for write with FILE_FLAG_OVERLAPPED
+ HANDLE m_hEvent;
+ OVERLAPPED m_overlapped;
+
+ mutable int frameNum_;
+
+ int frameCount_;
+
+ char name_[_MAX_PATH];
+
+ mode_t mode_;
+
+ int m_iWidth;
+ int m_iHeight;
+ int m_iFrameSize;
+ };
+
+
+ class MappedFile
+ {
+ public:
+
+ //For now, just implement read-only.
+
+ MappedFile();
+ MappedFile(const char* name, int iWidth = 0, int iHeight = 0);
+
+ ~MappedFile();
+
+ void open(const char* name);
+ void close();
+
+ const char* name() const;
+
+ int frameCount() const;
+
+ void* map(int frameNum) const;
+
+ void unmap(int frameNum) const;
+ void unmap() const;
+
+ bool isMapped(int frameNum) const;
+ int mapCount() const;
+
+ void dimensions(int iWidth, int iHeight);
+ int width() const;
+ int height() const;
+ int frameSize() const;
+
+ private:
+
+ MappedFile(const MappedFile&);
+ MappedFile& operator=(const MappedFile&);
+
+ void init(int iWidth = 0, int iHeight = 0);
+
+ HANDLE file;
+ HANDLE mapping;
+
+ DWORD allocationGranularity;
+
+ int m_frameCount;
+
+ struct ViewInfo
+ {
+ void* view;
+ void* frame;
+ };
+
+ typedef std::map<int, ViewInfo> Views;
+ mutable Views views;
+
+ std::string m_name;
+
+ int m_iWidth;
+ int m_iHeight;
+ int m_iFrameSize;
+ };
+
+}
+
+#endif
diff --git a/Src/libvp6/include/WAV.hpp b/Src/libvp6/include/WAV.hpp
new file mode 100644
index 00000000..5db3d4bd
--- /dev/null
+++ b/Src/libvp6/include/WAV.hpp
@@ -0,0 +1,130 @@
+#ifndef WAV_HPP
+#define WAV_HPP
+
+#include "FourCC.hpp"
+#include <io.h>
+#include <exception>
+#include <string>
+#include <iosfwd>
+#include <vector>
+
+
+namespace WAV
+{
+ class FileError : public exception
+ {
+ public:
+ explicit FileError(const char* message);
+ const char* what() const;
+ private:
+ const std::string message;
+ };
+
+
+ struct Format
+ {
+ unsigned short formatTag;
+ unsigned short nChannels;
+ unsigned long samplesPerSec;
+ unsigned long avgBytesPerSec;
+ unsigned short blockAlign;
+ unsigned short bitsPerSample;
+
+ typedef std::vector<unsigned char> ByteArray;
+ ByteArray extra;
+ };
+
+ std::ostream& operator<<(std::ostream&, const Format&);
+
+ typedef __int64 offset_t;
+
+
+ class File
+ {
+ public:
+
+ enum mode_t { in, out, inout };
+
+ File();
+ File(const char* name, mode_t mode);
+
+ ~File();
+
+ void open(const char* name, mode_t mode);
+ void close();
+
+ bool isOpen() const;
+ bool eof() const;
+
+ //size_t sampleNum() const;
+ //size_t sampleCount() const;
+
+ //void seekSample(size_t sampleNum) const;
+
+ offset_t offset() const;
+ void seekOffset(offset_t) const;
+
+ size_t read(void* buffer, size_t size) const;
+ void write(const void* buffer, size_t size);
+
+ mode_t mode() const;
+ const char* name() const;
+
+ const Format& format() const;
+ Format& format();
+
+ void seekFormat() const;
+
+ //void readFormat() const;
+ void readFormatChunk() const;
+
+ void readFactChunk() const;
+
+ void setFactSize(size_t);
+ size_t factSize() const;
+
+ void seekFact() const;
+
+ void writeFact(const void*, size_t);
+ void readFact(void* buffer, size_t size) const;
+
+ void writeFormat();
+ void writeFormatChunk();
+
+ size_t dataSize() const;
+
+ private:
+
+ File(const File&);
+ File& operator=(const File&);
+
+ void init();
+
+ void seek(__int64, int) const;
+
+ const FourCC queryId() const;
+ const FourCC readId() const;
+
+ void writeId(const char* id);
+
+ void writeSize(size_t size);
+ size_t readSize() const;
+
+ int handle_;
+
+ __int64 dataPosn;
+ size_t m_dataSize;
+
+ //size_t m_sampleCount;
+
+ char name_[_MAX_PATH];
+ mode_t mode_;
+
+ mutable Format format_;
+
+ mutable size_t m_factSize;
+ };
+
+}
+
+#endif
diff --git a/Src/libvp6/include/cclib.h b/Src/libvp6/include/cclib.h
new file mode 100644
index 00000000..ed58877f
--- /dev/null
+++ b/Src/libvp6/include/cclib.h
@@ -0,0 +1,183 @@
+#ifndef _CCLIB_H
+#define _CCLIB_H
+#include "cpuidlib.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#else
+#if !defined(bool)
+ typedef int bool;
+#endif
+#endif
+
+int InitCCLib( PROCTYPE CpuType );
+
+void DeInitCCLib( void );
+
+extern void (*RGB32toYV12)( unsigned char *RGBABuffer, int ImageWidth, int ImageHeight,
+ unsigned char *YBuffer, unsigned char *UBuffer, unsigned char *VBuffer, int SrcPitch,int DstPitch );
+
+extern void (*RGB24toYV12)( unsigned char *RGBBuffer, int ImageWidth, int ImageHeight,
+ unsigned char *YBuffer, unsigned char *UBuffer, unsigned char *VBuffer, int SrcPitch,int DstPitch );
+
+extern void (*UYVYtoYV12)( unsigned char *UYVYBuffer, int ImageWidth, int ImageHeight,
+ unsigned char *YBuffer, unsigned char *UBuffer, unsigned char *VBuffer, int SrcPitch,int DstPitch );
+
+extern void (*YUY2toYV12)( unsigned char *UYVYBuffer, int ImageWidth, int ImageHeight,
+ unsigned char *YBuffer, unsigned char *UBuffer, unsigned char *VBuffer, int SrcPitch,int DstPitch );
+
+extern void (*YVYUtoYV12)( unsigned char *YVYUBuffer, int ImageWidth, int ImageHeight,
+ unsigned char *YBuffer, unsigned char *UBuffer, unsigned char *VBuffer, int SrcPitch,int DstPitch );
+
+extern void RGB24toYV12F
+(
+ unsigned char *RGBBuffer,
+ int ImageWidth,
+ int ImageHeight,
+ unsigned char *YBuffer,
+ unsigned char *UBuffer,
+ unsigned char *VBuffer,
+ int SrcPitch,
+ int DstPitch
+);
+
+extern void RGB32toYV12F
+(
+ unsigned char *RGBBuffer,
+ int ImageWidth,
+ int ImageHeight,
+ unsigned char *YBuffer,
+ unsigned char *UBuffer,
+ unsigned char *VBuffer,
+ int SrcPitch,
+ int DstPitch
+);
+
+extern void UYVYtoYV12F
+(
+ unsigned char *UYVYBuffer,
+ int ImageWidth,
+ int ImageHeight,
+ unsigned char *YBuffer,
+ unsigned char *UBuffer,
+ unsigned char *VBuffer,
+ int SrcPitch,
+ int DstPitch
+);
+
+extern void YUY2toYV12F
+(
+ unsigned char *YUY2Buffer,
+ int ImageWidth,
+ int ImageHeight,
+ unsigned char *YBuffer,
+ unsigned char *UBuffer,
+ unsigned char *VBuffer,
+ int SrcPitch,
+ int DstPitch
+);
+
+extern void YVYUtoYV12F
+(
+ unsigned char *YVYUBuffer,
+ int ImageWidth,
+ int ImageHeight,
+ unsigned char *YBuffer,
+ unsigned char *UBuffer,
+ unsigned char *VBuffer,
+ int SrcPitch,
+ int DstPitch
+);
+
+/*
+ * Macros to make it easier to call the needed functions
+ */
+#define CC_RGB32toYV12( _RGBABuffer, _ImageWidth, _ImageHeight, _YBuffer, _UBuffer, _VBuffer ) \
+ (*RGB32toYV12)( _RGBABuffer, _ImageWidth, _ImageHeight, _YBuffer, _UBuffer, _VBuffer, _ImageWidth*4, _ImageWidth )
+
+#define CC_RGB24toYV12( _RGBBuffer, _ImageWidth, _ImageHeight, _YBuffer, _UBuffer, _VBuffer ) \
+ (*RGB24toYV12)( _RGBBuffer, _ImageWidth, _ImageHeight, _YBuffer, _UBuffer, _VBuffer, _ImageWidth*3, _ImageWidth )
+
+#define CC_UYVYtoYV12( _UYVYBuffer, _ImageWidth, _ImageHeight, _YBuffer, _UBuffer, _VBuffer ) \
+ (*UYVYtoYV12)( _UYVYBuffer, _ImageWidth, _ImageHeight, _YBuffer, _UBuffer, _VBuffer, _ImageWidth*2, _ImageWidth )
+
+#define CC_YUY2toYV12( _YUY2Buffer, _ImageWidth, _ImageHeight, _YBuffer, _UBuffer, _VBuffer ) \
+ (*YUY2toYV12)( _YUY2Buffer, _ImageWidth, _ImageHeight, _YBuffer, _UBuffer, _VBuffer, _ImageWidth*2, _ImageWidth )
+
+#define CC_YVYUtoYV12( _YVYUBuffer, _ImageWidth, _ImageHeight, _YBuffer, _UBuffer, _VBuffer ) \
+ (*YVYUtoYV12)( _YVYUBuffer, _ImageWidth, _ImageHeight, _YBuffer, _UBuffer, _VBuffer, _ImageWidth*2, _ImageWidth )
+
+// super generic rgb to yuv color conversion can handle any rgb to yuv conversion
+// provided r,g,b components are 1 byte apiece, and that the resulting y is 1 byte
+extern void ConvertRGBtoYUV(
+ const unsigned char* const pucSourceR, const unsigned char* const pucSourceG, const unsigned char* const pucSourceB,
+ int width, int height, int rgb_step, int rgb_pitch,
+ unsigned char* const pucDestY, unsigned char* const pucDestU, unsigned char* const pucDestV,
+ int uv_width_shift, int uv_height_shift,
+ int y_step, int y_pitch,int uv_step,int uv_pitch);
+
+extern void ConvertRGBtoYUVI(
+ const unsigned char* const pucSourceR, const unsigned char* const pucSourceG, const unsigned char* const pucSourceB,
+ int iWidth, int iHeight, int iStepRGB, int iStrideRGB,
+ unsigned char* const pucDestY, unsigned char* const pucDestU, unsigned char* const pucDestV,
+ int uv_width_shift, int uv_height_shift,
+ int iStepY, int iStrideY, int iStepUV, int iStrideUV);
+
+// This assumes 3 byte RGB data with the same component ordering in the source and destination
+extern void ConvertRGBtoRGB(const unsigned char* const pucSource, long lWidth, long lHeight, long lStepIn, long lStrideIn,
+ unsigned char* const pucDest, long lStepOut, long lStrideOut);
+
+extern void ConvertYUVtoRGB(
+ const unsigned char* const pucYPlane, const unsigned char* const pucUPlane, const unsigned char* const pucVPlane,
+ long lWidth, long lHeight,
+ long uv_width_shift, long uv_height_shift, // not used, should both be set to 1
+ long lStepY, long lStrideY,long lStepUV, long lStrideUV,
+ unsigned char* const pucRPlane, unsigned char* const pucGPlane, unsigned char* const pucBPlane,
+ long lStepRGB, long lStrideRGB);
+
+extern void ConvertYUVItoRGB(
+ const unsigned char* const pucYPlane, const unsigned char* const pucUPlane, const unsigned char* const pucVPlane,
+ long lWidth, long lHeight,
+ long uv_width_shift, long uv_height_shift, // not used, should both be set to 1
+ long lStepY, long lStrideY,long lStepUV, long lStrideUV,
+ unsigned char* const pucRPlane, unsigned char* const pucGPlane, unsigned char* const pucBPlane,
+ long lStepRGB, long lStrideRGB);
+
+extern void ConvertYUVtoRGB2(
+ const unsigned char* const pucYPlane, const unsigned char* const pucUPlane, const unsigned char* const pucVPlane,
+ long lWidth, long lHeight,
+ long uv_width_shift, long uv_height_shift, // not used, should both be set to 1
+ long lStepY, long lStrideY,long lStepUV, long lStrideUV,
+ unsigned char* const pucRPlane, unsigned char* const pucGPlane, unsigned char* const pucBPlane,
+ long lStepRGB, long lStrideRGB,
+ bool bSupersampleHoriz, bool bSupersampleVert);
+
+extern void ConvertYUVItoRGB2(
+ const unsigned char* const pucYPlane, const unsigned char* const pucUPlane, const unsigned char* const pucVPlane,
+ long lWidth, long lHeight,
+ long uv_width_shift, long uv_height_shift, // not used, should both be set to 1
+ long lStepY, long lStrideY,long lStepUV, long lStrideUV,
+ unsigned char* const pucRPlane, unsigned char* const pucGPlane, unsigned char* const pucBPlane,
+ long lStepRGB, long lStrideRGB,
+ bool bSupersampleHoriz, bool bSupersampleVert);
+
+// This assumes packed planar data
+extern void ConvertYUVtoYUV(const unsigned char* const pucYIn, const unsigned char* const pucUV1In, const unsigned char* const pucUV2In,
+ long m_lWidth, long m_lHeight,
+ unsigned char* const pucYOut, unsigned char* const pucUV1Out, unsigned char* const pucUV2Out);
+
+// This assumes packed planar data
+extern void ConvertYUVtoYUVI(const unsigned char* const pucYIn, const unsigned char* const pucUV1In, const unsigned char* const pucUV2In,
+ long m_lWidth, long m_lHeight,
+ unsigned char* const pucYOut, unsigned char* const pucUV1Out, unsigned char* const pucUV2Out);
+
+// This assumes packed planar data
+extern void ConvertYUVItoYUV(const unsigned char* const pucYIn, const unsigned char* const pucUV1In, const unsigned char* const pucUV2In,
+ long m_lWidth, long m_lHeight,
+ unsigned char* const pucYOut, unsigned char* const pucUV1Out, unsigned char* const pucUV2Out);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _CCLIB_H */
diff --git a/Src/libvp6/include/codec_common_interface.h b/Src/libvp6/include/codec_common_interface.h
new file mode 100644
index 00000000..590b5a32
--- /dev/null
+++ b/Src/libvp6/include/codec_common_interface.h
@@ -0,0 +1,95 @@
+/****************************************************************************
+*
+* Module Title : codec_common_if.h
+*
+* Description : Common codec definitions.
+*
+****************************************************************************/
+#ifndef __INC_CODEC_COMMON_INTERFACE_H
+#define __INC_CODEC_COMMON_INTERFACE_H
+
+/****************************************************************************
+* Macros
+****************************************************************************/
+#define __export
+#define _export
+#define DllExport __declspec( dllexport )
+#define DllImport __declspec( dllimport )
+
+// Playback error codes
+#define NO_DECODER_ERROR 0
+#define REMOTE_DECODER_ERROR -1
+
+#define DFR_BAD_DCT_COEFF -100
+#define DFR_ZERO_LENGTH_FRAME -101
+#define DFR_FRAME_SIZE_INVALID -102
+#define DFR_OUTPUT_BUFFER_OVERFLOW -103
+#define DFR_INVALID_FRAME_HEADER -104
+#define FR_INVALID_MODE_TOKEN -110
+#define ETR_ALLOCATION_ERROR -200
+#define ETR_INVALID_ROOT_PTR -201
+#define SYNCH_ERROR -400
+#define BUFFER_UNDERFLOW_ERROR -500
+#define PB_IB_OVERFLOW_ERROR -501
+
+// External error triggers
+#define PB_HEADER_CHECKSUM_ERROR -601
+#define PB_DATA_CHECKSUM_ERROR -602
+
+// DCT Error Codes
+#define DDCT_EXPANSION_ERROR -700
+#define DDCT_INVALID_TOKEN_ERROR -701
+
+// ExceptionErrors
+#define GEN_EXCEPTIONS -800
+#define EX_UNQUAL_ERROR -801
+
+// Unrecoverable error codes
+#define FATAL_PLAYBACK_ERROR -1000
+#define GEN_ERROR_CREATING_CDC -1001
+#define GEN_THREAD_CREATION_ERROR -1002
+#define DFR_CREATE_BMP_FAILED -1003
+
+/****************************************************************************
+* Typedefs
+****************************************************************************/
+typedef struct // YUV buffer configuration structure
+{
+ int YWidth;
+ int YHeight;
+ int YStride;
+
+ int UVWidth;
+ int UVHeight;
+ int UVStride;
+
+ char *YBuffer;
+ char *UBuffer;
+ char *VBuffer;
+
+} YUV_BUFFER_CONFIG;
+
+typedef enum
+{
+ C_SET_KEY_FRAME,
+ C_SET_FIXED_Q,
+ C_SET_FIRSTPASS_FILE,
+ C_SET_EXPERIMENTAL_MIN,
+ C_SET_EXPERIMENTAL_MAX = C_SET_EXPERIMENTAL_MIN + 255,
+ C_SET_CHECKPROTECT,
+ C_SET_TESTMODE,
+ C_SET_INTERNAL_SIZE,
+ C_SET_RECOVERY_FRAME,
+ C_SET_REFERENCEFRAME,
+ C_SET_GOLDENFRAME
+} C_SETTING;
+
+typedef enum
+{
+ MAINTAIN_ASPECT_RATIO = 0x0,
+ SCALE_TO_FIT = 0x1,
+ CENTER = 0x2,
+ OTHER = 0x3
+} SCALE_MODE;
+
+#endif
diff --git a/Src/libvp6/include/dkpltfrm.h b/Src/libvp6/include/dkpltfrm.h
new file mode 100644
index 00000000..40bda1ab
--- /dev/null
+++ b/Src/libvp6/include/dkpltfrm.h
@@ -0,0 +1,73 @@
+//==========================================================================
+//
+// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
+// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
+// PURPOSE.
+//
+// Copyright (c) 1999 - 2001 On2 Technologies Inc. All Rights Reserved.
+//
+//--------------------------------------------------------------------------
+
+#ifndef _dkpltfrm_h
+#define _dkpltfrm_h
+/********************************************************
+
+ PC for Win95/DOS/etc...
+
+********************************************************/
+
+/*
+#define DX_COUNTERS 0
+*/
+
+
+/* #define VOXWARE_WIN32 1 */
+
+
+#define SUPPORT565 1
+#define DX_TR20 1
+#define TINKER 1
+#define LARGECHUNKS 1
+
+#define RGBORDER 0
+#define BGRORDER 1
+
+
+#define DKTRUE 1
+#define DKFALSE !DKTRUE
+
+#define TBLOFFSET 0
+#define CENTER_TABLE 0
+
+#define BLACK16X2 0x00000000
+
+//#include "nofar.h"
+#include "littlend.h"
+
+#define LIMITREADS /* limit reads average frame size */
+#define LIMIT_1_5 /* limit reads to 1.5x the average frame size */
+#define DISPLAYDIB 0
+
+#define AUDIOINTERLEAVED 1
+typedef int GfsHn;
+#define slow_seek duck_seek
+#define gooseCD(x,y)
+
+#define COLORORDER RGBORDER
+
+#define SWAPENDS 0
+
+#define HW_CD_BUFFER 0
+#define CD_ONLY 0
+
+#define DX24BIT
+
+
+#if !defined(UINT64)
+typedef unsigned __int64 UINT64;
+#endif
+
+
+
+#endif /* include guards */
diff --git a/Src/libvp6/include/duck_bmp.h b/Src/libvp6/include/duck_bmp.h
new file mode 100644
index 00000000..5b4fa291
--- /dev/null
+++ b/Src/libvp6/include/duck_bmp.h
@@ -0,0 +1,79 @@
+#ifndef _duck_bmp_h
+#define _duck_bmp_h
+
+#include "dkpltfrm.h"
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+typedef struct tDKBITMAP_old
+{
+ unsigned long ulFormatTag;
+ unsigned long usWidth; /* width */
+ unsigned long usHeight; /* height */
+ unsigned long bmWidthBytes;
+ unsigned short bmPlanes;
+ unsigned short usDepth;
+ unsigned int ulHandler;
+
+} DKBITMAP_old; /* Depricated please ! */
+
+
+/* This is the REAL BITMAP */
+typedef struct tDKBITMAP {
+ unsigned long bmType;
+ unsigned long bmWidth;
+ unsigned long bmHeight;
+ unsigned long bmWidthBytes;
+ unsigned short bmPlanes;
+ unsigned short bmBitsPixel;
+ void* bmBits;
+} DKBITMAP;
+
+
+
+#if !defined(DWORD)
+#define DWORD unsigned int
+#endif
+
+#if !defined(WORD)
+#define WORD unsigned short
+#endif
+
+
+
+
+typedef struct DK_BITMAPINFOHEADER_t
+{
+ DWORD biSize;
+ DWORD biWidth;
+ DWORD biHeight;
+ WORD biPlanes;
+ WORD biBitCount;
+ DWORD biCompression;
+ DWORD biSizeImage;
+ DWORD biXPelsPerMeter;
+ DWORD biYPelsPerMeter;
+ DWORD biClrUsed;
+ DWORD biClrImportant;
+
+ DWORD fccHandler; /* hopefully this never matters */
+ DWORD dxFlavor;
+} DK_BITMAPINFOHEADER;
+
+
+static int DK_BITMAPINFOHEADER_REFLECT[ ] = { 4,4,4,2,2, 4,4,4,4,4,4,4,4 };
+
+
+
+#undef WORD
+#undef DWORD
+
+
+
+
+#if defined(__cplusplus)
+}
+#endif
+#endif
diff --git a/Src/libvp6/include/duck_dxa.h b/Src/libvp6/include/duck_dxa.h
new file mode 100644
index 00000000..6259fc0d
--- /dev/null
+++ b/Src/libvp6/include/duck_dxa.h
@@ -0,0 +1,230 @@
+#ifndef _duck_dxa_h
+#define _duck_dxa_h
+
+
+#include "duck_wav.h"
+
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+
+typedef struct tXAudioSource* DXL_XAUDIOSRC_HANDLE; /* forward looking ! */
+
+
+#define MAX_AUDIO_REGISTRATIONS 20
+
+/* Structure used to register DXA plugins with dxa by formatTag. */
+/*-------------------------------------------------------------------------*/
+typedef struct tXAudioRegistration {
+ unsigned short formatTag;
+ int (*audio_dxer_init)(DXL_XAUDIOSRC_HANDLE src);
+ int (*audio_dxer_dx)(DXL_XAUDIOSRC_HANDLE src, void *left, void *right, int nSamples);
+ int (*audio_dxer_exit)(DXL_XAUDIOSRC_HANDLE src);
+ int (*audio_dxer_clear)(DXL_XAUDIOSRC_HANDLE src);
+} DXL_AUDIO_REGISTRATION;
+
+
+
+/* If it's not documented here, if it's only defined here ... then it's probably not needed by most codec plugins */
+/* It may only be used internally to dxa . */
+/*----------------------------------------------------------------------------------------------------------------*/
+typedef struct tXAudioSource
+{
+ unsigned char *addr; /* address from which to read compressed audio bytes */
+ int totalPos;
+ int length; /* length of compressed audio bytes to read from buffer */
+ int interleave;
+ short aiSamp[2],aiStepIndex[2];
+ int blockFinished; /* flags audio system that new data in buffer */
+ int samplesRead;
+ UINT64 profileStartTime;
+ UINT64 profileEndTime;
+ UINT64 dxClocks;
+ UINT64 samplesDXed;
+ short iFirstNibble;
+ short iNextInput;
+ short sum,diff,nudiff;
+ DKWAVEFORM wv; /* details of the compressed audio data */
+ DXL_AUDIO_REGISTRATION registration;
+ void* more; /* user data ... plugin data */
+
+} DXL_XAUDIOSRC;
+
+
+
+typedef struct tAudioBuff *DXL_AUDIODST_HANDLE;
+
+
+
+
+/* audio function prototypes */
+
+/*@
+@Name DXL_InitAudio
+@Description Initialize audio decompression services. This function allocates memory for requested object pools.
+@Return value DXL_OK on success, or negative error code.
+@*/
+int DXL_InitAudio(
+ int srcs, /* max number of audio sources to be created. */
+ int dsts /* max number of audio destinations to be created. */
+);
+
+
+
+/*@
+@Name DXL_ExitAudio
+@Description Shutdown audio decompression services, freeing allocated objects.
+@Return value none.
+@*/
+void DXL_ExitAudio(void);
+
+
+typedef struct tDKWAVEFORM *DKWAVEFORMPTR; /* place holder pointer */
+
+
+
+/*@
+@Name DXL_CreateXAudioSrc
+@Description Create a compressed audio source (decompressor)
+@Return value returns an DXL_XAUDIOSRC_HANDLE or null unable to create audio source object.
+@*/
+DXL_XAUDIOSRC_HANDLE DXL_CreateXAudioSrc(
+
+ DKWAVEFORMPTR wv, /* pointer to compressed waveform struct describing the audio input. */
+ unsigned char *addr, /* address of compressed data */
+ int length /* length of compressed data in bytes. */
+);
+
+
+
+/*@
+@Name DXL_AlterXAudioData
+@Description Link an audio decompressor to the next unit of compressed data.
+This function cannot change the type of xSource on the fly. That must remain consistent.
+Setting the address of the audio data to null causes the xSource to generate an infinate number of "zero" value samples.
+@Return value void
+@*/
+void DXL_AlterXAudioData(
+ DXL_XAUDIOSRC_HANDLE xSource, /* handle to compressed audio source */
+ unsigned char *addr, /* pointer to new compressed audio data */
+ int length /* length of compressed data in bytes. */
+);
+
+
+
+
+/*@
+@Name DXL_DestroyXAudioSrc
+@Description clears an audio decompressor and returns it to the pool.
+@Return value void
+@*/
+void DXL_DestroyXAudioSrc(
+ DXL_XAUDIOSRC_HANDLE xSource /* compressed audio source */
+);
+
+
+
+/*@
+@Name DXL_CreateAudioDst
+@Description Create a audio destination description. When numChannel equals 2 but addrR is null, it
+is assumed that multi-channel samples should be interleaved within the dest buffer pointed to by addrL.
+@Return value returns an object of type DXL_AUDIODST_HANDLE, and audio destination.
+@*/
+DXL_AUDIODST_HANDLE DXL_CreateAudioDst(
+ void *addrL, /* pointer to left audio destination channel */
+ void *addrR, /* pointer to right audio destination channel */
+ int length, /* audio buffer size in bytes. */
+ int bitDepth, /* bits per sample */
+ int numChannels, /* number of audio channels */
+ int sampleRate /* samples per second */
+);
+
+
+
+/*@
+@Name DXL_AlterAudioDst
+@Description Change characteristics of audio destination.
+Specify 0 or null values for no change.
+@Return value void
+@*/
+void DXL_AlterAudioDst(
+ DXL_AUDIODST_HANDLE dst, /* handle to audio destionation */
+ void *addrL, /* pointer to left audio destination channel */
+ void *addrR, /* pointer to right audio destination channel */
+ int length, /* audio buffer size in bytes. */
+ int bitDepth, /* bits per sample (8 or 16) */
+ int numChannels, /* number of audio channels (1 or 2) */
+ int sampleRate /* samples per second */
+);
+
+
+
+/*@
+@Name DXL_DestroyAudioDst
+@Description clears and audio destination object and returns it to the pool.
+@Return value none.
+@*/
+void DXL_DestroyAudioDst(
+ DXL_AUDIODST_HANDLE dst /* handle to audio destination */
+);
+
+
+
+/*@
+@Name DXL_dxAudio
+@Description decompress up to maxSamplesToDecompress. The number of samples transferred is controlled by two factors.
+One factor is the limit parameter. The other factor is the number of remaining samples in the src (internal buffer).
+If the function returns less that the desired number of samples, get another audio record (via HFB_GetStreamingData()) for source data and try again.
+@Return value returns the actual number of samples decompressed
+@*/
+int DXL_dxAudio(
+ DXL_XAUDIOSRC_HANDLE src, /* handle to compressed audio source. */
+ DXL_AUDIODST_HANDLE dst, /* handle to uncompressed audio destination */
+ int maxSamplesToDecompress /* Try to decompress up to this many samples to the destination */
+);
+
+
+/*@
+@Name DXL_ClearAudio
+@Description Clears any internal audio buffers compressed and/or decompressed data so that playback may start from a new point.
+@Return value
+@*/
+int DXL_ClearAudio(DXL_XAUDIOSRC_HANDLE xSourcePublic);
+
+
+
+int DXL_RegisteredAudioDXerGet(DXL_AUDIO_REGISTRATION *oneRegistration);
+
+int DXL_RegisteredAudioDXerSet(
+ unsigned short formatTag,
+ int (*audio_dxer_init) (DXL_XAUDIOSRC_HANDLE src),
+ int (*audio_dxer_dx) (DXL_XAUDIOSRC_HANDLE src, void *left, void *right, int nSamples),
+ int (*audio_dxer_exit) (DXL_XAUDIOSRC_HANDLE src),
+ int (*audio_dxer_clear) (DXL_XAUDIOSRC_HANDLE src)
+ );
+
+
+
+void DXL_AudioAccurateTime(UINT64* temp);
+
+
+/* Register one of the On2 dxa plugins */
+/*-------------------------------------*/
+int DXL_RegisterAVC(void);
+int DXL_RegisterAC3(void);
+int DXL_RegisterQDesign(void);
+int DXL_RegisterACM(unsigned short formatTag);
+int DXL_RegisterDK4(void);
+int DXL_RegisterMP3(void);
+
+
+
+
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* include guards */
diff --git a/Src/libvp6/include/duck_dxl.h b/Src/libvp6/include/duck_dxl.h
new file mode 100644
index 00000000..942090b9
--- /dev/null
+++ b/Src/libvp6/include/duck_dxl.h
@@ -0,0 +1,583 @@
+#ifndef _duck_dxl_h
+#define _duck_dxl_h
+
+
+#include "duck_bmp.h"
+
+
+/******************************************************************************\
+<table BGCOLOR=#FFC0C0 border=1 WIDTH=100% ><tr><td><b>
+ duck_dxl.h </b></td><td><b> TrueMotion include file for decompression libraries </b>
+
+</td></tr><tr><td>&nbsp</td><td> Version: 6.0.0
+</td></tr><tr><td>&nbsp</td><td> Updated: $Date: 2011/06/29 19:50:29 $
+</td></tr><tr><td>&nbsp</td><td> Copyright (c) 1994-98, The Duck Corp. All rights reserved.
+</td></tr><tr><td>Important Objects</td><td>The On2 Decompression services tries to abstract the various objects
+used to decompress and render both audio and video. This allows the overall API to flex and accomodate new
+decompression schemes and new destinations.
+</td></tr><tr><td>DXL_XIMAGE_HANDLE</td><td>Abstract container object used to organize and control compressed
+video.
+</td></tr><tr><td>DXL_VSCREEN_HANDLE</td><td>Abstract container object used to organize and control display of
+uncompressed video to a surface.
+</td></tr><tr><td>DXL_XAUDIOSRC_HANDLE</td><td>Abstract container object used to organize and control
+compressed audio.
+</td></tr><tr><td>DXL_AUDIODST_HANDLE</td><td>Abstract container object used to organize and control
+rendering / playing of uncompressed audio.
+</td></tr>
+</table>
+******************************************************************************/
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+/* enumerated data types */
+
+typedef enum BLITQUALITY {
+ DXBLIT_SAME = 0, /* Blit directly, w/o stretching */
+ DXBLIT_R1,
+ DXBLIT_R2,
+ DXBLIT_STRETCH, /* double horizontally, skip lines vertically */
+ DXBLIT_R3,
+ DXBLIT_STRETCH_BRIGHT, /* double horizontally, interpolate vertically */
+ DXBLIT_R4,
+ DXBLIT_R5,
+ DXBLIT_R6,
+ DXBLIT_NONE,
+ DXBLITMAX
+} dxvBlitQuality ;
+
+typedef enum BITDEPTH {
+ DXRGBNULL = 0,
+ DXRGB8 = 1,
+
+ DXRGB16_555 = 2,
+ DXRGB24 = 3,
+ DXRGB_UNUSED = 4,
+ DXRGB16VESA = 5,
+ DXRGB8VESA = 6,
+ DXRGB16_565 = 7,
+
+ DXYUY2 = 8,
+ DXYVU9 = 9,
+ DXYV12 = 10,
+ DXUYVY = 11,
+
+ DXRGB32 = 12,
+ DXRGB16VESA_565 = 13,
+ DXHALFTONE8 =14,
+ DXI420 = 15,
+
+ DXYVYU = 16,
+
+ DXMAX
+} dxvBitDepth ;
+
+#define DXRGB16 DXRGB16_555
+#define DXRGB24CHAR DXRGB24
+
+typedef enum OFFSETXY {
+ DXL_ABSOLUTE = 0,
+ DXL_RELATIVE
+} dxvOffsetMode;
+
+typedef enum IMAGETYPE {
+ DXL_INTRAFRAME = 0,
+ DXL_INTERFRAME,
+ DXL_SPRITE
+} dxvImageType;
+
+
+
+typedef enum DXL_ERR{
+ DXL_LOW_ERR = -32000,
+ DXL_HARDWARE_ERROR = -16002,
+ DXL_HARDWARE_NOT_INITED = -16001,
+ DXL_HARDWARE_BUFFER_FULL = -16000,
+ DXL_INVALID_REQUEST = -9,
+ DXL_VERSION_CONFLICT = -8,
+ DXL_INVALID_DATA = -7,
+ DXL_INVALID_BLIT = -6,
+ DXL_BAD_DATA = -5,
+ DXL_ALLOC_FAILED = -4,
+ DXL_NULL_FRAME = -3,
+ DXL_NULLSOURCE = -2,
+ DXL_NOTINUSE = -1,
+ DXL_OK = 0,
+ DXL_HOLD_FRAME = 1
+} dxvError ;
+
+
+
+
+typedef enum BGMODE /* sprite drawing modes
+ v1.0.2 supports NORM & NO_BACKGROUND */{
+ NORM = 0, /* normal sprite mode, blend edges w/background */
+ NO_BACKGROUND = 1,/* transparant sprite mode 1,
+ sets all background data transparant no blending */
+ NORM_TRANS = 2, /* transparant sprite mode 2,
+ blend edges (alphas) w/separate background buffer,
+ set sprite background to trans */
+ RGB_OPAQUE = 3, /* blend edges to sprColor, set background to sprColor*/
+ RGB_TRANS = 4 /* blend edges w/sprColor, set background to trans */
+} dxvBackgroundMode ;
+
+/*********************************************************/
+
+/* definition of data handles */
+
+typedef struct vScreen *DXL_VSCREEN_HANDLE;
+typedef struct tXImage *DXL_XIMAGE_HANDLE;
+
+/* main video decompression init, exit and query */
+
+
+/*@
+@Name DXL_InitVideo
+@Description Initialize Video decompression services
+@Return value DXL_OK on success. -1 unable to initialize library, insufficient memory available.
+@*/
+int DXL_InitVideo(
+int maxScreens, /* max Number of VScreens to allow. Outdated. Please pass zero ! */
+int maxImages /* max Number of xImages to allow. Outdated. Please pass zero ! */
+);
+
+
+
+
+/*@
+@Name DXL_ExitVideo
+@Description Exit and de-initialize video decompression library. Release any allocated data structures.
+Always destroy xImages before calling this routine to avoid memory leaks.
+@Return value none
+@*/
+void DXL_ExitVideo(void);
+
+
+/*get pointer to NULL terminated
+ array of supported fourCCs */
+unsigned long *DXL_GetFourCCList(void);
+
+
+/*@
+@Name DXL_CreateXImage
+@Description Create an xImage (decompressor) object, based on the compressed data provided.
+@Return value returns a DXL_XIMAGE_HANDLE object ... also known as an xImage, or compressed image
+@*/
+DXL_XIMAGE_HANDLE DXL_CreateXImage(
+unsigned char *data /* compressed data */
+);
+
+
+
+
+/*@
+@Name DXL_SetXImageCSize
+@Description Set the size of the current compressed frame
+@Return value echo back the compressed image size
+@*/
+int DXL_SetXImageCSize(
+DXL_XIMAGE_HANDLE xImage, /* compressed image handle */
+int compressedSize /* compressed image size */
+);
+
+
+
+
+/*@
+@Name DXL_CreateXImageOfType
+@Description Create an xImage (decompressor) object of a requested type based on a FOURCC.
+Allocates buffers and initializes structures needed to decompress a source-compressed xImage.
+@Return value Handle to xImage created by this call , null if cannot create.
+@*/
+DXL_XIMAGE_HANDLE DXL_CreateXImageOfType(
+unsigned char *data, /* pointer to compressed image data */
+unsigned long fccType /* FOURCC code indicating type of compressed image data */
+);
+
+
+
+/*@
+@Name DXL_CreateXImageFromBMI
+@Description Create an xImage (decompressor) object of a requested type based on a FOURCC.
+Allocates buffers and initializes structures needed to decompress a source-compressed xImage.
+@Return value Handle to xImage created by this call , null if cannot create.
+@*/
+DXL_XIMAGE_HANDLE DXL_CreateXImageFromBMI(
+unsigned char *data, /* pointer to compressed image data */
+unsigned long biCompression, /* biCompression from BMIH */
+DK_BITMAPINFOHEADER *srcAndDst /* BMI data from AVI file or elsewhere */
+);
+
+
+
+
+/*@
+@Name DXL_DestroyXImage
+@Description destroy the specified xImage
+@Return value void
+@*/
+void DXL_DestroyXImage(
+DXL_XIMAGE_HANDLE src /* handle to compressed image */
+);
+
+
+
+/*@
+@Name DXL_AlterXImageData
+@Description Provides a compressed source with new data to decompress. New xImage attributes can be
+queried any time after changing the address of the compressed data with this function.
+@Return value DXL_OK on success or negative error code. -3 indicates that the pointer was passed in as null.
+Some compression applications (such as Adobe Premiere) use this to indicate that the new frame is the same as
+the previous frame, and the previous frame is to be held.
+@*/
+int DXL_AlterXImageData(
+DXL_XIMAGE_HANDLE src, /* handle to compressed image source (xImage) */
+unsigned char *ptrData /* pointer to compressed video data to be associated with xImage */
+);
+
+
+
+/*@
+@Name DXL_AlterXImage
+@Description Explicitly alter attributes of an xImage. The use of this funtion
+may affect the state of the xImage's frame buffer. During interframe compression, this can result
+in corruption of the decompressed image. Make sure to use this function only prior to decompressing a keyframe.
+@Return value handle to compressed image, or null if error.
+@*/
+DXL_XIMAGE_HANDLE DXL_AlterXImage(
+DXL_XIMAGE_HANDLE xImage, /* handle to compressed image */
+unsigned char *ptrData, /* pointer to compressed video data. */
+int xImType, /* new xImage type (DXL_INTRAFRAME, DXL_INTERFRAME). */
+dxvBitDepth bitDepth , /* bitdepth of decompressed data */
+int maxWidth, /* width of decompressed image */
+int maxHeight /* height of decompressed image */
+);
+
+
+
+
+/*@
+@Name DXL_GetXImageCSize
+@Description Get xImage compressed size
+@Return value returns the compressed size
+@*/
+long DXL_GetXImageCSize(
+DXL_XIMAGE_HANDLE src /* handle to compressed image */
+);
+
+
+
+/*@
+@Name DXL_GetXImageXYWH
+@Description get application specified x,y offset, and overall decompressed width and height.
+x and y offsets are legacy fields, ignore.
+@Return value DXL_OK on success, or negative error code.
+@*/
+int DXL_GetXImageXYWH(
+ DXL_XIMAGE_HANDLE src, /* the xImage Handle. */
+ int *x,int *y,int *w, int *h /* x,y,w,h - addresses for offsets and dimensions. */
+ );
+
+
+/*@
+@Name DXL_IsXImageKeyFrame
+@Description Check keyframe status of current image.
+Use DXL_AlterXImageData to set the current frame and the use this call to detect keyframe status.
+@Return value return 1 if this xImage is a keyFrame, 0 if not a keyframe.
+@*/
+int DXL_IsXImageKeyFrame(
+ DXL_XIMAGE_HANDLE src /* handle to compressed image */
+);
+
+
+
+/*@
+@Name DXL_dxImageToVScreen
+@Description Decompress and blit as a single process, according to current source and destination attributes.
+Passing 0 can be used to skip a blit in order to reduce CPU load as needed (synchronization).
+@Return value DXL_OK on success. 1 means place-holder frame. Negative means error.
+@*/
+int DXL_dxImageToVScreen(
+ DXL_XIMAGE_HANDLE xImage, /* Handle to compresse image source (xImage). */
+ DXL_VSCREEN_HANDLE dst /* Handle to destination surface (vScreen). Null means decompress without blit. */
+ );
+
+
+/* compatibility check prior between
+ decompressor and destination */
+int DXL_CheckdxImageToVScreen(
+ DXL_XIMAGE_HANDLE src,
+ DXL_VSCREEN_HANDLE dst
+ );
+
+/* blit from xImage internal "working area" to vScreen */
+int DXL_BlitXImageToVScreen(
+ DXL_XIMAGE_HANDLE src,
+ DXL_VSCREEN_HANDLE dst
+ );
+
+/* vscreen management functions */
+
+/*@
+@Name DXL_CreateVScreen
+@Description Create a virtual screen for rendering, storing decompressed video.
+@Return value returns a DXL_VSCREEN_HANDLE, or null if none available.
+@*/
+DXL_VSCREEN_HANDLE DXL_CreateVScreen(
+ unsigned char *addr, /* The address where pixel data should be written */
+ dxvBitDepth colorMode, /* Determines the colorspace and color depth of VScreen */
+ short bytePitch, /* Offset from one raster to the next measured in bytes. */
+ short height /* Number of rasters in a VScreen */
+ );
+
+
+
+/*@
+@Name DXL_AlterVScreen
+@Description Alter address and attributes associated with a vscreen.
+@Return value 0 for success or negatibe error code.
+@*/
+int DXL_AlterVScreen(
+ DXL_VSCREEN_HANDLE dst, /* handle to a VScreen */
+ unsigned char *addr, /* The address where pixel data should be written, or null for no change. */
+ dxvBitDepth colorMode, /* Determines the colorspace and color depth of VScreen, or -1 for no change. */
+ int bytePitch, /* offset from one raster to the next measured in bytes, or 0 for no change. */
+ int height /* number of rasters in a VScreen, or 0 for no change. */
+ );
+
+
+void DXL_VScreenSetInfoDotsFlag(DXL_VSCREEN_HANDLE vScreen, int showDots);
+
+
+/* alter clipping rectangle of vScreen */
+/* not supported by all decompressors */
+int DXL_AlterVScreenClip(
+ DXL_VSCREEN_HANDLE dst,
+ int x,int y,
+ int w,int h
+ );
+
+/* alter viewport rectangle of vScreen */
+/* width/height not supported by all decompressors */
+int DXL_AlterVScreenView(
+ DXL_VSCREEN_HANDLE dst,
+ int x,int y,
+ int w,int h
+ );
+
+
+/*@
+@Name DXL_DestroyVScreen
+@Description Destroy a vScreen object/struct.
+@Return value None
+@*/
+void DXL_DestroyVScreen(
+ DXL_VSCREEN_HANDLE dst /* handle to virtual screen destination */
+);
+
+
+
+
+/*@
+@Name DXL_SetVScreenBlitQuality
+@Description set blit-quality of a vScreen same (normal), stretch (black lined)
+stretch bright (stretched w/interpolation)
+@Return value return prior blit-quality value.
+@*/
+int DXL_SetVScreenBlitQuality(
+ DXL_VSCREEN_HANDLE dest, /* handle to vScreen */
+ dxvBlitQuality bq /* new blit-quality value */
+);
+
+
+
+
+/*@
+@Name DXL_GetVScreenBlitQuality
+@Description Get vScreens current blit-quality. Blit-quality determines if and how stretching should occur during the blit.
+@Return value returns member of enum called dxvBlitQuality, blit-quality value.
+BLIT_SAME is direct transfer; BLIT_STRETCH does double wide pixels and raster skipping; BLIT_STRETCH_BRIGHT stretches in both horizontal and vertical directions.
+@*/
+dxvBlitQuality DXL_GetVScreenBlitQuality(
+ DXL_VSCREEN_HANDLE /* handle to vScreen. */
+);
+
+
+
+/* alter spite background associated with a vscreen */
+/* used only by SegaSaturn for hardware sprite support */
+int DXL_AlterVScreenBackground(
+ DXL_VSCREEN_HANDLE ,
+ unsigned char *,
+ dxvBitDepth bd ,int ,int ,int ,int
+ );
+
+/* set DOS VESA mode for vScreen (DOS only) */
+int DXL_AlterVScreenVESAMode(
+ DXL_VSCREEN_HANDLE ,
+ int vesaMode
+ );
+
+/* set physical screen to vScreen's vesa mode */
+int DXL_ActivateVScreenVESAMode(DXL_VSCREEN_HANDLE);
+
+/* get vScreen (generally physical) vesa mode */
+int DXL_GetVScreenVESAMode(DXL_VSCREEN_HANDLE );
+
+
+/* copy one vScreen to another */
+/* provides support for offscreen compositing,
+ 16 bit and 8 bit modes only */
+int DXL_BlitVScreenToVScreen(
+ DXL_VSCREEN_HANDLE fromVScreen,
+ DXL_VSCREEN_HANDLE toVScreen
+ );
+
+/* get attributes of the vScreen */
+int DXL_GetVScreenAttributes(
+ DXL_VSCREEN_HANDLE vScreen,
+ void **addr,
+ dxvBlitQuality *bq,
+ dxvBitDepth *bd,
+ short *pitch,
+ short *height
+ );
+
+char *DXL_GetXImageStats(DXL_XIMAGE_HANDLE xImage,char *storage);
+
+
+/* get vScreen's current viewport rectangle
+ a viewport represents an x,y, offset and
+ a clipping width and height */
+int DXL_GetVScreenView(
+ DXL_VSCREEN_HANDLE dst,
+ int *x,int *y,int *w,int *h
+ );
+
+/* get vScreen's current clipping rectangle */
+int DXL_GetVScreenClip(
+ DXL_VSCREEN_HANDLE dst,
+ int *x,int *y,int *w,int *h
+ );
+
+/* provide Color lookup tables for 8 bit support */
+int DXL_SetVScreenCLUTs(
+ DXL_VSCREEN_HANDLE vScr,
+ unsigned char *clpt,
+ unsigned char *clpt2,
+ int exp
+ );
+
+/* return the palette currently used */
+int DXL_GetBitDepthPalette(dxvBitDepth colorMode,
+ unsigned char **pal);
+
+/* relinquish color lookup table structures */
+void DXL_ResetVScreenCLUTs(
+ DXL_VSCREEN_HANDLE vScr
+ );
+
+/* check to see if a blit mode is supported */
+
+int DXL_CheckVScreenBlit(DXL_VSCREEN_HANDLE dst,unsigned long fourcc);
+int DXL_CheckVScreenXImageBlit(DXL_VSCREEN_HANDLE dst,DXL_XIMAGE_HANDLE src);
+
+
+
+/* windows 95 dll system abstraction functions */
+
+/* set memory allocator function */
+void DXV_Setmalloc(
+ void *(*mallocFuncPtr)(unsigned int size)
+ );
+
+/* set cleared memory allocator function */
+void DXV_Setcalloc(
+ void *(*callocFuncPtr)(unsigned int size, unsigned int number)
+ );
+
+/*set memory free function */
+void DXV_Setfree(
+ void (*freeFuncPtr)(void *)
+ );
+
+/* pass a parameter to the decompressor */
+void DXL_SetParameter(
+ DXL_XIMAGE_HANDLE src,
+ int Command,
+ unsigned long Parameter
+ );
+
+/* can only have a max of 32 cpu specific features */
+typedef enum tCPU_FEATURES
+{
+ NO_FEATURES = 0,
+ MMX_SUPPORTED = 1
+} CPU_FEATURES;
+
+CPU_FEATURES DXL_GetCPUFeatures(void);
+unsigned long DXL_GetXImageFOURCC(DXL_XIMAGE_HANDLE src);
+
+
+/* pass a parameter to the decompressor */
+void DXL_SetParameter(
+ DXL_XIMAGE_HANDLE src,
+ int Command,
+ unsigned long Parameter
+ );
+
+
+
+/* Temporary hack to dxv to allow calls to get info (jbb) */
+typedef struct tFrameInfo
+{
+ int KeyFrame;
+ int Version;
+ int Quality;
+ int vp30Flag;
+} FrameInfo;
+
+
+
+
+
+/* define this in case we need to interogate before bailing out */
+typedef struct bmiChunk_t
+{
+ unsigned long biCompression;
+ unsigned char biBitCount;
+ unsigned char biPlanes;
+ dxvBitDepth bd;
+
+} BMIMapping;
+
+
+extern BMIMapping DXL_BMIMap[];
+
+
+#if !defined(DXL_MKFOURCC)
+#define DXL_MKFOURCC( ch0, ch1, ch2, ch3 ) \
+ ( (unsigned long)(unsigned char)(ch0) | ( (unsigned long)(unsigned char)(ch1) << 8 ) | \
+ ( (unsigned long)(unsigned char)(ch2) << 16 ) | ( (unsigned long)(unsigned char)(ch3) << 24 ) )
+
+#endif
+
+
+/* src xImage must actually be a DXL_CODEC_HANDLE */
+/* you will need a dxvvfw.lib in order to utilize this prototype for now */
+int DXL_ReportBestBMIMatch(DXL_XIMAGE_HANDLE src, BMIMapping** map, int *maxMaps, int doConsoleReport);
+
+/* have DXV print DXV/ICM mapping to HTML table */
+void DXL_ReportBMIMapping(char *filename);
+
+
+
+
+void vp31_GetInfo(unsigned char * source, FrameInfo * frameInfo);
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* include guards */
diff --git a/Src/libvp6/include/endian.hpp b/Src/libvp6/include/endian.hpp
new file mode 100644
index 00000000..cb26e7ad
--- /dev/null
+++ b/Src/libvp6/include/endian.hpp
@@ -0,0 +1,202 @@
+#if !defined(ENDIAN_HPP)
+#define ENDIAN_HPP
+//______________________________________________________________________________
+//
+// endian.hpp
+// Facilitate endian conversions.
+
+//namespace xxx
+//{
+
+ //--------------------------------------
+ inline
+ bool big_endian()
+ {
+ long lTest = 1;
+
+ return (reinterpret_cast<char*>(&lTest)[0] == 0);
+ }
+
+ //--------------------------------------
+ inline
+ short swap_endian(short i16)
+ {
+ return i16 << 8 & 0xff00
+ | i16 >> 8 & 0x00ff;
+ }
+
+ //--------------------------------------
+ inline
+ unsigned short swap_endian(unsigned short ui16)
+ {
+ return ui16 << 8 & 0xff00
+ | ui16 >> 8 & 0x00ff;
+ }
+
+ //--------------------------------------
+ inline
+ unsigned int swap_endian(unsigned int i32)
+ {
+ return i32 << 24 & 0xff000000
+ | i32 << 8 & 0x00ff0000
+ | i32 >> 8 & 0x0000ff00
+ | i32 >> 24 & 0x000000ff;
+ }
+
+ //--------------------------------------
+ inline
+ int swap_endian(int ui32)
+ {
+ return ui32 << 24 & 0xff000000
+ | ui32 << 8 & 0x00ff0000
+ | ui32 >> 8 & 0x0000ff00
+ | ui32 >> 24 & 0x000000ff;
+ }
+
+ //--------------------------------------
+ inline
+ short big_endian(short i16Native)
+ {
+ if (big_endian())
+ {
+ return i16Native;
+ }
+
+ return swap_endian(i16Native);
+ }
+
+ //--------------------------------------
+ inline
+ unsigned short big_endian(unsigned short ui16Native)
+ {
+ if (big_endian())
+ {
+ return ui16Native;
+ }
+
+ return swap_endian(ui16Native);
+ }
+
+ //--------------------------------------
+ inline
+ unsigned int big_endian(unsigned int i32Native)
+ {
+ if (big_endian())
+ {
+ return i32Native;
+ }
+
+ return swap_endian(i32Native);
+ }
+
+ //--------------------------------------
+ inline
+ int big_endian(int ui32Native)
+ {
+ if (big_endian())
+ {
+ return ui32Native;
+ }
+
+ return swap_endian(ui32Native);
+ }
+
+ //--------------------------------------
+ inline
+ short little_endian(short i16Native)
+ {
+ if (!big_endian())
+ {
+ return i16Native;
+ }
+
+ return swap_endian(i16Native);
+ }
+
+ //--------------------------------------
+ inline
+ unsigned short little_endian(unsigned short ui16Native)
+ {
+ if (!big_endian())
+ {
+ return ui16Native;
+ }
+
+ return swap_endian(ui16Native);
+ }
+
+ //--------------------------------------
+ inline
+ unsigned int little_endian(unsigned int i32Native)
+ {
+ if (!big_endian())
+ {
+ return i32Native;
+ }
+
+ return swap_endian(i32Native);
+ }
+
+ //--------------------------------------
+ inline
+ int little_endian(int ui32Native)
+ {
+ if (!big_endian())
+ {
+ return ui32Native;
+ }
+
+ return swap_endian(ui32Native);
+ }
+
+ //--------------------------------------
+ inline
+ short native_endian(short i16, bool bBigEndian)
+ {
+ if (big_endian() != bBigEndian)
+ {
+ return swap_endian(i16);
+ }
+
+ return i16;
+ }
+
+ //--------------------------------------
+ inline
+ unsigned short native_endian(unsigned short ui16, bool bBigEndian)
+ {
+ if (big_endian() != bBigEndian)
+ {
+ return swap_endian(ui16);
+ }
+
+ return ui16;
+ }
+
+ //--------------------------------------
+ inline
+ unsigned int native_endian(unsigned int i32, bool bBigEndian)
+ {
+ if (big_endian() != bBigEndian)
+ {
+ return swap_endian(i32);
+ }
+
+ return i32;
+ }
+
+ //--------------------------------------
+ inline
+ int native_endian(int ui32, bool bBigEndian)
+ {
+ if (big_endian() != bBigEndian)
+ {
+ return swap_endian(ui32);
+ }
+
+ return ui32;
+ }
+
+//} // namespace xxx
+
+#endif // ENDIAN_HPP
diff --git a/Src/libvp6/include/littlend.h b/Src/libvp6/include/littlend.h
new file mode 100644
index 00000000..65fbcbcc
--- /dev/null
+++ b/Src/libvp6/include/littlend.h
@@ -0,0 +1,25 @@
+#ifndef _littlend_h
+#define _littlend_h
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+#define invert2(x) (x)
+#define invert4(x) (x)
+
+#define lowByte(x) (unsigned char)x
+#define mid1Byte(x) (unsigned char)(x >> 8)
+#define mid2Byte(x) (unsigned char)(x >> 16)
+#define highByte(x) (unsigned char)(x >> 24)
+
+#define SWAPENDS 0
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif
+
+
+
diff --git a/Src/libvp6/include/on2cmp.h b/Src/libvp6/include/on2cmp.h
new file mode 100644
index 00000000..0989d8ca
--- /dev/null
+++ b/Src/libvp6/include/on2cmp.h
@@ -0,0 +1,49 @@
+#ifndef ON2CMP_H
+#define ON2CMP_H
+//*********************************************************************
+// name : on2comp.h
+// desc : Stand-alone command line compression application
+// that takes as input rvd files that are in planar yv12 format
+// and produces as output one ore more files that contain one or
+// more vp31 compressed video streams, as determined by command
+// line parameters.
+// date : 04/21/00
+// Who : Jim Bankoski
+// Mods :
+// Sep 21 2000 Reworked entire structure to be cleaner and more modular
+//*********************************************************************
+
+#include <vector>
+
+typedef int (*ProgressFunction)
+(
+ int Frame,
+ double SecondsWritten,
+ double PercentComplete,
+ int BytesWritten,
+ std::vector<int> vBytesWritten,
+ std::vector<int> vMinBufferSize
+);
+
+class fileCompressor
+{
+public:
+ enum fileCompressorType
+ {
+ VP31,
+ VP40,
+ VP50
+ };
+
+ virtual void compress (
+ ProgressFunction pf,
+ int updateEvery,
+ int argc,
+ char* argv[],
+ int outFileType) = 0;
+
+ virtual ~fileCompressor();
+ static fileCompressor* Make(fileCompressorType);
+};
+
+#endif // ON2CMP_H
diff --git a/Src/libvp6/include/on2vpplugin.h b/Src/libvp6/include/on2vpplugin.h
new file mode 100644
index 00000000..5bce5dcd
--- /dev/null
+++ b/Src/libvp6/include/on2vpplugin.h
@@ -0,0 +1,58 @@
+#ifndef ON2VPPLUGIN_H
+#define ON2VPPLUGIN_H
+
+#ifdef ON2VPPLUGIN_EXPORTS
+#define ON2VPPLUGIN_API __declspec(dllexport) WINAPI
+#else
+#define ON2VPPLUGIN_API __declspec(dllimport) WINAPI
+#endif
+
+
+BOOL ON2VPPLUGIN_API ON2Info(DWORD fccType, DWORD fccHandler, ICINFO FAR * lpicinfo);
+BOOL ON2VPPLUGIN_API ON2Install(DWORD fccType, DWORD fccHandler, LPARAM lParam, LPSTR szDesc, UINT wFlags);
+BOOL ON2VPPLUGIN_API ON2Remove(DWORD fccType, DWORD fccHandler, UINT wFlags);
+LRESULT ON2VPPLUGIN_API ON2GetInfo(HIC hic, ICINFO FAR *picinfo, DWORD cb);
+HIC ON2VPPLUGIN_API ON2Open(DWORD fccType, DWORD fccHandler, UINT wMode);
+HIC ON2VPPLUGIN_API ON2OpenFunction(DWORD fccType, DWORD fccHandler, UINT wMode, FARPROC lpfnHandler);
+LRESULT ON2VPPLUGIN_API ON2Close(HIC hic);
+LRESULT ON2VPPLUGIN_API ON2SendMessage(HIC hic, UINT msg, DWORD dw1, DWORD dw2);;
+LRESULT ON2VPPLUGIN_API ON2QueryAbout(HIC hic) ;
+LRESULT ON2VPPLUGIN_API ON2About(HIC hic, HWND hwnd) ;
+LRESULT ON2VPPLUGIN_API ON2QueryConfigure(HIC hic) ;
+LRESULT ON2VPPLUGIN_API ON2Configure(HIC hic, HWND hwnd) ;
+LRESULT ON2VPPLUGIN_API ON2GetState(HIC hic, LPVOID pv, DWORD cb) ;
+LRESULT ON2VPPLUGIN_API ON2SetState(HIC hic, LPVOID pv, DWORD cb) ;
+LRESULT ON2VPPLUGIN_API ON2GetStateSize(HIC hic) ;
+LRESULT ON2VPPLUGIN_API ON2GetDefaultQuality(HIC hic) ;
+LRESULT ON2VPPLUGIN_API ON2GetDefaultKeyFrameRate(HIC hic) ;
+LRESULT ON2VPPLUGIN_API ON2CompressBegin(HIC hic, BITMAPINFO *lpbiInput, BITMAPINFO *lpbiOutput) ;
+LRESULT ON2VPPLUGIN_API ON2CompressQuery(HIC hic, BITMAPINFO *lpbiInput, BITMAPINFO *lpbiOutput) ;
+LRESULT ON2VPPLUGIN_API ON2CompressGetFormat(HIC hic, BITMAPINFO *lpbiInput, BITMAPINFO *lpbiOutput) ;
+LRESULT ON2VPPLUGIN_API ON2CompressGetFormatSize(HIC hic, BITMAPINFO *lpbi) ;
+LRESULT ON2VPPLUGIN_API ON2CompressGetSize(HIC hic, BITMAPINFO *lpbiInput, BITMAPINFO *lpbiOutput) ;
+LRESULT ON2VPPLUGIN_API ON2CompressEnd(HIC hic) ;
+LRESULT ON2VPPLUGIN_API ON2DecompressBegin(HIC hic, BITMAPINFO *lpbiInput, BITMAPINFO *lpbiOutput) ;
+LRESULT ON2VPPLUGIN_API ON2DecompressQuery(HIC hic, BITMAPINFO *lpbiInput, BITMAPINFO *lpbiOutput) ;
+LRESULT ON2VPPLUGIN_API ON2DecompressGetFormat(HIC hic, BITMAPINFO *lpbiInput, BITMAPINFO *lpbiOutput) ;
+LRESULT ON2VPPLUGIN_API ON2DecompressGetFormatSize(HIC hic, BITMAPINFO *lpbi) ;
+LRESULT ON2VPPLUGIN_API ON2DecompressGetPalette(HIC hic, BITMAPINFO *lpbiInput, BITMAPINFO *lpbiOutput) ;
+LRESULT ON2VPPLUGIN_API ON2DecompressSetPalette(HIC hic, BITMAPINFO *lpbiPalette) ;
+LRESULT ON2VPPLUGIN_API ON2DecompressEnd(HIC hic) ;
+LRESULT ON2VPPLUGIN_API ON2DecompressExEnd(HIC hic) ;
+LRESULT ON2VPPLUGIN_API ON2DecompressEx(HIC hic,DWORD dwFlags,LPBITMAPINFOHEADER lpbiSrc,LPVOID lpSrc,int xSrc,int ySrc,int dxSrc,int dySrc,LPBITMAPINFOHEADER lpbiDst,LPVOID lpDst,int xDst,int yDst,int dxDst,int dyDst);
+LRESULT ON2VPPLUGIN_API ON2DecompressExBegin(HIC hic,DWORD dwFlags,LPBITMAPINFOHEADER lpbiSrc,LPVOID lpSrc,int xSrc,int ySrc,int dxSrc,int dySrc,LPBITMAPINFOHEADER lpbiDst,LPVOID lpDst,int xDst,int yDst,int dxDst,int dyDst);
+LRESULT ON2VPPLUGIN_API ON2DecompressExQuery(HIC hic,DWORD dwFlags,LPBITMAPINFOHEADER lpbiSrc,LPVOID lpSrc,int xSrc,int ySrc,int dxSrc,int dySrc,LPBITMAPINFOHEADER lpbiDst,LPVOID lpDst,int xDst,int yDst,int dxDst,int dyDst);
+HIC ON2VPPLUGIN_API ON2Open(DWORD fccType, DWORD fccHandler, UINT wMode);
+LRESULT ON2VPPLUGIN_API ON2Close(HIC hic);
+DWORD ON2VPPLUGIN_API ON2Decompress(HIC hic,DWORD dwFlags, LPBITMAPINFOHEADER lpbiInput, LPVOID lpInput, LPBITMAPINFOHEADER lpbiOutput,LPVOID lpOutput);
+DWORD ON2VPPLUGIN_API ON2Compress(HIC hic,DWORD dwFlags,LPBITMAPINFOHEADER lpbiOutput,LPVOID lpOutput,LPBITMAPINFOHEADER lpbiInput,LPVOID lpInput,LPDWORD lpckid,LPDWORD lpdwFlags,LONG lFrameNum,DWORD dwFrameSize,DWORD dwQuality,LPBITMAPINFOHEADER lpbiPrev,LPVOID lpPrev);
+LRESULT ON2VPPLUGIN_API ON2SendMessage(HIC hic, UINT msg, DWORD dw1, DWORD dw2);
+LRESULT ON2VPPLUGIN_API ON2SetReference(HIC hic, LPBITMAPINFO lpbiInput, char * buffer);
+LRESULT ON2VPPLUGIN_API ON2SetRecoveryFrame(HIC hic);
+LRESULT ON2VPPLUGIN_API ON2SetInternalSize(HIC hic,int wr, int ws, int hr, int hs );
+LRESULT ON2VPPLUGIN_API ON2SendMessage(HIC hic, UINT msg, DWORD dw1, DWORD dw2);
+LRESULT ON2VPPLUGIN_API ON2GetReference(HIC hic, LPBITMAPINFO lpbiInput, char * buffer);
+LRESULT ON2VPPLUGIN_API ON2SetCPUFree(HIC hic, int cpuFree);
+
+
+#endif \ No newline at end of file
diff --git a/Src/libvp6/include/type_aliases.h b/Src/libvp6/include/type_aliases.h
new file mode 100644
index 00000000..a4930fa0
--- /dev/null
+++ b/Src/libvp6/include/type_aliases.h
@@ -0,0 +1,75 @@
+/****************************************************************************
+*
+* Module Title : type_aliases.h
+*
+* Description : Standard type aliases
+*
+****************************************************************************/
+#ifndef __INC_TYPE_ALIASES_H
+#define __INC_TYPE_ALIASES_H
+
+/****************************************************************************
+* Macros
+****************************************************************************/
+#define EXPORT
+#define IMPORT extern /* Used to declare imported data & routines */
+#define PRIVATE static /* Used to declare & define module-local data */
+#define LOCAL static /* Used to define all persistent routine-local data */
+#define STD_IN_PATH 0 /* Standard input path */
+#define STD_OUT_PATH 1 /* Standard output path */
+#define STD_ERR_PATH 2 /* Standard error path */
+#define STD_IN_FILE stdin /* Standard input file pointer */
+#define STD_OUT_FILE stdout /* Standard output file pointer */
+#define STD_ERR_FILE stderr /* Standard error file pointer */
+#define MAX_int 0x7FFFFFFF
+
+#define __export
+#define _export
+
+#define CCONV
+
+#ifndef NULL
+#ifdef __cplusplus
+#define NULL 0
+#else
+#define NULL ((void *)0)
+#endif
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+/****************************************************************************
+* Typedefs
+****************************************************************************/
+#ifndef TYPE_INT8
+#define TYPE_INT8
+typedef signed char INT8;
+#endif
+
+typedef signed short INT16;
+typedef signed int INT32;
+
+typedef unsigned char UINT8;
+typedef unsigned int UINT32;
+typedef unsigned short UINT16;
+
+typedef int BOOL;
+typedef unsigned char BOOLEAN;
+
+#ifdef _MSC_VER
+typedef __int64 INT64;
+#else
+typedef long long INT64;
+#endif
+
+/* Floating point */
+typedef double FLOAT64;
+typedef float FLOAT32;
+
+#endif
diff --git a/Src/libvp6/include/vp50/comp_interface.h b/Src/libvp6/include/vp50/comp_interface.h
new file mode 100644
index 00000000..c38c3943
--- /dev/null
+++ b/Src/libvp6/include/vp50/comp_interface.h
@@ -0,0 +1,54 @@
+#if !defined(COMP_INTERFACE_H)
+#define COMP_INTERFACE_H
+/****************************************************************************
+*
+* Module Title : COMP_INTERFACE.H
+*
+* Description : Interface to video codec demo compressor DLL
+*
+* AUTHOR : Paul Wilkins
+*
+*****************************************************************************
+* Revision History
+*
+* 1.04 JBB 26 AUG 00 JBB Added fixed q setting
+* 1.03 PGW 07/12/99 Retro fit JBB changes
+* 1.02 PGW 16/09/99 Interface changes to simplify things for command line
+* compressor.
+* 1.01 PGW 07/07/99 Added COMP_CONFIG.
+* 1.00 PGW 28/06/99 New configuration baseline
+*
+*****************************************************************************
+*/
+
+// C4514 Unreferenced inline function has been removed
+#pragma warning(disable: 4514)
+
+#include "codec_common_interface.h"
+#include "type_aliases.h"
+#include "vp50_comp_interface.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+typedef struct CP_INSTANCE * xCP_INST;
+extern BOOL CCONV StartEncoder( xCP_INST *cpi, COMP_CONFIG_VP5 * CompConfig );
+extern void CCONV ChangeCompressorSetting ( xCP_INST cpi, C_SETTING Setting, int Value );
+extern void CCONV ChangeEncoderConfig ( xCP_INST cpi, COMP_CONFIG_VP5 * CompConfig );
+extern UINT32 CCONV EncodeFrame( xCP_INST cpi, unsigned char * InBmpIPtr, unsigned char * InBmpPtr, unsigned char * OutPutPtr, unsigned int * is_key );
+extern UINT32 CCONV EncodeFrameYuv( xCP_INST cpi, YUV_INPUT_BUFFER_CONFIG * YuvInputData, unsigned char * OutPutPtr, unsigned int * is_key );
+extern BOOL CCONV StopEncoder( xCP_INST *cpi);
+extern void VPEInitLibrary(void);
+extern void VPEDeInitLibrary(void);
+extern const char * CCONV VP50E_GetVersionNumber(void);
+extern UINT32 CCONV VPGetState(xCP_INST cpi, void * ret);
+extern void CCONV VPSetState(xCP_INST cpi, void * ret);
+extern int CCONV VPGetPB(xCP_INST cpi);
+#ifdef __cplusplus
+
+}
+#endif
+
+
+#endif \ No newline at end of file
diff --git a/Src/libvp6/include/vp50/vfw_pb_interface.h b/Src/libvp6/include/vp50/vfw_pb_interface.h
new file mode 100644
index 00000000..d9eb593d
--- /dev/null
+++ b/Src/libvp6/include/vp50/vfw_pb_interface.h
@@ -0,0 +1,66 @@
+/****************************************************************************
+*
+* Module Title : VFW_PB_INTERFACE.H
+*
+* Description : Interface to video codec demo decompressor DLL
+*
+* AUTHOR : Paul Wilkins
+*
+*****************************************************************************
+* Revision History
+*
+* 1.03 YWX 17/Dec/02 Added enum for setup DeInteralcedMode
+* 1.02 JBB 25 AUG 00 Versioning
+* 1.01 PGW 29/06/99 Interface to DecodeFrame() changed.
+* 1.00 PGW 07/06/99 Baseline code.
+*
+*****************************************************************************
+*/
+
+#ifndef VFW_PB_INTERFACE
+#define VFW_PB_INTERFACE
+
+#include "codec_common_interface.h"
+
+#include "type_aliases.h"
+typedef struct PB_INSTANCE * xPB_INST;
+//#include "pbdll.h"
+
+
+// Settings Control
+typedef enum
+{
+ PBC_SET_POSTPROC,
+ PBC_SET_CPUFREE,
+ PBC_MAX_PARAM,
+ PBC_SET_TESTMODE,
+ PBC_SET_PBSTRUCT,
+ PBC_SET_BLACKCLAMP,
+ PBC_SET_WHITECLAMP,
+ PBC_SET_REFERENCEFRAME,
+ PBC_SET_DEINTERLACEMODE
+
+} PB_COMMAND_TYPE;
+
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+extern BOOL CCONV VP5_StartDecoder( xPB_INST *pbi, UINT32 ImageWidth, UINT32 ImageHeight );
+extern void CCONV VP5_GetPbParam( xPB_INST, PB_COMMAND_TYPE Command, UINT32 *Parameter );
+extern void CCONV VP5_SetPbParam( xPB_INST, PB_COMMAND_TYPE Command, UINT32 Parameter );
+extern void CCONV VP5_GetYUVConfig( xPB_INST, YUV_BUFFER_CONFIG * YuvConfig );
+extern const char * CCONV VP31D_GetVersionNumber(void);
+
+extern int CCONV VP5_DecodeFrameToYUV( xPB_INST, char * VideoBufferPtr, unsigned int ByteCount,
+ UINT32 ImageWidth, UINT32 ImageHeight );
+extern BOOL CCONV VP5_StopDecoder(xPB_INST *pbi);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
diff --git a/Src/libvp6/include/vp50/vp50_comp_interface.h b/Src/libvp6/include/vp50/vp50_comp_interface.h
new file mode 100644
index 00000000..b1c8a387
--- /dev/null
+++ b/Src/libvp6/include/vp50/vp50_comp_interface.h
@@ -0,0 +1,138 @@
+#if !defined(VP50_COMP_INTERFACE_H)
+#define VP50_COMP_INTERFACE_H
+/****************************************************************************
+*
+* Module Title : VFW_COMP_INTERFACE.H
+*
+* Description : Interface to video codec demo compressor DLL
+*
+* AUTHOR : Paul Wilkins
+*
+*****************************************************************************
+* Revision History
+*
+* 1.04 JBB 26 AUG 00 JBB Added fixed q setting
+* 1.03 PGW 07/12/99 Retro fit JBB changes
+* 1.02 PGW 16/09/99 Interface changes to simplify things for command line
+* compressor.
+* 1.01 PGW 07/07/99 Added COMP_CONFIG.
+* 1.00 PGW 28/06/99 New configuration baseline
+*
+*****************************************************************************
+*/
+
+// C4514 Unreferenced inline function has been removed
+#ifndef MACPPC
+#pragma warning(disable: 4514)
+#endif
+
+#include "codec_common_interface.h"
+#include "type_aliases.h"
+
+/* Command interface to compressor. */
+/* Settings Control */
+
+typedef struct
+{
+ UINT32 FrameSize;
+ UINT32 TargetBitRate;
+ UINT32 FrameRate;
+ UINT32 KeyFrameFrequency;
+ UINT32 KeyFrameDataTarget;
+ UINT32 Quality;
+ BOOL AllowDF;
+ BOOL QuickCompress;
+ BOOL AutoKeyFrameEnabled;
+ INT32 AutoKeyFrameThreshold;
+ UINT32 MinimumDistanceToKeyFrame;
+ INT32 ForceKeyFrameEvery;
+ INT32 NoiseSensitivity;
+ BOOL AllowSpatialResampling;
+
+ // The Intended Horizontal Scale
+ UINT32 HScale;
+ UINT32 HRatio;
+
+ // The Intended Vertical Scale
+ UINT32 VScale;
+ UINT32 VRatio;
+
+ // The way in which we intended
+ UINT32 ScalingMode;
+
+ // Interlaced (0) means no (1) means Yes
+ UINT32 Interlaced;
+
+ BOOL FixedQ;
+
+ INT32 StartingBufferLevel; // The initial encoder buffer level
+ INT32 OptimalBufferLevel; // The buffer level target we strive to reach / maintain.
+ INT32 DropFramesWaterMark; // Buffer fullness watermark for forced drop frames.
+ INT32 ResampleDownWaterMark; // Buffer fullness watermark for downwards spacial re-sampling
+ INT32 ResampleUpWaterMark; // Buffer fullness watermark where returning to larger image size is consdered
+ INT32 OutputFrameRate;
+ INT32 Speed;
+
+ BOOL ErrorResilientMode; // compress using a mode that won't completely fall apart if we decompress using
+ // the frame after a dropped frame
+
+} COMP_CONFIG_VP5;
+
+INLINE
+void comp_config_default_vp5(COMP_CONFIG_VP5* pcc)
+{
+ pcc->FrameSize = 0; // No default value
+ pcc->TargetBitRate = 300;
+ pcc->FrameRate = 0; // No default value
+ pcc->KeyFrameFrequency = 120;
+ pcc->KeyFrameDataTarget = 0; // No default value
+ pcc->Quality = 56;
+ pcc->AllowDF = 0;
+ pcc->QuickCompress = 1;
+ pcc->AutoKeyFrameEnabled = 1;
+ pcc->AutoKeyFrameThreshold = 80;
+ pcc->MinimumDistanceToKeyFrame = 8;
+ pcc->ForceKeyFrameEvery = 120;
+ pcc->NoiseSensitivity = 0;
+ pcc->AllowSpatialResampling = 0;
+ pcc->HScale = 1;
+ pcc->HRatio = 1;
+ pcc->VScale = 1;
+ pcc->VRatio = 1;
+ pcc->ScalingMode = MAINTAIN_ASPECT_RATIO;
+ pcc->Interlaced = 0;
+ pcc->FixedQ = 0;
+
+ pcc->StartingBufferLevel = 6;
+ pcc->OptimalBufferLevel = 10;
+ pcc->DropFramesWaterMark = 20;
+ pcc->ResampleDownWaterMark = 35;
+ pcc->ResampleUpWaterMark = 45;
+
+ pcc->OutputFrameRate = 30;
+ pcc->Speed = 12;
+ pcc->ErrorResilientMode = FALSE;
+
+ return;
+}
+
+#ifndef YUVINPUTBUFFERCONFIG
+#define YUVINPUTBUFFERCONFIG
+typedef struct
+{
+ int YWidth;
+ int YHeight;
+ int YStride;
+
+ int UVWidth;
+ int UVHeight;
+ int UVStride;
+
+ char * YBuffer;
+ char * UBuffer;
+ char * VBuffer;
+
+} YUV_INPUT_BUFFER_CONFIG;
+#endif
+
+#endif
diff --git a/Src/libvp6/include/vp50dversion.h b/Src/libvp6/include/vp50dversion.h
new file mode 100644
index 00000000..a72bebf1
--- /dev/null
+++ b/Src/libvp6/include/vp50dversion.h
@@ -0,0 +1 @@
+#define VP50DVERSION "5.0.12.0"
diff --git a/Src/libvp6/include/vp6.h b/Src/libvp6/include/vp6.h
new file mode 100644
index 00000000..fb73954f
--- /dev/null
+++ b/Src/libvp6/include/vp6.h
@@ -0,0 +1,13 @@
+#pragma once
+#include "duck_dxl.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int vp60_decompress(DXL_XIMAGE_HANDLE src);
+void vp60_SetParameter(DXL_XIMAGE_HANDLE src, int Command, uintptr_t Parameter);
+int vp60_getWH(DXL_XIMAGE_HANDLE src, int *w, int *h);
+
+#ifdef __cplusplus
+}
+#endif \ No newline at end of file
diff --git a/Src/libvp6/include/vp60/comp_interface.h b/Src/libvp6/include/vp60/comp_interface.h
new file mode 100644
index 00000000..add9a5c9
--- /dev/null
+++ b/Src/libvp6/include/vp60/comp_interface.h
@@ -0,0 +1,55 @@
+/****************************************************************************
+*
+* Module Title : comp_interface.h
+*
+* Description : Interface to video codec demo compressor DLL
+*
+****************************************************************************/
+#ifndef __INC_COMP_INTERFACE_H
+#define __INC_COMP_INTERFACE_H
+
+/****************************************************************************
+* Include Files
+****************************************************************************/
+#include "type_aliases.h"
+#include "codec_common_interface.h"
+#include "vp60_comp_interface.h"
+
+/****************************************************************************
+* Macros
+****************************************************************************/
+// C4514 Unreferenced inline function has been removed
+#ifdef _MSC_VER
+#pragma warning(disable: 4514)
+#endif
+/****************************************************************************
+* Typedefs
+****************************************************************************/
+typedef struct CP_INSTANCE * xCP_INST;
+
+/****************************************************************************
+* Exports
+****************************************************************************/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+extern BOOL CCONV StartEncoder ( xCP_INST *cpi, COMP_CONFIG_VP6 *CompConfig );
+extern void CCONV ChangeCompressorSetting ( xCP_INST cpi, C_SETTING Setting, int Value );
+extern void CCONV ChangeEncoderConfig ( xCP_INST cpi, COMP_CONFIG_VP6 *CompConfig );
+extern UINT32 CCONV EncodeFrame ( xCP_INST cpi, unsigned char *InBmpIPtr, unsigned char *InBmpPtr, unsigned char *OutPutPtr, unsigned int *is_key );
+extern UINT32 CCONV EncodeFrameYuv ( xCP_INST cpi, YUV_INPUT_BUFFER_CONFIG *YuvInputData, unsigned char *OutPutPtr, unsigned int *is_key );
+extern BOOL CCONV StopEncoder ( xCP_INST *cpi );
+extern void VPEInitLibrary ( void );
+extern void VPEDeInitLibrary ( void );
+extern const char *CCONV VP50E_GetVersionNumber ( void );
+extern UINT32 CCONV VPGetState ( xCP_INST cpi, void *ret );
+extern void CCONV VPSetState ( xCP_INST cpi, void *ret );
+extern int CCONV VPGetPB ( xCP_INST cpi );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/Src/libvp6/include/vp60/vfw_pb_interface.h b/Src/libvp6/include/vp60/vfw_pb_interface.h
new file mode 100644
index 00000000..2ce80155
--- /dev/null
+++ b/Src/libvp6/include/vp60/vfw_pb_interface.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+*
+* Module Title : vfw_pb_interface.h
+*
+* Description : Codec interface specification header file.
+*
+****************************************************************************/
+#ifndef __INC_VFW_PB_INTERFACE
+#define __INC_VFW_PB_INTERFACE
+
+/****************************************************************************
+* Header Files
+****************************************************************************/
+#include "codec_common_interface.h"
+#include "type_aliases.h"
+#ifdef __GNUC__
+#include <inttypes.h>
+#elif defined(_WIN32)
+#include <stddef.h>
+#endif
+/****************************************************************************
+* Typedefs
+****************************************************************************/
+typedef struct PB_INSTANCE * xPB_INST;
+
+// Settings Control
+typedef enum
+{
+ PBC_SET_POSTPROC,
+ PBC_SET_CPUFREE,
+ PBC_MAX_PARAM,
+ PBC_SET_TESTMODE,
+ PBC_SET_PBSTRUCT,
+ PBC_SET_BLACKCLAMP,
+ PBC_SET_WHITECLAMP,
+ PBC_SET_REFERENCEFRAME,
+ PBC_SET_DEINTERLACEMODE,
+ PBC_SET_ADDNOISE
+
+} PB_COMMAND_TYPE;
+
+/****************************************************************************
+* Exports
+****************************************************************************/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+extern BOOL CCONV VP6_StartDecoder ( xPB_INST *pbi, UINT32 ImageWidth, UINT32 ImageHeight );
+extern void CCONV VP6_GetPbParam ( xPB_INST, PB_COMMAND_TYPE Command, UINT32 *Parameter );
+extern void CCONV VP6_SetPbParam ( xPB_INST, PB_COMMAND_TYPE Command, uintptr_t Parameter );
+extern void CCONV VP6_GetYUVConfig ( xPB_INST, YUV_BUFFER_CONFIG * YuvConfig );
+extern const char * CCONV VP31D_GetVersionNumber ( void );
+extern int CCONV VP6_DecodeFrameToYUV ( xPB_INST, char * VideoBufferPtr, unsigned int ByteCount);
+extern BOOL CCONV VP6_StopDecoder ( xPB_INST *pbi );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/Src/libvp6/include/vp60/vp60_comp_interface.h b/Src/libvp6/include/vp60/vp60_comp_interface.h
new file mode 100644
index 00000000..3ca389ee
--- /dev/null
+++ b/Src/libvp6/include/vp60/vp60_comp_interface.h
@@ -0,0 +1,211 @@
+/****************************************************************************
+*
+* Module Title : vp60_comp_interface.h
+*
+* Description : Interface to VP60 compressor.
+*
+****************************************************************************/
+#ifndef __INC_VP60_COMP_INTERFACE_H
+#define __INC_VP60_COMP_INTERFACE_H
+
+#ifdef _MSC_VER
+#pragma warning(disable: 4514) // Disable warning 4514: Unreferenced inline function
+#endif
+
+/****************************************************************************
+* Header Files
+****************************************************************************/
+#include "codec_common_interface.h"
+#include "type_aliases.h"
+#include "string.h"
+
+#define DEFAULT_VALUE -999
+/****************************************************************************
+* Typedefs
+****************************************************************************/
+typedef enum
+{
+ USAGE_STREAM_FROM_SERVER = 0x0, // INTER prediction, (0,0) motion vector implied.
+ USAGE_LOCAL_FILE_PLAYBACK = 0x1 // INTER prediction, (0,0) motion vector implied.
+} END_USAGE;
+
+
+typedef enum
+{
+ MODE_REALTIME = 0x0,
+ MODE_GOODQUALITY = 0x1,
+ MODE_BESTQUALITY = 0x2,
+ MODE_FIRSTPASS = 0x3,
+ MODE_SECONDPASS = 0x4,
+ MODE_SECONDPASS_BEST= 0x5
+} MODE;
+
+
+
+/* Command interface to compressor */
+typedef struct
+{
+ //UINT32 FourCC;
+ //UINT32 ConfigVersion;
+ UINT32 FrameSize;
+ UINT32 TargetBitRate;
+ UINT32 FrameRate;
+ UINT32 KeyFrameFrequency;
+ UINT32 KeyFrameDataTarget;
+ UINT32 Quality;
+ BOOL AllowDF;
+ BOOL QuickCompress;
+ BOOL AutoKeyFrameEnabled;
+ INT32 AutoKeyFrameThreshold;
+ UINT32 MinimumDistanceToKeyFrame;
+ INT32 ForceKeyFrameEvery;
+ INT32 NoiseSensitivity;
+ BOOL AllowSpatialResampling;
+
+ // The Intended Horizontal Scale
+ UINT32 HScale;
+ UINT32 HRatio;
+
+ // The Intended Vertical Scale
+ UINT32 VScale;
+ UINT32 VRatio;
+
+ // The way in which we intended
+ UINT32 ScalingMode;
+
+ // Interlaced (0) means no (1) means Yes
+ UINT32 Interlaced;
+
+ BOOL FixedQ;
+
+ INT32 StartingBufferLevel; // The initial encoder buffer level
+ INT32 OptimalBufferLevel; // The buffer level target we strive to reach / maintain.
+ INT32 DropFramesWaterMark; // Buffer fullness watermark for forced drop frames.
+ INT32 ResampleDownWaterMark; // Buffer fullness watermark for downwards spacial re-sampling
+ INT32 ResampleUpWaterMark; // Buffer fullness watermark where returning to larger image size is consdered
+ INT32 OutputFrameRate;
+ INT32 Speed;
+
+ BOOL ErrorResilientMode; // compress using a mode that won't completely fall apart if we decompress using
+ // the frame after a dropped frame
+ INT32 Profile;
+
+ BOOL DisableGolden; // disable golden frame updates
+ BOOL VBMode; // run in variable bandwidth 1 pass mode
+ UINT32 BestAllowedQ; // best allowed quality ( save bits by disallowings frames that are too high quality )
+ INT32 UnderShootPct; // target a percentage of the actual frame to allow for sections that go over
+
+ INT32 MaxAllowedDatarate; // maximum the datarate is allowed to go.
+ INT32 MaximumBufferSize; // maximum buffer size.
+
+ BOOL TwoPassVBREnabled; // two pass variable bandwidth enabled
+ INT32 TwoPassVBRBias; // how variable do we want to target?
+ INT32 TwoPassVBRMaxSection; // maximum
+ INT32 TwoPassVBRMinSection; // minimum
+ INT32 Pass; // which pass of the compression are we running.
+
+ MODE Mode;
+ END_USAGE EndUsage;
+
+ char FirstPassFile[512];
+ char SettingsFile[512];
+ char RootDirectory[512];
+
+ INT32 PlaceHolder;
+ INT32 DeleteFirstPassFile;
+ INT32 Sharpness;
+
+} COMP_CONFIG_VP6;
+
+
+typedef struct
+{
+ int YWidth;
+ int YHeight;
+ int YStride;
+
+ int UVWidth;
+ int UVHeight;
+ int UVStride;
+
+ char *YBuffer;
+ char *UBuffer;
+ char *VBuffer;
+
+} YUV_INPUT_BUFFER_CONFIG;
+
+/****************************************************************************
+* Functions
+****************************************************************************/
+#ifdef _MSC_VER
+_inline
+void comp_config_default_vp6 ( COMP_CONFIG_VP6* pcc )
+{
+
+
+ pcc->FrameSize = 0; // No default value
+ pcc->TargetBitRate = 300;
+ pcc->FrameRate = 0; // No default value
+ pcc->KeyFrameFrequency = 120;
+ pcc->KeyFrameDataTarget = 0; // No default value
+ pcc->Quality = 56;
+ pcc->AllowDF = 0;
+ pcc->AutoKeyFrameEnabled = 1;
+ pcc->AutoKeyFrameThreshold = 80;
+ pcc->MinimumDistanceToKeyFrame = 4;
+ pcc->ForceKeyFrameEvery = 120;
+ pcc->NoiseSensitivity = 0;
+ pcc->AllowSpatialResampling = 0;
+ pcc->HScale = 1;
+ pcc->HRatio = 1;
+ pcc->VScale = 1;
+ pcc->VRatio = 1;
+ pcc->ScalingMode = MAINTAIN_ASPECT_RATIO;
+ pcc->Interlaced = 0;
+ pcc->FixedQ = 0;
+
+ pcc->StartingBufferLevel = 4;
+ pcc->OptimalBufferLevel = 5;
+ pcc->DropFramesWaterMark = 20;
+ pcc->ResampleDownWaterMark = 35;
+ pcc->ResampleUpWaterMark = 45;
+
+ pcc->OutputFrameRate = 30;
+ pcc->Speed = 4;
+ pcc->ErrorResilientMode = FALSE;
+
+ pcc->Profile = 0;
+
+ pcc->DisableGolden = 0;
+ pcc->BestAllowedQ = 4;
+ pcc->UnderShootPct = 90;
+
+ pcc->MaxAllowedDatarate = 100;
+ pcc->MaximumBufferSize = 6;
+
+ pcc->TwoPassVBRBias = 70;
+ pcc->TwoPassVBRMaxSection = 400;
+ pcc->TwoPassVBRMinSection = 40;
+
+
+ pcc->Mode = MODE_GOODQUALITY;
+ pcc->EndUsage = USAGE_STREAM_FROM_SERVER;
+
+ // DEFAULT means default value as determined by mode and endusage
+ pcc->QuickCompress = DEFAULT_VALUE;
+ pcc->Pass = DEFAULT_VALUE;
+ pcc->VBMode = DEFAULT_VALUE;
+ pcc->TwoPassVBREnabled = DEFAULT_VALUE;
+
+ pcc->SettingsFile[0] = 0;
+ pcc->RootDirectory[0] = 0;
+ pcc->Sharpness = 5;
+
+ strncpy(pcc->FirstPassFile,"firstpass.fpf",512);
+ //pcc->FourCC = '06PV';
+ //pcc->ConfigVersion = 4;
+
+ return;
+}
+#endif
+#endif
diff --git a/Src/libvp6/include/vp60dversion.h b/Src/libvp6/include/vp60dversion.h
new file mode 100644
index 00000000..b6d621e4
--- /dev/null
+++ b/Src/libvp6/include/vp60dversion.h
@@ -0,0 +1 @@
+#define VP60DVERSION "6.0.12.0"
diff --git a/Src/libvp6/include/vp60eversion.h b/Src/libvp6/include/vp60eversion.h
new file mode 100644
index 00000000..4205683e
--- /dev/null
+++ b/Src/libvp6/include/vp60eversion.h
@@ -0,0 +1 @@
+#define VP60EVERSION "6.0.12.0"