From 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d Mon Sep 17 00:00:00 2001 From: Jef Date: Tue, 24 Sep 2024 14:54:57 +0200 Subject: Initial community commit --- Src/nsvdec_vp6/nsvdec_vp6.sln | 18 ++ Src/nsvdec_vp6/nsvdec_vp6.vcxproj | 172 +++++++++++++++ Src/nsvdec_vp6/nsvdec_vp6.vcxproj.filters | 22 ++ .../nsvdec_vp6.xcodeproj/project.pbxproj | 237 +++++++++++++++++++++ Src/nsvdec_vp6/vp6stub.cpp | 208 ++++++++++++++++++ 5 files changed, 657 insertions(+) create mode 100644 Src/nsvdec_vp6/nsvdec_vp6.sln create mode 100644 Src/nsvdec_vp6/nsvdec_vp6.vcxproj create mode 100644 Src/nsvdec_vp6/nsvdec_vp6.vcxproj.filters create mode 100644 Src/nsvdec_vp6/nsvdec_vp6.xcodeproj/project.pbxproj create mode 100644 Src/nsvdec_vp6/vp6stub.cpp (limited to 'Src/nsvdec_vp6') diff --git a/Src/nsvdec_vp6/nsvdec_vp6.sln b/Src/nsvdec_vp6/nsvdec_vp6.sln new file mode 100644 index 00000000..b77e093c --- /dev/null +++ b/Src/nsvdec_vp6/nsvdec_vp6.sln @@ -0,0 +1,18 @@ +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nsvdec_vp6", "nsvdec_vp6.vcproj", "{C45BA56F-496D-42B8-BDD3-B1AF323EC130}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C45BA56F-496D-42B8-BDD3-B1AF323EC130}.Debug|Win32.ActiveCfg = Debug|Win32 + {C45BA56F-496D-42B8-BDD3-B1AF323EC130}.Debug|Win32.Build.0 = Debug|Win32 + {C45BA56F-496D-42B8-BDD3-B1AF323EC130}.Release|Win32.ActiveCfg = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Src/nsvdec_vp6/nsvdec_vp6.vcxproj b/Src/nsvdec_vp6/nsvdec_vp6.vcxproj new file mode 100644 index 00000000..664fec72 --- /dev/null +++ b/Src/nsvdec_vp6/nsvdec_vp6.vcxproj @@ -0,0 +1,172 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + 17.0 + {C45BA56F-496D-42B8-BDD3-B1AF323EC130} + 10.0.19041.0 + + + + DynamicLibrary + v142 + false + MultiByte + + + DynamicLibrary + v142 + false + MultiByte + + + + + + + + + + + + + + + <_ProjectFileVersion>17.0.32505.173 + + + $(PlatformShortName)_$(Configuration)\ + $(PlatformShortName)_$(Configuration)\ + false + $(IncludePath) + $(LibraryPath) + + + $(Configuration)\ + $(Configuration)\ + false + $(IncludePath) + $(LibraryPath) + + + + _DEBUG;%(PreprocessorDefinitions) + true + true + Win32 + .\nsvdec_vp6___Win32_Debug_Winamp/nsvdec_vp6.tlb + + + + Disabled + ..\Wasabi;..\libvp6\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;NSVDEC_vp6_EXPORTS;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + + .\nsvdec_vp6___Win32_Debug_Winamp/nsvdec_vp6.pch + .\nsvdec_vp6___Win32_Debug_Winamp/ + .\nsvdec_vp6___Win32_Debug_Winamp/ + .\nsvdec_vp6___Win32_Debug_Winamp/ + Level3 + true + EditAndContinue + true + + + _DEBUG;%(PreprocessorDefinitions) + 0x0409 + + + odbc32.lib;odbccp32.lib;winmm.lib;s_cconv.lib;s_cpuid.lib;s_dxv.lib;s_preproc.lib;s_vp60d.lib;s_vpppd.lib;s_vputil.lib;s_vpxblit.lib;on2_mem.lib;msvcrt.lib;libcpmt.lib;%(AdditionalDependencies) + $(OutDir)nsvdec_vp6.dll + true + ..\libvp6\lib\$(PlatformShortName)_$(Configuration)\;%(AdditionalLibraryDirectories) + true + $(OutDir)$(ProjectName).pdb + false + + $(IntDir)nsvdec_vp6.lib + MachineX86 + false + + + xcopy /Y /D $(OutDir)*.dll ..\..\..\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\ + + + + + NDEBUG;%(PreprocessorDefinitions) + true + true + Win32 + .\Release/nsvdec_vp6.tlb + + + + MinSpace + OnlyExplicitInline + Size + true + ..\Wasabi;..\libvp6\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;NSVDEC_vp6_EXPORTS;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + + .\Release/nsvdec_vp6.pch + .\Release/ + $(IntDir) + .\Release/ + Level3 + true + None + true + + + NDEBUG;%(PreprocessorDefinitions) + 0x0409 + + + winmm.lib;s_cpuid.lib;s_dxv.lib;s_vp60d.lib;s_vpppd.lib;s_vputil.lib;s_vpxblit.lib;on2_mem.lib;%(AdditionalDependencies) + $(OutDir)nsvdec_vp6.dll + true + ..\libvp6\lib\$(PlatformShortName)_$(Configuration)\;%(AdditionalLibraryDirectories) + msvcprt.lib;%(IgnoreSpecificDefaultLibraries) + false + $(OutDir)$(ProjectName).pdb + true + true + false + + $(IntDir)nsvdec_vp6.lib + MachineX86 + false + + + xcopy /Y /D $(OutDir)*.dll ..\..\..\Winamp_$(PlatformShortName)_$(Configuration)\Plugins\ + + + + + Disabled + WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;NSVDEC_vp6_EXPORTS + EnableFastChecks + MaxSpeed + WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;NSVDEC_vp6_EXPORTS + + + + + + \ No newline at end of file diff --git a/Src/nsvdec_vp6/nsvdec_vp6.vcxproj.filters b/Src/nsvdec_vp6/nsvdec_vp6.vcxproj.filters new file mode 100644 index 00000000..30cf0106 --- /dev/null +++ b/Src/nsvdec_vp6/nsvdec_vp6.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {aa5cf8a0-8643-459d-8044-0d7c4568140a} + cpp;c;cxx;rc;def;r;odl;idl;hpj;bat + + + {a6dd9f04-a9fb-4d6f-b656-6a031d7b8590} + h;hpp;hxx;hm;inl + + + {63b27f48-a8cc-409f-9814-43bbb3ca9650} + ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe + + + + + Source Files + + + \ No newline at end of file diff --git a/Src/nsvdec_vp6/nsvdec_vp6.xcodeproj/project.pbxproj b/Src/nsvdec_vp6/nsvdec_vp6.xcodeproj/project.pbxproj new file mode 100644 index 00000000..0952d5b5 --- /dev/null +++ b/Src/nsvdec_vp6/nsvdec_vp6.xcodeproj/project.pbxproj @@ -0,0 +1,237 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 42; + objects = { + +/* Begin PBXBuildFile section */ + 0C14248A0BB820A200FDDAB7 /* libdxv.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0C1424890BB820A200FDDAB7 /* libdxv.a */; }; + 0C1424990BB820D700FDDAB7 /* libon2_mem.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0C1424980BB820D700FDDAB7 /* libon2_mem.a */; }; + 0C1537720BB797B30098DEFA /* libvp6d.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0C1537710BB797B30098DEFA /* libvp6d.a */; }; + 0C15378A0BB7981A0098DEFA /* libvputil.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0C1537890BB7981A0098DEFA /* libvputil.a */; }; + 0C15379D0BB798500098DEFA /* libvpxblit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0C15379C0BB798500098DEFA /* libvpxblit.a */; }; + 0C1537B10BB7987F0098DEFA /* libvppp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0C1537B00BB7987F0098DEFA /* libvppp.a */; }; + 0C33627B0BB79481008CC17A /* vp6stub.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0C33627A0BB79481008CC17A /* vp6stub.cpp */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 0C1424890BB820A200FDDAB7 /* libdxv.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libdxv.a; path = ../vp6/lib/osx/Release/libdxv.a; sourceTree = SOURCE_ROOT; }; + 0C1424980BB820D700FDDAB7 /* libon2_mem.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libon2_mem.a; path = ../vp6/lib/osx/Release/libon2_mem.a; sourceTree = SOURCE_ROOT; }; + 0C1537710BB797B30098DEFA /* libvp6d.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvp6d.a; path = ../vp6/lib/osx/Release/libvp6d.a; sourceTree = SOURCE_ROOT; }; + 0C1537890BB7981A0098DEFA /* libvputil.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvputil.a; path = ../vp6/lib/osx/Release/libvputil.a; sourceTree = SOURCE_ROOT; }; + 0C15379C0BB798500098DEFA /* libvpxblit.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvpxblit.a; path = ../vp6/lib/osx/Release/libvpxblit.a; sourceTree = SOURCE_ROOT; }; + 0C1537B00BB7987F0098DEFA /* libvppp.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libvppp.a; path = ../vp6/lib/osx/Release/libvppp.a; sourceTree = SOURCE_ROOT; }; + 0C33627A0BB79481008CC17A /* vp6stub.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = vp6stub.cpp; sourceTree = ""; }; + D2AAC0630554660B00DB518D /* libnsvdec_vp6.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libnsvdec_vp6.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + D289988505E68E00004EDB86 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 0C1537720BB797B30098DEFA /* libvp6d.a in Frameworks */, + 0C15378A0BB7981A0098DEFA /* libvputil.a in Frameworks */, + 0C15379D0BB798500098DEFA /* libvpxblit.a in Frameworks */, + 0C1537B10BB7987F0098DEFA /* libvppp.a in Frameworks */, + 0C14248A0BB820A200FDDAB7 /* libdxv.a in Frameworks */, + 0C1424990BB820D700FDDAB7 /* libon2_mem.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 08FB7794FE84155DC02AAC07 /* nsvdec_vp6 */ = { + isa = PBXGroup; + children = ( + 0C3362BB0BB796BA008CC17A /* VP6 */, + 08FB7795FE84155DC02AAC07 /* Source */, + 1AB674ADFE9D54B511CA2CBB /* Products */, + ); + name = nsvdec_vp6; + sourceTree = ""; + }; + 08FB7795FE84155DC02AAC07 /* Source */ = { + isa = PBXGroup; + children = ( + 0C33627A0BB79481008CC17A /* vp6stub.cpp */, + ); + name = Source; + sourceTree = ""; + }; + 0C3362BB0BB796BA008CC17A /* VP6 */ = { + isa = PBXGroup; + children = ( + 0C1537710BB797B30098DEFA /* libvp6d.a */, + 0C15379C0BB798500098DEFA /* libvpxblit.a */, + 0C1537B00BB7987F0098DEFA /* libvppp.a */, + 0C1537890BB7981A0098DEFA /* libvputil.a */, + 0C1424890BB820A200FDDAB7 /* libdxv.a */, + 0C1424980BB820D700FDDAB7 /* libon2_mem.a */, + ); + name = VP6; + sourceTree = ""; + }; + 1AB674ADFE9D54B511CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + D2AAC0630554660B00DB518D /* libnsvdec_vp6.dylib */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + D2AAC0600554660B00DB518D /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + D2AAC0620554660B00DB518D /* nsvdec_vp6 */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1DEB914A08733D8E0010E9CD /* Build configuration list for PBXNativeTarget "nsvdec_vp6" */; + buildPhases = ( + D2AAC0600554660B00DB518D /* Headers */, + D2AAC0610554660B00DB518D /* Sources */, + D289988505E68E00004EDB86 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = nsvdec_vp6; + productName = nsvdec_vp6; + productReference = D2AAC0630554660B00DB518D /* libnsvdec_vp6.dylib */; + productType = "com.apple.product-type.library.dynamic"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 08FB7793FE84155DC02AAC07 /* Project object */ = { + isa = PBXProject; + buildConfigurationList = 1DEB914E08733D8E0010E9CD /* Build configuration list for PBXProject "nsvdec_vp6" */; + hasScannedForEncodings = 1; + mainGroup = 08FB7794FE84155DC02AAC07 /* nsvdec_vp6 */; + projectDirPath = ""; + targets = ( + D2AAC0620554660B00DB518D /* nsvdec_vp6 */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + D2AAC0610554660B00DB518D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 0C33627B0BB79481008CC17A /* vp6stub.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 1DEB914B08733D8E0010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + EXECUTABLE_PREFIX = lib; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + INSTALL_PATH = /usr/local/lib; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(LIBRARY_SEARCH_PATHS_QUOTED_1)", + "$(LIBRARY_SEARCH_PATHS_QUOTED_2)", + "$(LIBRARY_SEARCH_PATHS_QUOTED_3)", + ); + LIBRARY_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)/../vp6/lib/Release\""; + LIBRARY_SEARCH_PATHS_QUOTED_2 = "\"$(SRCROOT)/../vp6/lib/osx/Release\""; + LIBRARY_SEARCH_PATHS_QUOTED_3 = "\"$(SRCROOT)/../vp6/lib/osx/Release\""; + PRODUCT_NAME = nsvdec_vp6; + ZERO_LINK = YES; + }; + name = Debug; + }; + 1DEB914C08733D8E0010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = ( + ppc, + i386, + ); + EXECUTABLE_PREFIX = lib; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_MODEL_TUNING = G5; + INSTALL_PATH = /usr/local/lib; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(LIBRARY_SEARCH_PATHS_QUOTED_1)", + "$(LIBRARY_SEARCH_PATHS_QUOTED_2)", + "$(LIBRARY_SEARCH_PATHS_QUOTED_3)", + ); + LIBRARY_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)/../vp6/lib/Release\""; + LIBRARY_SEARCH_PATHS_QUOTED_2 = "\"$(SRCROOT)/../vp6/lib/osx/Release\""; + LIBRARY_SEARCH_PATHS_QUOTED_3 = "\"$(SRCROOT)/../vp6/lib/osx/Release\""; + PRODUCT_NAME = nsvdec_vp6; + }; + name = Release; + }; + 1DEB914F08733D8E0010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ../Wasabi; + PREBINDING = NO; + SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; + }; + name = Debug; + }; + 1DEB915008733D8E0010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ../Wasabi; + PREBINDING = NO; + SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1DEB914A08733D8E0010E9CD /* Build configuration list for PBXNativeTarget "nsvdec_vp6" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB914B08733D8E0010E9CD /* Debug */, + 1DEB914C08733D8E0010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1DEB914E08733D8E0010E9CD /* Build configuration list for PBXProject "nsvdec_vp6" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB914F08733D8E0010E9CD /* Debug */, + 1DEB915008733D8E0010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; +} diff --git a/Src/nsvdec_vp6/vp6stub.cpp b/Src/nsvdec_vp6/vp6stub.cpp new file mode 100644 index 00000000..31d2326a --- /dev/null +++ b/Src/nsvdec_vp6/vp6stub.cpp @@ -0,0 +1,208 @@ +/* +** nsvdec_vp6: vp6stub.cpp - VP6 decompressor +** +** The VP3 portions that this plug-in links with are Copyright (C) On2, Inc. +** For information on the license of VP3, please see: http://www.vp3.com/ +** (or vp32\vp3_license.txt if you got all files with this) +** +** Copyright (C) 2001-2002 Nullsoft, Inc. +** +** This software is provided 'as-is', without any express or implied warranty. +** In no event will the authors be held liable for any damages arising from the use of this software. +** +** Permission is granted to anyone to use this software for any purpose, including commercial +** applications, and to alter it and redistribute it freely, subject to the following restrictions: +** 1. The origin of this software must not be misrepresented; you must not claim that you wrote the +** original software. If you use this software in a product, an acknowledgment in the product +** documentation would be appreciated but is not required. +** 2. Altered source versions must be plainly marked as such, and must not be misrepresented as +** being the original software. +** 3. This notice may not be removed or altered from any source distribution. +** +** +*/ +#ifdef _WIN32 +#include +#endif +#include +#include "../nsv/nsvlib.h" +#include "../nsv/dec_if.h" +#include "duck_dxl.h" +#include +extern "C" { + void GetImageBufs(DXL_XIMAGE_HANDLE x, YV12_PLANES *p); + void vp60_SetParameter ( DXL_XIMAGE_HANDLE src, int Command, uintptr_t Parameter ); + +}; + +int vp6_postProcess=6; +int vp6_cpuFree=70; +int vp6_deInterlace=0; +int vp6_addNoise=1; + +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; + +extern "C" +{ + int vp60_Init(void); + int vp60_Exit(void); +} + +class VP6_Decoder : public IVideoDecoder { + public: + VP6_Decoder(int w, int h); + ~VP6_Decoder(); + int decode(int need_kf, + void *in, int in_len, + void **out, // out is set to a pointer to data + unsigned int *out_type, // 'Y','V','1','2' is currently defined + int *is_kf); + void flush() { } + + void initMmx(); + + private: + int l_tcpu, l_pp; + static int init; + static int mmx_available; + DXL_XIMAGE_HANDLE xim; + YV12_PLANES vidbufdec; +}; + +int VP6_Decoder::init; +int VP6_Decoder::mmx_available; + +VP6_Decoder::VP6_Decoder(int w, int h) +{ + l_tcpu=-1; + l_pp=-1; + if (!init) + { + init=1; + DXL_InitVideo(0,0); + vp60_Init(); + initMmx(); + } + vidbufdec.y.baseAddr=0; + xim = DXL_AlterXImage( NULL, (unsigned char *)"" ,NSV_MAKETYPE('V','P','6','0'), DXRGBNULL,w,h); +} + +void VP6_Decoder::initMmx() +{ +#ifdef _M_IX86 + unsigned __int32 retval1,retval2; + __try { + _asm { + mov eax, 1 // set up CPUID to return processor version and features + // 0 = vendor string, 1 = version info, 2 = cache info + _emit 0x0f // code bytes = 0fh, 0a2h + _emit 0xa2 + mov retval1, eax + mov retval2, edx + } + } __except(EXCEPTION_EXECUTE_HANDLER) { retval1 = retval2 = 0;} + mmx_available = retval1 && (retval2&0x800000); +#else + mmx_available=0; +#endif +} + +VP6_Decoder::~VP6_Decoder() +{ + if ( xim ) DXL_DestroyXImage( xim); +} + +int VP6_Decoder::decode(int need_kf, + void *in, int in_len, + void **out, // out is set to a pointer to data + unsigned int *out_type, // 'Y','V','1','2' is currently defined + int *is_kf) +{ + unsigned char *data=(unsigned char *)in; + + if (!xim) return -1; + + *out_type=NSV_MAKETYPE('Y','V','1','2'); + + if (vp6_postProcess != l_pp || vp6_cpuFree != l_tcpu) + { + l_pp=vp6_postProcess; + l_tcpu=vp6_cpuFree; + if(vp6_cpuFree) + DXL_SetParameter(xim, PBC_SET_CPUFREE, vp6_cpuFree); + else + DXL_SetParameter(xim, PBC_SET_POSTPROC, vp6_postProcess); + + DXL_SetParameter(xim, PBC_SET_DEINTERLACEMODE, vp6_deInterlace ); + DXL_SetParameter(xim, PBC_SET_ADDNOISE, vp6_addNoise); + + DXL_SetParameter(xim, PBC_SET_BLACKCLAMP,0); + DXL_SetParameter(xim, PBC_SET_WHITECLAMP,0); + } + + DXL_AlterXImageData( xim, data); + DXL_SetXImageCSize(xim, in_len); + + *is_kf=!(!in_len || data[0] > 0x7f); + + *out=NULL; + + if ((need_kf && !*is_kf) || !in_len) + { + return 0; + } + + if (!DXL_dxImageToVScreen( xim, NULL)) + { +#ifdef _M_IX86 + if(mmx_available) + { + _asm { + emms; + }; + } +#endif + GetImageBufs(xim,&vidbufdec); + *out=&vidbufdec; + return 0; + } + + return -1; +} + +#ifndef ACTIVEX_CONTROL +extern "C" { +DLLEXPORT IVideoDecoder *CreateVideoDecoder(int w, int h, double framerate, unsigned int fmt, int *flip) +{ + if (fmt == NSV_MAKETYPE('V','P','6','0') || fmt == NSV_MAKETYPE('V','P','6','1') || fmt == NSV_MAKETYPE('V','P','6','2')) + { + *flip=1; + return new VP6_Decoder(w,h); + } + return NULL; +} +} +#else +IVideoDecoder *VP6_CREATE(int w, int h, double framerate, unsigned int fmt, int *flip) +{ + if (fmt == NSV_MAKETYPE('V','P','6','0') || fmt == NSV_MAKETYPE('V','P','6','1') || fmt == NSV_MAKETYPE('V','P','6','2')) + { + *flip=1; + return new VP6_Decoder(w,h); + } + return NULL; +} +#endif \ No newline at end of file -- cgit