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_vp3/nsvdec_vp3.rc | 63 ++++++++++++ Src/nsvdec_vp3/nsvdec_vp3.vcxproj | 153 ++++++++++++++++++++++++++++++ Src/nsvdec_vp3/nsvdec_vp3.vcxproj.filters | 55 +++++++++++ Src/nsvdec_vp3/resource.h | 14 +++ Src/nsvdec_vp3/version.rc2 | 39 ++++++++ Src/nsvdec_vp3/vp3stub.cpp | 140 +++++++++++++++++++++++++++ Src/nsvdec_vp3/vp3stub.h | 11 +++ 7 files changed, 475 insertions(+) create mode 100644 Src/nsvdec_vp3/nsvdec_vp3.rc create mode 100644 Src/nsvdec_vp3/nsvdec_vp3.vcxproj create mode 100644 Src/nsvdec_vp3/nsvdec_vp3.vcxproj.filters create mode 100644 Src/nsvdec_vp3/resource.h create mode 100644 Src/nsvdec_vp3/version.rc2 create mode 100644 Src/nsvdec_vp3/vp3stub.cpp create mode 100644 Src/nsvdec_vp3/vp3stub.h (limited to 'Src/nsvdec_vp3') 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 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + 17.0 + {4EFBC948-5728-4231-AD63-635566D9D52C} + nsvdec_vp3 + Win32Proj + 10.0.19041.0 + + + + DynamicLibrary + v142 + MultiByte + true + + + DynamicLibrary + v142 + MultiByte + + + + + + + + + + + + + + + <_ProjectFileVersion>17.0.32203.90 + + + $(PlatformShortName)_$(Configuration)\ + $(PlatformShortName)_$(Configuration)\ + false + false + $(IncludePath) + $(LibraryPath) + + + $(PlatformShortName)_$(Configuration)\ + $(PlatformShortName)_$(Configuration)\ + false + false + $(IncludePath) + $(LibraryPath) + + + + Disabled + ../Wasabi;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;NSVDEC_VP3_EXPORTS;%(PreprocessorDefinitions) + false + EnableFastChecks + MultiThreadedDebug + + Level3 + EditAndContinue + + + /ignore:4229 %(AdditionalOptions) + winmm.lib;msvcrt.lib;%(AdditionalDependencies) + $(OutDir)nsvdec_vp3.dll + true + $(OutDir)nsvdec_vp3.pdb + Windows + false + + $(OutDir)nsvdec_vp3.lib + MachineX86 + msvprt.lib;%(IgnoreSpecificDefaultLibraries) + + + xcopy /Y /D $(OutDir)nsvdec_vp3.dll ..\..\..\Winamp_$(PlatformShortName)_$(Configuration)\plugins\ + + + + + Full + true + Speed + true + ../Wasabi;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;NSVDEC_VP3_EXPORTS;%(PreprocessorDefinitions) + true + MultiThreadedDLL + false + true + + Level3 + ProgramDatabase + + + /ignore:4229 %(AdditionalOptions) + winmm.lib;msvcrt.lib;%(AdditionalDependencies) + $(OutDir)nsvdec_vp3.dll + true + msvprt.lib;%(IgnoreSpecificDefaultLibraries) + false + $(OutDir)$(ProjectName).pdb + Windows + true + true + false + + $(OutDir)nsvdec_vp3.lib + MachineX86 + + + xcopy /Y /D $(OutDir)nsvdec_vp3.dll ..\..\..\Winamp_$(PlatformShortName)_$(Configuration)\plugins\ + + + + + + + + + + + + + true + + + true + + + true + + + + + + + + + \ 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 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {aeaac310-e5fb-4d39-9126-c0edea7b6192} + + + {d6b78406-d15a-4542-8d4e-2b63264c2996} + + + {3ef2e9d5-ddeb-435e-9c5e-bba526e2cb0a} + + + {ff9ffd58-bfab-4c0e-834b-ab7934412a33} + + + + + Source Files + + + + + Source Files + + + Resources + + + + + Libraries\Win32 + + + + + Resources + + + + + Libraries\Win32 + + + Libraries\Win32 + + + Libraries\Win32 + + + \ 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 -- cgit