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/vp6/NSVFactory.cpp | 22 +++ Src/vp6/NSVFactory.h | 22 +++ Src/vp6/api.h | 11 ++ Src/vp6/avi_vp6_decoder.cpp | 149 +++++++++++++++++++++ Src/vp6/avi_vp6_decoder.h | 40 ++++++ Src/vp6/flv_vp6_decoder.cpp | 141 ++++++++++++++++++++ Src/vp6/flv_vp6_decoder.h | 36 +++++ Src/vp6/main.cpp | 100 ++++++++++++++ Src/vp6/nsvdec.cpp | 113 ++++++++++++++++ Src/vp6/nsvdec.h | 21 +++ Src/vp6/resource.h | 14 ++ Src/vp6/version.rc2 | 39 ++++++ Src/vp6/vp6.rc | 76 +++++++++++ Src/vp6/vp6.vcxproj | 318 ++++++++++++++++++++++++++++++++++++++++++++ Src/vp6/vp6.vcxproj.filters | 58 ++++++++ 15 files changed, 1160 insertions(+) create mode 100644 Src/vp6/NSVFactory.cpp create mode 100644 Src/vp6/NSVFactory.h create mode 100644 Src/vp6/api.h create mode 100644 Src/vp6/avi_vp6_decoder.cpp create mode 100644 Src/vp6/avi_vp6_decoder.h create mode 100644 Src/vp6/flv_vp6_decoder.cpp create mode 100644 Src/vp6/flv_vp6_decoder.h create mode 100644 Src/vp6/main.cpp create mode 100644 Src/vp6/nsvdec.cpp create mode 100644 Src/vp6/nsvdec.h create mode 100644 Src/vp6/resource.h create mode 100644 Src/vp6/version.rc2 create mode 100644 Src/vp6/vp6.rc create mode 100644 Src/vp6/vp6.vcxproj create mode 100644 Src/vp6/vp6.vcxproj.filters (limited to 'Src/vp6') diff --git a/Src/vp6/NSVFactory.cpp b/Src/vp6/NSVFactory.cpp new file mode 100644 index 00000000..36dcac34 --- /dev/null +++ b/Src/vp6/NSVFactory.cpp @@ -0,0 +1,22 @@ +#include "NSVFactory.h" +#include "nsvdec.h" +#include "api.h" +#include "../nsv/nsvlib.h" + +IVideoDecoder *NSVFactory::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; + void *mem = WASABI_API_MEMMGR->sysMalloc(sizeof(VP6_Decoder)); + VP6_Decoder *dec = new (mem) VP6_Decoder(w,h); + return dec; + } + return NULL; +} + +#define CBCLASS NSVFactory +START_DISPATCH; +CB(SVC_NSVFACTORY_CREATEVIDEODECODER, CreateVideoDecoder) +END_DISPATCH; +#undef CBCLASS \ No newline at end of file diff --git a/Src/vp6/NSVFactory.h b/Src/vp6/NSVFactory.h new file mode 100644 index 00000000..c53f14ed --- /dev/null +++ b/Src/vp6/NSVFactory.h @@ -0,0 +1,22 @@ +#ifndef NULLSOFT_AACPLUSDECODER_NSVFACTORY_H +#define NULLSOFT_AACPLUSDECODER_NSVFACTORY_H + +#include "../nsv/svc_nsvFactory.h" + +// {D121CDF8-8443-4430-8AD0-237FF4AC0163} +static const GUID vp6_nsv_guid = +{ 0xd121cdf8, 0x8443, 0x4430, { 0x8a, 0xd0, 0x23, 0x7f, 0xf4, 0xac, 0x1, 0x63 } }; + + +class NSVFactory : public svc_nsvFactory +{ +public: + static const char *getServiceName() { return "VP6 NSV Decoder"; } + static GUID getServiceGuid() { return vp6_nsv_guid; } + IVideoDecoder *CreateVideoDecoder(int w, int h, double framerate, unsigned int fmt, int *flip); + +protected: + RECVS_DISPATCH; +}; + +#endif \ No newline at end of file diff --git a/Src/vp6/api.h b/Src/vp6/api.h new file mode 100644 index 00000000..5564e604 --- /dev/null +++ b/Src/vp6/api.h @@ -0,0 +1,11 @@ +#ifndef NULLSOFT_APIH +#define NULLSOFT_APIH + +#include +extern api_service *serviceManager; +#define WASABI_API_SVC serviceManager + +#include +extern api_memmgr *memmgrApi; +#define WASABI_API_MEMMGR memmgrApi +#endif \ No newline at end of file diff --git a/Src/vp6/avi_vp6_decoder.cpp b/Src/vp6/avi_vp6_decoder.cpp new file mode 100644 index 00000000..6d5546e0 --- /dev/null +++ b/Src/vp6/avi_vp6_decoder.cpp @@ -0,0 +1,149 @@ +#include "avi_vp6_decoder.h" +#include "../nsv/nsvlib.h" +#include "../nsavi/nsavi.h" +#include "../libvp6/include/vp6.h" + +int AVIDecoderCreator::CreateVideoDecoder(const nsavi::AVIH *avi_header, const nsavi::STRH *stream_header, const nsavi::STRF *stream_format, const nsavi::STRD *stream_data, ifc_avivideodecoder **decoder) +{ + nsavi::video_format *format = (nsavi::video_format *)stream_format; + if (format) + { + if (format->compression == '26PV' || format->compression == '16PV' || format->compression == '06PV') + { + DXL_XIMAGE_HANDLE xim = DXL_AlterXImage( NULL, (unsigned char *)"" ,NSV_MAKETYPE('V','P','6','0'), DXRGBNULL, 0, 0); + if (!xim) + return CREATEDECODER_FAILURE; + *decoder = new AVIVP6(xim); + return CREATEDECODER_SUCCESS; + } + } + + return CREATEDECODER_NOT_MINE; +} + + +#define CBCLASS AVIDecoderCreator +START_DISPATCH; +CB(CREATE_VIDEO_DECODER, CreateVideoDecoder) +END_DISPATCH; +#undef CBCLASS + +static const int vp6_postProcess=6; +static const int vp6_cpuFree=70; +static const int vp6_deInterlace=0; +static const int vp6_addNoise=1; + + 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 + +} ; + + extern "C" + { + void GetImageBufs(DXL_XIMAGE_HANDLE x, YV12_PLANES *p); + void vp60_SetParameter(DXL_XIMAGE_HANDLE src, int Command, uintptr_t Parameter ); +}; + + +AVIVP6::AVIVP6(DXL_XIMAGE_HANDLE xim) : xim(xim) +{ + decoded=0; + + 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); +} + +int AVIVP6::GetOutputProperties(int *x, int *y, int *color_format, double *aspect_ratio, int *flip) +{ + if (xim) + { + if (vp60_getWH(xim, x, y) == DXL_OK) + { + *color_format = nsaviFOURCC('Y','V','1','2'); + *flip = 1; + return AVI_SUCCESS; + } + } + return AVI_FAILURE; +} + +int AVIVP6::DecodeChunk(uint16_t type, const void *inputBuffer, size_t inputBufferBytes) +{ + uint8_t *vp6_data = (uint8_t *)inputBuffer; + if (inputBufferBytes) + { + // skip first byte + //vp6_data++; + //inputBufferBytes--; + + DXL_AlterXImageData(xim, (unsigned char *)vp6_data); + DXL_SetXImageCSize(xim, inputBufferBytes); + if (!vp60_decompress(xim)) + { + decoded=1; + return AVI_SUCCESS; + } + } + + return AVI_FAILURE; +} + +void AVIVP6::Flush() +{ + //if (decoder) +// MPEG4Video_Flush(decoder); +} + +int AVIVP6::GetPicture(void **data, void **decoder_data) +{ + if (decoded) + { + GetImageBufs(xim,&vidbufdec); + *data=&vidbufdec; + *decoder_data = 0; + decoded = 0; + return AVI_SUCCESS; + } + + + return AVI_FAILURE; +} + +void AVIVP6::FreePicture(void *data, void *decoder_data) +{ + +} + +void AVIVP6::HurryUp(int state) +{ + +} + +#define CBCLASS AVIVP6 +START_DISPATCH; +CB(GET_OUTPUT_PROPERTIES, GetOutputProperties) +CB(DECODE_CHUNK, DecodeChunk) +VCB(FLUSH, Flush) +CB(GET_PICTURE, GetPicture) +VCB(FREE_PICTURE, FreePicture) +VCB(HURRY_UP, HurryUp) +END_DISPATCH; +#undef CBCLASS + diff --git a/Src/vp6/avi_vp6_decoder.h b/Src/vp6/avi_vp6_decoder.h new file mode 100644 index 00000000..8121e323 --- /dev/null +++ b/Src/vp6/avi_vp6_decoder.h @@ -0,0 +1,40 @@ +#pragma once +#include "../Plugins/Input/in_avi/ifc_avivideodecoder.h" +#include "../Plugins/Input/in_avi/svc_avidecoder.h" +#include "duck_dxl.h" +#include "../nsv/dec_if.h" + +// {51E8C046-6170-49ab-B690-1EDB58A2B76D} +static const GUID avi_vp6_guid = +{ 0x51e8c046, 0x6170, 0x49ab, { 0xb6, 0x90, 0x1e, 0xdb, 0x58, 0xa2, 0xb7, 0x6d } }; + + +class AVIDecoderCreator : public svc_avidecoder +{ +public: + static const char *getServiceName() { return "VP6 AVI Decoder"; } + static GUID getServiceGuid() { return avi_vp6_guid; } + int CreateVideoDecoder(const nsavi::AVIH *avi_header, const nsavi::STRH *stream_header, const nsavi::STRF *stream_format, const nsavi::STRD *stream_data, ifc_avivideodecoder **decoder); +protected: + RECVS_DISPATCH; +}; + +class AVIVP6 : public ifc_avivideodecoder +{ +public: + AVIVP6(DXL_XIMAGE_HANDLE xim); + + int GetOutputProperties(int *x, int *y, int *color_format, double *aspect_ratio, int *flip); + int DecodeChunk(uint16_t type, const void *inputBuffer, size_t inputBufferBytes); + void Flush(); + int GetPicture(void **data, void **decoder_data); + void FreePicture(void *data, void *decoder_data); + void HurryUp(int state); +private: + DXL_XIMAGE_HANDLE xim; + YV12_PLANES vidbufdec; + int decoded; + +protected: + RECVS_DISPATCH; +}; \ No newline at end of file diff --git a/Src/vp6/flv_vp6_decoder.cpp b/Src/vp6/flv_vp6_decoder.cpp new file mode 100644 index 00000000..5de9fd76 --- /dev/null +++ b/Src/vp6/flv_vp6_decoder.cpp @@ -0,0 +1,141 @@ +#include "flv_vp6_decoder.h" +#include "../nsv/nsvlib.h" +#include "../libvp6/include/vp6.h" +int FLVDecoderCreator::CreateVideoDecoder(int format_type, int width, int height, ifc_flvvideodecoder **decoder) +{ + if (format_type == FLV::VIDEO_FORMAT_VP6 || format_type == FLV::VIDEO_FORMAT_VP62) + { + //DXL_XIMAGE_HANDLE xim = DXL_CreateXImageOfType((unsigned char *)"" , format_type == FLV::VIDEO_FORMAT_VP6?NSV_MAKETYPE('V','P','6','0'):NSV_MAKETYPE('V','P','6','2')); + DXL_XIMAGE_HANDLE xim = DXL_AlterXImage( NULL, (unsigned char *)"" ,NSV_MAKETYPE('V','P','6','0'), DXRGBNULL, 0, 0); + if (!xim) + return CREATEDECODER_FAILURE; + *decoder = new FLVVP6(xim); + return CREATEDECODER_SUCCESS; + } + return CREATEDECODER_NOT_MINE; +} + +int FLVDecoderCreator::HandlesVideo(int format_type) +{ + if (format_type == FLV::VIDEO_FORMAT_VP6 || format_type == FLV::VIDEO_FORMAT_VP62) + { + return CREATEDECODER_SUCCESS; + } + return CREATEDECODER_NOT_MINE; +} + +#define CBCLASS FLVDecoderCreator +START_DISPATCH; +CB(CREATE_VIDEO_DECODER, CreateVideoDecoder) +CB(HANDLES_VIDEO, HandlesVideo) +END_DISPATCH; +#undef CBCLASS + +static const int vp6_postProcess=6; +static const int vp6_cpuFree=70; +static const int vp6_deInterlace=0; +static const int vp6_addNoise=1; + + 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 + +} ; + + extern "C" + { + void GetImageBufs(DXL_XIMAGE_HANDLE x, YV12_PLANES *p); + void vp60_SetParameter(DXL_XIMAGE_HANDLE src, int Command, uintptr_t Parameter ); +}; + +FLVVP6::FLVVP6(DXL_XIMAGE_HANDLE xim) : xim(xim) +{ + decoded=0; + + if(vp6_cpuFree) + vp60_SetParameter(xim, PBC_SET_CPUFREE, vp6_cpuFree); + else + vp60_SetParameter(xim, PBC_SET_POSTPROC, vp6_postProcess); + + vp60_SetParameter(xim, PBC_SET_DEINTERLACEMODE, vp6_deInterlace ); + vp60_SetParameter(xim, PBC_SET_ADDNOISE, vp6_addNoise); + vp60_SetParameter(xim, PBC_SET_BLACKCLAMP,0); + vp60_SetParameter(xim, PBC_SET_WHITECLAMP,0); +} + +int FLVVP6::GetOutputFormat(int *x, int *y, int *color_format) +{ + if (xim) + { + if (vp60_getWH(xim, x, y) == DXL_OK) + { + *color_format = NSV_MAKETYPE('Y','V','1','2'); + return FLV_VIDEO_SUCCESS; + } + } + return FLV_VIDEO_FAILURE; +} + +int FLVVP6::DecodeSample(const void *inputBuffer, size_t inputBufferBytes, int32_t timestamp) +{ + uint8_t *vp6_data = (uint8_t *)inputBuffer; + if (inputBufferBytes) + { + // skip first byte + vp6_data++; + inputBufferBytes--; + + DXL_AlterXImageData(xim, (unsigned char *)vp6_data); + DXL_SetXImageCSize(xim, inputBufferBytes); + if (!vp60_decompress(xim)) + { + decoded=1; + return FLV_VIDEO_SUCCESS; + } + } + + return FLV_VIDEO_FAILURE; + +} + +void FLVVP6::Close() +{ + if (xim) + DXL_DestroyXImage(xim); + + delete this; +} + +int FLVVP6::GetPicture(void **data, void **decoder_data, uint64_t *timestamp) +{ + if (decoded) + { + GetImageBufs(xim,&vidbufdec); + *data=&vidbufdec; + *decoder_data = 0; + decoded = 0; + return FLV_VIDEO_SUCCESS; + } + + return FLV_VIDEO_FAILURE; +} + + +#define CBCLASS FLVVP6 +START_DISPATCH; +CB(FLV_VIDEO_GETOUTPUTFORMAT, GetOutputFormat) +CB(FLV_VIDEO_DECODE, DecodeSample) +VCB(FLV_VIDEO_CLOSE, Close) +CB(FLV_VIDEO_GET_PICTURE, GetPicture) +END_DISPATCH; +#undef CBCLASS + diff --git a/Src/vp6/flv_vp6_decoder.h b/Src/vp6/flv_vp6_decoder.h new file mode 100644 index 00000000..51b9f32f --- /dev/null +++ b/Src/vp6/flv_vp6_decoder.h @@ -0,0 +1,36 @@ +#pragma once +#include "../Plugins/Input/in_flv/svc_flvdecoder.h" +#include "../Plugins/Input/in_flv/FLVVideoHeader.h" +#include "../Plugins/Input/in_flv/ifc_flvvideodecoder.h" +#include "duck_dxl.h" +#include "../nsv/dec_if.h" +// {8FFD7807-26F0-44ef-9B6E-BEFDD6B5779A} +static const GUID vp6_flv_guid = +{ 0x8ffd7807, 0x26f0, 0x44ef, { 0x9b, 0x6e, 0xbe, 0xfd, 0xd6, 0xb5, 0x77, 0x9a } }; + +class FLVDecoderCreator : public svc_flvdecoder +{ +public: + static const char *getServiceName() { return "VP6 FLV Decoder"; } + static GUID getServiceGuid() { return vp6_flv_guid; } + int CreateVideoDecoder(int format_type, int width, int height, ifc_flvvideodecoder **decoder); + int HandlesVideo(int format_type); +protected: + RECVS_DISPATCH; +}; + +class FLVVP6 : public ifc_flvvideodecoder +{ +public: + FLVVP6(DXL_XIMAGE_HANDLE xim); + int GetOutputFormat(int *x, int *y, int *color_format); + int DecodeSample(const void *inputBuffer, size_t inputBufferBytes, int32_t timestamp); + void Close(); + int GetPicture(void **data, void **decoder_data, uint64_t *timestamp); +private: + DXL_XIMAGE_HANDLE xim; + YV12_PLANES vidbufdec; + int decoded; +protected: + RECVS_DISPATCH; +}; \ No newline at end of file diff --git a/Src/vp6/main.cpp b/Src/vp6/main.cpp new file mode 100644 index 00000000..e08dc7fe --- /dev/null +++ b/Src/vp6/main.cpp @@ -0,0 +1,100 @@ +#include "api.h" +#include +#include "../Agave/Component/ifc_wa5component.h" +#include "../nu/Singleton.h" +#include "NSVFactory.h" +#include "duck_dxl.h" +#include "flv_vp6_decoder.h" +#include "avi_vp6_decoder.h" + +api_service *WASABI_API_SVC=0; +api_memmgr *WASABI_API_MEMMGR=0; + +class VP6Component : public ifc_wa5component +{ +public: + void RegisterServices(api_service *service); + int RegisterServicesSafeModeOk(); + void DeregisterServices(api_service *service); +protected: + RECVS_DISPATCH; +}; + +template +void ServiceBuild(api_T *&api_t, GUID factoryGUID_t) +{ + if (WASABI_API_SVC) + { + waServiceFactory *factory = WASABI_API_SVC->service_getServiceByGuid(factoryGUID_t); + if (factory) + api_t = reinterpret_cast( factory->getInterface() ); + } +} + +template +void ServiceRelease(api_T *api_t, GUID factoryGUID_t) +{ + if (WASABI_API_SVC && api_t) + { + waServiceFactory *factory = WASABI_API_SVC->service_getServiceByGuid(factoryGUID_t); + if (factory) + factory->releaseInterface(api_t); + } + api_t = NULL; +} + +static AVIDecoderCreator aviCreator; +static SingletonServiceFactory aviFactory; +FLVDecoderCreator flvCreator; +SingletonServiceFactory flvFactory; +static NSVFactory nsvFactory; +static SingletonServiceFactory factory; + +extern "C" +{ + int vp60_Init(void); + int vp60_Exit(void); +} + +void VP6Component::RegisterServices(api_service *service) +{ + WASABI_API_SVC = service; + ServiceBuild(WASABI_API_MEMMGR, memMgrApiServiceGuid); + factory.Register(WASABI_API_SVC, &nsvFactory); + flvFactory.Register(WASABI_API_SVC, &flvCreator); + aviFactory.Register(WASABI_API_SVC, &aviCreator); + + /* since we're delay loaded via WBM, it's safe to do this at load time */ + DXL_InitVideo(); + vp60_Init(); +} + +int VP6Component::RegisterServicesSafeModeOk() +{ + return 1; +} + +void VP6Component::DeregisterServices(api_service *service) +{ + factory.Deregister(WASABI_API_SVC); + flvFactory.Deregister(WASABI_API_SVC); + aviFactory.Deregister(WASABI_API_SVC); + ServiceRelease(WASABI_API_MEMMGR, memMgrApiServiceGuid); + + vp60_Exit(); + DXL_ExitVideo(); +} + +static VP6Component component; +extern "C" DLLEXPORT ifc_wa5component *GetWinamp5SystemComponent() +{ + return &component; +} + +#define CBCLASS VP6Component +START_DISPATCH; +VCB(API_WA5COMPONENT_REGISTERSERVICES, RegisterServices) +CB(15, RegisterServicesSafeModeOk) +VCB(API_WA5COMPONENT_DEREEGISTERSERVICES, DeregisterServices) +END_DISPATCH; +#undef CBCLASS \ No newline at end of file diff --git a/Src/vp6/nsvdec.cpp b/Src/vp6/nsvdec.cpp new file mode 100644 index 00000000..341c1709 --- /dev/null +++ b/Src/vp6/nsvdec.cpp @@ -0,0 +1,113 @@ +#include "nsvdec.h" + +#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 vp60_getWH(DXL_XIMAGE_HANDLE src, int *w, int *h); +}; + +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; + + +VP6_Decoder::VP6_Decoder(int w, int h) +{ + l_tcpu=-1; + l_pp=-1; + + vidbufdec.y.baseAddr=0; + xim = DXL_AlterXImage( NULL, (unsigned char *)"" ,NSV_MAKETYPE('V','P','6','0'), DXRGBNULL,0,0); +} + +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) +{ + bool provide_width_height = (out_type[0] == 1); + 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 + _asm { + emms; + }; +#endif + GetImageBufs(xim,&vidbufdec); + *out=&vidbufdec; + if (provide_width_height) + { + int w, h; + vp60_getWH(xim, &w, &h); + out_type[1] = w; + out_type[2] = h; + } + return 0; + } + + return -1; +} diff --git a/Src/vp6/nsvdec.h b/Src/vp6/nsvdec.h new file mode 100644 index 00000000..b68bcf60 --- /dev/null +++ b/Src/vp6/nsvdec.h @@ -0,0 +1,21 @@ +#pragma once +#include "duck_dxl.h" +#include "../nsv/dec_if.h" +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; + DXL_XIMAGE_HANDLE xim; + YV12_PLANES vidbufdec; +}; diff --git a/Src/vp6/resource.h b/Src/vp6/resource.h new file mode 100644 index 00000000..cb2a8dbf --- /dev/null +++ b/Src/vp6/resource.h @@ -0,0 +1,14 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by vp6.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/vp6/version.rc2 b/Src/vp6/version.rc2 new file mode 100644 index 00000000..daca699f --- /dev/null +++ b/Src/vp6/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 5.x System Component" + VALUE "FileVersion", STR_WINAMP_PRODUCTVER + VALUE "InternalName", "vp6.w5s" + VALUE "LegalCopyright", "Copyright © 2003-2023 Winamp SA" + VALUE "LegalTrademarks", "Nullsoft and Winamp are trademarks of Winamp SA" + VALUE "OriginalFilename", "vp6.w5s" + VALUE "ProductName", "Winamp VP6 Decoder Service" + VALUE "ProductVersion", STR_WINAMP_PRODUCTVER + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END diff --git a/Src/vp6/vp6.rc b/Src/vp6/vp6.rc new file mode 100644 index 00000000..fcff7711 --- /dev/null +++ b/Src/vp6/vp6.rc @@ -0,0 +1,76 @@ +// 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.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// 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/vp6/vp6.vcxproj b/Src/vp6/vp6.vcxproj new file mode 100644 index 00000000..813e2443 --- /dev/null +++ b/Src/vp6/vp6.vcxproj @@ -0,0 +1,318 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + 17.0 + {6F905496-DA64-4E9D-9650-0C01EA5D0BFF} + vp6 + Win32Proj + 10.0.19041.0 + + + + DynamicLibrary + v142 + Unicode + true + + + DynamicLibrary + v142 + Unicode + true + + + DynamicLibrary + v142 + Unicode + + + DynamicLibrary + v142 + Unicode + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>17.0.32505.173 + + + $(PlatformShortName)_$(Configuration)\ + $(PlatformShortName)_$(Configuration)\ + false + $(IncludePath) + $(LibraryPath) + .w5s + + + false + $(IncludePath) + $(LibraryPath) + $(PlatformShortName)_$(Configuration)\ + $(PlatformShortName)_$(Configuration)\ + .w5s + + + $(PlatformShortName)_$(Configuration)\ + $(PlatformShortName)_$(Configuration)\ + false + false + $(IncludePath) + $(LibraryPath) + .w5s + + + false + false + $(IncludePath) + $(LibraryPath) + $(PlatformShortName)_$(Configuration)\ + $(PlatformShortName)_$(Configuration)\ + .w5s + + + false + + + + + false + Debug + x86-windows-static-md + + + + + false + x86-windows-static-md + + + + + false + x86-windows-static-md + Debug + + + + + false + x86-windows-static-md + + + + Disabled + ..\Wasabi;..\libvpShared\corelibs\cdxv\dxv2\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;VP6_EXPORTS;%(PreprocessorDefinitions) + false + EnableFastChecks + MultiThreadedDebugDLL + + Level3 + ProgramDatabase + true + $(IntDir)$(TargetName).pdb + true + + + ws2_32.lib;winmm.lib;%(AdditionalDependencies) + $(OutDir)$(TargetName)$(TargetExt) + %(AdditionalLibraryDirectories) + msvcprt.lib;%(IgnoreSpecificDefaultLibraries) + true + $(IntDir)$(TargetName).pdb + Windows + $(IntDir)$(ProjectName).lib + MachineX86 + false + + + xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\ +xcopy /Y /D $(IntDir)$(TargetName).pdb ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\ + Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\' + + + + + Disabled + ..\Wasabi;..\libvpShared\corelibs\cdxv\dxv2\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;VP6_EXPORTS;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + true + $(IntDir)$(TargetName).pdb + true + + + ws2_32.lib;winmm.lib;%(AdditionalDependencies) + $(OutDir)$(TargetName)$(TargetExt) + %(AdditionalLibraryDirectories) + msvcprt.lib;%(IgnoreSpecificDefaultLibraries) + true + $(IntDir)$(TargetName).pdb + Windows + $(IntDir)$(ProjectName).lib + false + + + xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\ +xcopy /Y /D $(IntDir)$(TargetName).pdb ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\ + Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\' + + + + + MinSpace + true + Size + true + ..\Wasabi;..\libvpShared\corelibs\cdxv\dxv2\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;VP6_EXPORTS;%(PreprocessorDefinitions) + true + MultiThreadedDLL + true + true + + Level3 + None + $(IntDir)$(TargetName).pdb + true + + + ws2_32.lib;winmm.lib;%(AdditionalDependencies) + $(OutDir)$(TargetName)$(TargetExt) + %(AdditionalLibraryDirectories) + msvcprt.lib;%(IgnoreSpecificDefaultLibraries) + false + $(IntDir)$(TargetName).pdb + Windows + true + true + false + $(IntDir)$(ProjectName).lib + MachineX86 + false + + + xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\ + Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\' + + + + + MinSpace + true + Size + true + ..\Wasabi;..\libvpShared\corelibs\cdxv\dxv2\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;VP6_EXPORTS;%(PreprocessorDefinitions) + true + MultiThreadedDLL + true + true + + + Level3 + None + $(IntDir)$(TargetName).pdb + true + + + ws2_32.lib;winmm.lib;%(AdditionalDependencies) + $(OutDir)$(TargetName)$(TargetExt) + %(AdditionalLibraryDirectories) + msvcprt.lib;%(IgnoreSpecificDefaultLibraries) + false + $(IntDir)$(TargetName).pdb + Windows + true + true + false + $(IntDir)$(ProjectName).lib + false + + + xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\ + Post build event: 'xcopy /Y /D $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\System\' + + + + + {adac45fd-b93f-40a3-85b2-dbeca1283614} + + + {8666a681-2e07-49a5-b23e-ec28d165c63b} + + + {8f2bf92c-c4e1-45ae-ba45-2617b03b32ac} + + + {f93716ce-8f89-4334-be64-43705ef3fb70} + + + {77a73d85-7602-42f3-bac4-8d7f7bff8659} + + + {c3547fc9-a6ac-4706-bed7-d696a8ef9eed} + + + {3e0bfa8a-b86a-42e9-a33f-ec294f823f7f} + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Src/vp6/vp6.vcxproj.filters b/Src/vp6/vp6.vcxproj.filters new file mode 100644 index 00000000..f79b8bb8 --- /dev/null +++ b/Src/vp6/vp6.vcxproj.filters @@ -0,0 +1,58 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {8bb416de-a017-42d4-b6d6-7e75e3fcb914} + + + + + Source Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Resource Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Resource Files + + + \ No newline at end of file -- cgit