diff options
author | Jef <jef@targetspot.com> | 2024-09-24 08:54:57 -0400 |
---|---|---|
committer | Jef <jef@targetspot.com> | 2024-09-24 08:54:57 -0400 |
commit | 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (patch) | |
tree | 12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/nsvdec_vp3 | |
parent | 537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff) | |
download | winamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz |
Initial community commit
Diffstat (limited to 'Src/nsvdec_vp3')
-rw-r--r-- | Src/nsvdec_vp3/nsvdec_vp3.rc | 63 | ||||
-rw-r--r-- | Src/nsvdec_vp3/nsvdec_vp3.vcxproj | 153 | ||||
-rw-r--r-- | Src/nsvdec_vp3/nsvdec_vp3.vcxproj.filters | 55 | ||||
-rw-r--r-- | Src/nsvdec_vp3/resource.h | 14 | ||||
-rw-r--r-- | Src/nsvdec_vp3/version.rc2 | 39 | ||||
-rw-r--r-- | Src/nsvdec_vp3/vp3stub.cpp | 140 | ||||
-rw-r--r-- | Src/nsvdec_vp3/vp3stub.h | 11 |
7 files changed, 475 insertions, 0 deletions
diff --git a/Src/nsvdec_vp3/nsvdec_vp3.rc b/Src/nsvdec_vp3/nsvdec_vp3.rc new file mode 100644 index 00000000..1c4615df --- /dev/null +++ b/Src/nsvdec_vp3/nsvdec_vp3.rc @@ -0,0 +1,63 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.K.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "#include ""version.rc2""\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +#endif // English (U.K.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#include "version.rc2" + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/Src/nsvdec_vp3/nsvdec_vp3.vcxproj b/Src/nsvdec_vp3/nsvdec_vp3.vcxproj new file mode 100644 index 00000000..4c3ee250 --- /dev/null +++ b/Src/nsvdec_vp3/nsvdec_vp3.vcxproj @@ -0,0 +1,153 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <VCProjectVersion>17.0</VCProjectVersion> + <ProjectGuid>{4EFBC948-5728-4231-AD63-635566D9D52C}</ProjectGuid> + <RootNamespace>nsvdec_vp3</RootNamespace> + <Keyword>Win32Proj</Keyword> + <WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <PlatformToolset>v142</PlatformToolset> + <CharacterSet>MultiByte</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <PlatformToolset>v142</PlatformToolset> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </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)'=='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> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>17.0.32203.90</_ProjectFileVersion> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <OutDir>$(PlatformShortName)_$(Configuration)\</OutDir> + <IntDir>$(PlatformShortName)_$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + <GenerateManifest>false</GenerateManifest> + <IncludePath>$(IncludePath)</IncludePath> + <LibraryPath>$(LibraryPath)</LibraryPath> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <OutDir>$(PlatformShortName)_$(Configuration)\</OutDir> + <IntDir>$(PlatformShortName)_$(Configuration)\</IntDir> + <LinkIncremental>false</LinkIncremental> + <GenerateManifest>false</GenerateManifest> + <IncludePath>$(IncludePath)</IncludePath> + <LibraryPath>$(LibraryPath)</LibraryPath> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>../Wasabi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;NSVDEC_VP3_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>false</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <PrecompiledHeader /> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <Link> + <AdditionalOptions>/ignore:4229 %(AdditionalOptions)</AdditionalOptions> + <AdditionalDependencies>winmm.lib;msvcrt.lib;%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)nsvdec_vp3.dll</OutputFile> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>$(OutDir)nsvdec_vp3.pdb</ProgramDatabaseFile> + <SubSystem>Windows</SubSystem> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention /> + <ImportLibrary>$(OutDir)nsvdec_vp3.lib</ImportLibrary> + <TargetMachine>MachineX86</TargetMachine> + <IgnoreSpecificDefaultLibraries>msvprt.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries> + </Link> + <PostBuildEvent> + <Command>xcopy /Y /D $(OutDir)nsvdec_vp3.dll ..\..\..\Winamp_$(PlatformShortName)_$(Configuration)\plugins\ </Command> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <Optimization>Full</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <OmitFramePointers>true</OmitFramePointers> + <AdditionalIncludeDirectories>../Wasabi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;NSVDEC_VP3_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <BufferSecurityCheck>false</BufferSecurityCheck> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader /> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <AdditionalOptions>/ignore:4229 %(AdditionalOptions)</AdditionalOptions> + <AdditionalDependencies>winmm.lib;msvcrt.lib;%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)nsvdec_vp3.dll</OutputFile> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + <IgnoreSpecificDefaultLibraries>msvprt.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries> + <GenerateDebugInformation>false</GenerateDebugInformation> + <ProgramDatabaseFile>$(OutDir)$(ProjectName).pdb</ProgramDatabaseFile> + <SubSystem>Windows</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention /> + <ImportLibrary>$(OutDir)nsvdec_vp3.lib</ImportLibrary> + <TargetMachine>MachineX86</TargetMachine> + </Link> + <PostBuildEvent> + <Command>xcopy /Y /D $(OutDir)nsvdec_vp3.dll ..\..\..\Winamp_$(PlatformShortName)_$(Configuration)\plugins\ </Command> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="vp3stub.cpp" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="resource.h" /> + <ClInclude Include="vp3stub.h" /> + </ItemGroup> + <ItemGroup> + <Library Include="..\vp32\lib\win32\Release\s_cpuid.lib" /> + <CustomBuild Include="..\vp32\lib\win32\Release\s_dxv.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + </CustomBuild> + <CustomBuild Include="..\vp32\lib\win32\Release\s_sal.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + </CustomBuild> + <CustomBuild Include="..\vp32\lib\win32\Release\s_vp31d.lib"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> + </CustomBuild> + </ItemGroup> + <ItemGroup> + <ResourceCompile Include="nsvdec_vp3.rc" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/Src/nsvdec_vp3/nsvdec_vp3.vcxproj.filters b/Src/nsvdec_vp3/nsvdec_vp3.vcxproj.filters new file mode 100644 index 00000000..c2327da9 --- /dev/null +++ b/Src/nsvdec_vp3/nsvdec_vp3.vcxproj.filters @@ -0,0 +1,55 @@ +<?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>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Libraries"> + <UniqueIdentifier>{aeaac310-e5fb-4d39-9126-c0edea7b6192}</UniqueIdentifier> + </Filter> + <Filter Include="Libraries\Win32"> + <UniqueIdentifier>{d6b78406-d15a-4542-8d4e-2b63264c2996}</UniqueIdentifier> + </Filter> + <Filter Include="Libraries\Win64"> + <UniqueIdentifier>{3ef2e9d5-ddeb-435e-9c5e-bba526e2cb0a}</UniqueIdentifier> + </Filter> + <Filter Include="Resources"> + <UniqueIdentifier>{ff9ffd58-bfab-4c0e-834b-ab7934412a33}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="vp3stub.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="vp3stub.h"> + <Filter>Source Files</Filter> + </ClInclude> + <ClInclude Include="resource.h"> + <Filter>Resources</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <Library Include="..\vp32\lib\win32\Release\s_cpuid.lib"> + <Filter>Libraries\Win32</Filter> + </Library> + </ItemGroup> + <ItemGroup> + <ResourceCompile Include="nsvdec_vp3.rc"> + <Filter>Resources</Filter> + </ResourceCompile> + </ItemGroup> + <ItemGroup> + <CustomBuild Include="..\vp32\lib\win32\Release\s_dxv.lib"> + <Filter>Libraries\Win32</Filter> + </CustomBuild> + <CustomBuild Include="..\vp32\lib\win32\Release\s_sal.lib"> + <Filter>Libraries\Win32</Filter> + </CustomBuild> + <CustomBuild Include="..\vp32\lib\win32\Release\s_vp31d.lib"> + <Filter>Libraries\Win32</Filter> + </CustomBuild> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/Src/nsvdec_vp3/resource.h b/Src/nsvdec_vp3/resource.h new file mode 100644 index 00000000..c0a76160 --- /dev/null +++ b/Src/nsvdec_vp3/resource.h @@ -0,0 +1,14 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by nsvdec_vp3.rc + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/Src/nsvdec_vp3/version.rc2 b/Src/nsvdec_vp3/version.rc2 new file mode 100644 index 00000000..d01f7dde --- /dev/null +++ b/Src/nsvdec_vp3/version.rc2 @@ -0,0 +1,39 @@ + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// +#include "../Winamp/buildType.h" +VS_VERSION_INFO VERSIONINFO + FILEVERSION WINAMP_PRODUCTVER + PRODUCTVERSION WINAMP_PRODUCTVER + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "Winamp SA" + VALUE "FileDescription", "Winamp Support Library" + VALUE "FileVersion", STR_WINAMP_PRODUCTVER + VALUE "InternalName", "nsvdec_vp3.dll" + VALUE "LegalCopyright", "Copyright © 2003-2023 Winamp SA" + VALUE "LegalTrademarks", "Nullsoft and Winamp are trademarks of Winamp SA" + VALUE "OriginalFilename", "nsvdec_vp3.dll" + VALUE "ProductName", "Winamp Shared Code Library" + VALUE "ProductVersion", STR_WINAMP_PRODUCTVER + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END diff --git a/Src/nsvdec_vp3/vp3stub.cpp b/Src/nsvdec_vp3/vp3stub.cpp new file mode 100644 index 00000000..4be4feb7 --- /dev/null +++ b/Src/nsvdec_vp3/vp3stub.cpp @@ -0,0 +1,140 @@ +#include "../nsv/nsvplay/main.h" +#include "../vp32/include/duck_dxl.h" +#include "vfw.h" + +extern "C" { + void GetImageBufs(DXL_XIMAGE_HANDLE x, YV12_PLANES *p); +}; + +int vp3_postprocess=0; +int vp3_targetcpu=0; + +class VP3_Decoder : public IVideoDecoder { + public: + VP3_Decoder(int w, int h, int uvflip); + ~VP3_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() { } + + private: + int m_uvflip; + int l_tcpu, l_pp; + static int init; + DXL_XIMAGE_HANDLE xim; + YV12_PLANES vidbufdec; +}; + +int VP3_Decoder::init; + +VP3_Decoder::VP3_Decoder(int w, int h, int uvflip) +{ + l_tcpu=-1; + l_pp=-1; + if (!init) + { + init=1; + DXL_InitVideoEx(1,1); + } + m_uvflip=uvflip; + vidbufdec.y.baseAddr=0; + xim = DXL_AlterXImage( NULL, (unsigned char *)"" ,MAKEFOURCC('V','P','3','1'), DXRGBNULL,0,0); +} + +VP3_Decoder::~VP3_Decoder() +{ + if ( xim ) DXL_DestroyXImage( xim); +} + + +int VP3_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) +{ + bool provide_width_height = (out_type[0] == 1); + BYTE *data=(BYTE*)in; + + if (!xim) return -1; + + out_type[0]=NSV_MAKETYPE('Y','V','1','2'); + + if (vp3_postprocess != l_pp || vp3_targetcpu != l_tcpu) + { + l_pp=vp3_postprocess; + l_tcpu=vp3_targetcpu; + if (l_pp) + { + int v=l_tcpu; + if (v < 1) v=1; + if (v > 100) v=100; + vp31_SetParameter(xim,1, v); + vp31_SetParameter(xim,0, 9); + } + else + { + vp31_SetParameter(xim,1, 0); + vp31_SetParameter(xim,0, 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)) + { + GetImageBufs(xim,&vidbufdec); + if (m_uvflip) + { + YV12_PLANE tmp=vidbufdec.v; + vidbufdec.v=vidbufdec.u; + vidbufdec.u=tmp; + } + *out=&vidbufdec; + if (provide_width_height) + { + int x, y, w, h; + DXL_GetXImageXYWH(xim, &x, &y, &w, &h); + out_type[1] = w; + out_type[2] = h; + } + return 0; + } + + return -1; +} +/* +IVideoDecoder *VP3_CREATE(int w, int h, double framerate, unsigned int fmt, int *flip) +{ + if (fmt == NSV_MAKETYPE('V','P','3',' ') || fmt == NSV_MAKETYPE('V','P','3','1')) + { + *flip=1; + return new VP3_Decoder(w,h,fmt == NSV_MAKETYPE('V','P','3',' ')); + } + return NULL; +} +*/ +extern "C" { +__declspec(dllexport) IVideoDecoder *CreateVideoDecoder(int w, int h, double framerate, unsigned int fmt, int *flip) +{ + if (fmt == NSV_MAKETYPE('V','P','3',' ') || fmt == NSV_MAKETYPE('V','P','3','0') || fmt == NSV_MAKETYPE('V','P','3','1')) + { + *flip=1; + return new VP3_Decoder(w,h,fmt == NSV_MAKETYPE('V','P','3',' ')); + } + return NULL; +} +}
\ No newline at end of file diff --git a/Src/nsvdec_vp3/vp3stub.h b/Src/nsvdec_vp3/vp3stub.h new file mode 100644 index 00000000..dacc9663 --- /dev/null +++ b/Src/nsvdec_vp3/vp3stub.h @@ -0,0 +1,11 @@ +#ifndef _VP3STUB_H_ +#define _VP3STUB_H_ + +#include "main.h" + +extern int vp3_postprocess; +extern int vp3_targetcpu; + +IVideoDecoder *VP3_CREATE(int w, int h, double framerate, unsigned int fmt, int *flip); + +#endif
\ No newline at end of file |