Skip to content

Commit

Permalink
Update VirtualDub library to v1.10.1-test12 (MPC-HC)
Browse files Browse the repository at this point in the history
  • Loading branch information
BrunoReX authored and Cyberbeing committed Mar 4, 2014
1 parent 657500c commit 9519fc5
Show file tree
Hide file tree
Showing 35 changed files with 631 additions and 89 deletions.
3 changes: 3 additions & 0 deletions src/thirdparty/VirtualDub/Kasumi/Kasumi.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
</ClCompile>
<ClCompile Include="source\stretchblt_reference.cpp" />
<ClCompile Include="source\tables.cpp" />
<ClCompile Include="source\text.cpp" />
<ClCompile Include="source\triblt.cpp" />
<ClCompile Include="source\uberblit.cpp" />
<ClCompile Include="source\uberblit_16f.cpp" />
Expand Down Expand Up @@ -221,6 +222,8 @@
</YASM>
</ItemGroup>
<ItemGroup>
<None Include="data\Tuffy.ttf" />
<None Include="h\defaultfont.inl" />
<None Include="source\a_triblt.inc" />
</ItemGroup>
<ItemGroup>
Expand Down
15 changes: 15 additions & 0 deletions src/thirdparty/VirtualDub/Kasumi/Kasumi.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@
<Filter Include="Interface Header Files">
<UniqueIdentifier>{b69f77b1-cab6-4c5c-9c28-736eb17ce889}</UniqueIdentifier>
</Filter>
<Filter Include="Source Data Files">
<UniqueIdentifier>{8d72d2d5-c182-4c11-aa60-d0a265b0f440}</UniqueIdentifier>
</Filter>
<Filter Include="Autogenerated Header Files">
<UniqueIdentifier>{8e7ccb0e-3ac7-4207-9c64-a24b5028014f}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="source\alphablt.cpp">
Expand Down Expand Up @@ -142,6 +148,9 @@
<ClCompile Include="source\stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\text.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="h\bitutils.h">
Expand Down Expand Up @@ -305,5 +314,11 @@
</ItemGroup>
<ItemGroup>
<None Include="source\a_triblt.inc" />
<None Include="data\Tuffy.ttf">
<Filter>Source Data Files</Filter>
</None>
<None Include="h\defaultfont.inl">
<Filter>Autogenerated Header Files</Filter>
</None>
</ItemGroup>
</Project>
Binary file added src/thirdparty/VirtualDub/Kasumi/data/Tuffy.ttf
Binary file not shown.
12 changes: 12 additions & 0 deletions src/thirdparty/VirtualDub/Kasumi/data/Tuffy.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Tuffy.ttf comes from the website of Thatcher Ulrich, 1/7/2007:
http://tulrich.com/fonts/

The description on the website:

Public Domain Fonts

Here are my dabblings in font design. I have placed them in the Public
Domain. This is all 100% my own work. Usage is totally unrestricted. If
you want to make derivative works for any purpose, please go ahead.

I welcome comments & constructive criticism.
85 changes: 76 additions & 9 deletions src/thirdparty/VirtualDub/Kasumi/source/resample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,38 @@ bool VDPixmapResampler::Init(uint32 dw, uint32 dh, int dstformat, uint32 sw, uin
bool VDPixmapResampler::Init(const vdrect32f& dstrect0, uint32 dw, uint32 dh, int dstformat, const vdrect32f& srcrect0, uint32 sw, uint32 sh, int srcformat) {
Shutdown();

if (dstformat != srcformat || (
srcformat != nsVDPixmap::kPixFormat_XRGB8888 &&
srcformat != nsVDPixmap::kPixFormat_Y8 &&
srcformat != nsVDPixmap::kPixFormat_YUV444_Planar &&
srcformat != nsVDPixmap::kPixFormat_YUV422_Planar &&
srcformat != nsVDPixmap::kPixFormat_YUV420_Planar &&
srcformat != nsVDPixmap::kPixFormat_YUV411_Planar &&
srcformat != nsVDPixmap::kPixFormat_YUV410_Planar
))
if (dstformat != srcformat)
return false;

switch(srcformat) {
case nsVDPixmap::kPixFormat_XRGB8888:
case nsVDPixmap::kPixFormat_Y8:
case nsVDPixmap::kPixFormat_Y8_FR:
case nsVDPixmap::kPixFormat_YUV444_Planar:
case nsVDPixmap::kPixFormat_YUV444_Planar_FR:
case nsVDPixmap::kPixFormat_YUV444_Planar_709:
case nsVDPixmap::kPixFormat_YUV444_Planar_709_FR:
case nsVDPixmap::kPixFormat_YUV422_Planar:
case nsVDPixmap::kPixFormat_YUV422_Planar_FR:
case nsVDPixmap::kPixFormat_YUV422_Planar_709:
case nsVDPixmap::kPixFormat_YUV422_Planar_709_FR:
case nsVDPixmap::kPixFormat_YUV420_Planar:
case nsVDPixmap::kPixFormat_YUV420_Planar_FR:
case nsVDPixmap::kPixFormat_YUV420_Planar_709:
case nsVDPixmap::kPixFormat_YUV420_Planar_709_FR:
case nsVDPixmap::kPixFormat_YUV411_Planar:
case nsVDPixmap::kPixFormat_YUV411_Planar_FR:
case nsVDPixmap::kPixFormat_YUV411_Planar_709:
case nsVDPixmap::kPixFormat_YUV411_Planar_709_FR:
case nsVDPixmap::kPixFormat_YUV410_Planar:
case nsVDPixmap::kPixFormat_YUV410_Planar_FR:
case nsVDPixmap::kPixFormat_YUV410_Planar_709:
case nsVDPixmap::kPixFormat_YUV410_Planar_709_FR:
break;

default:
return false;
}

// convert destination flips to source flips
vdrect32f dstrect(dstrect0);
Expand Down Expand Up @@ -175,20 +197,35 @@ bool VDPixmapResampler::Init(const vdrect32f& dstrect0, uint32 dw, uint32 dh, in

switch(srcformat) {
case nsVDPixmap::kPixFormat_YUV444_Planar:
case nsVDPixmap::kPixFormat_YUV444_Planar_FR:
case nsVDPixmap::kPixFormat_YUV444_Planar_709:
case nsVDPixmap::kPixFormat_YUV444_Planar_709_FR:
break;
case nsVDPixmap::kPixFormat_YUV422_Planar:
case nsVDPixmap::kPixFormat_YUV422_Planar_FR:
case nsVDPixmap::kPixFormat_YUV422_Planar_709:
case nsVDPixmap::kPixFormat_YUV422_Planar_709_FR:
srcrect2.translate(0.25f, 0.0f);
dstrect2.translate(0.25f, 0.0f);
break;
case nsVDPixmap::kPixFormat_YUV420_Planar:
case nsVDPixmap::kPixFormat_YUV420_Planar_FR:
case nsVDPixmap::kPixFormat_YUV420_Planar_709:
case nsVDPixmap::kPixFormat_YUV420_Planar_709_FR:
srcrect2.translate(0.25f, 0.0f);
dstrect2.translate(0.25f, 0.0f);
break;
case nsVDPixmap::kPixFormat_YUV411_Planar:
case nsVDPixmap::kPixFormat_YUV411_Planar_FR:
case nsVDPixmap::kPixFormat_YUV411_Planar_709:
case nsVDPixmap::kPixFormat_YUV411_Planar_709_FR:
srcrect2.translate(0.375f, 0.0f);
dstrect2.translate(0.375f, 0.0f);
break;
case nsVDPixmap::kPixFormat_YUV410_Planar:
case nsVDPixmap::kPixFormat_YUV410_Planar_FR:
case nsVDPixmap::kPixFormat_YUV410_Planar_709:
case nsVDPixmap::kPixFormat_YUV410_Planar_709_FR:
break;
default:
VDASSERT(false);
Expand Down Expand Up @@ -221,6 +258,21 @@ bool VDPixmapResampler::Init(const vdrect32f& dstrect0, uint32 dw, uint32 dh, in
case nsVDPixmap::kPixFormat_YUV420_Planar:
case nsVDPixmap::kPixFormat_YUV411_Planar:
case nsVDPixmap::kPixFormat_YUV410_Planar:
case nsVDPixmap::kPixFormat_YUV444_Planar_FR:
case nsVDPixmap::kPixFormat_YUV422_Planar_FR:
case nsVDPixmap::kPixFormat_YUV420_Planar_FR:
case nsVDPixmap::kPixFormat_YUV411_Planar_FR:
case nsVDPixmap::kPixFormat_YUV410_Planar_FR:
case nsVDPixmap::kPixFormat_YUV444_Planar_709:
case nsVDPixmap::kPixFormat_YUV422_Planar_709:
case nsVDPixmap::kPixFormat_YUV420_Planar_709:
case nsVDPixmap::kPixFormat_YUV411_Planar_709:
case nsVDPixmap::kPixFormat_YUV410_Planar_709:
case nsVDPixmap::kPixFormat_YUV444_Planar_709_FR:
case nsVDPixmap::kPixFormat_YUV422_Planar_709_FR:
case nsVDPixmap::kPixFormat_YUV420_Planar_709_FR:
case nsVDPixmap::kPixFormat_YUV411_Planar_709_FR:
case nsVDPixmap::kPixFormat_YUV410_Planar_709_FR:
gen.ldsrc(0, 0, 0, 0, sw, sh, kVDPixType_8, sw);
ApplyFilters(gen, mDstRectPlane0.width(), mDstRectPlane0.height(), xoffset, yoffset, xfactor, yfactor);

Expand Down Expand Up @@ -266,6 +318,21 @@ void VDPixmapResampler::Process(const VDPixmap& dst, const VDPixmap& src) {
case nsVDPixmap::kPixFormat_YUV420_Planar:
case nsVDPixmap::kPixFormat_YUV411_Planar:
case nsVDPixmap::kPixFormat_YUV410_Planar:
case nsVDPixmap::kPixFormat_YUV444_Planar_FR:
case nsVDPixmap::kPixFormat_YUV422_Planar_FR:
case nsVDPixmap::kPixFormat_YUV420_Planar_FR:
case nsVDPixmap::kPixFormat_YUV411_Planar_FR:
case nsVDPixmap::kPixFormat_YUV410_Planar_FR:
case nsVDPixmap::kPixFormat_YUV444_Planar_709:
case nsVDPixmap::kPixFormat_YUV422_Planar_709:
case nsVDPixmap::kPixFormat_YUV420_Planar_709:
case nsVDPixmap::kPixFormat_YUV411_Planar_709:
case nsVDPixmap::kPixFormat_YUV410_Planar_709:
case nsVDPixmap::kPixFormat_YUV444_Planar_709_FR:
case nsVDPixmap::kPixFormat_YUV422_Planar_709_FR:
case nsVDPixmap::kPixFormat_YUV420_Planar_709_FR:
case nsVDPixmap::kPixFormat_YUV411_Planar_709_FR:
case nsVDPixmap::kPixFormat_YUV410_Planar_709_FR:
// blit primary plane
mpBlitter->Blit(dst, &mDstRectPlane0, src);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <stdafx.h> // MPC-HC patch
#include "stdafx.h" // MPC-HC patch
#include "resample_stages_x64.h"

extern "C" long vdasm_resize_table_col_SSE2(uint32 *out, const uint32 *const*in_table, const int *filter, int filter_width, uint32 w);
Expand Down
3 changes: 3 additions & 0 deletions src/thirdparty/VirtualDub/h/vd2/system/VDScheduler.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,15 @@ class VDSchedulerThreadPool {

uint32 GetThreadCount() const { return mThreadCount; }

void SetPriority(int priority);

bool Start(VDScheduler *pScheduler);
bool Start(VDScheduler *pScheduler, uint32 threadCount);

protected:
VDSchedulerThread *mpThreads;
uint32 mThreadCount;
int mThreadPriority;
};

#endif
2 changes: 2 additions & 0 deletions src/thirdparty/VirtualDub/h/vd2/system/VDString.h
Original file line number Diff line number Diff line change
Expand Up @@ -1250,5 +1250,7 @@ template<> VDStringW *vdmove_forward(VDStringW *src1, VDStringW *src2, VDStringW
template<> VDStringA *vdmove_backward(VDStringA *src1, VDStringA *src2, VDStringA *dst);
template<> VDStringW *vdmove_backward(VDStringW *src1, VDStringW *src2, VDStringW *dst);

VDMOVE_CAPABLE(VDStringA);
VDMOVE_CAPABLE(VDStringW);

#endif
15 changes: 6 additions & 9 deletions src/thirdparty/VirtualDub/h/vd2/system/binary.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,17 @@
#define VDMAKEFOURCC(byte1, byte2, byte3, byte4) (((uint8)byte1) + (((uint8)byte2) << 8) + (((uint8)byte3) << 16) + (((uint8)byte4) << 24))

#ifdef _MSC_VER
unsigned short _byteswap_ushort(unsigned short);
unsigned long _byteswap_ulong(unsigned long);
unsigned __int64 _byteswap_uint64(unsigned __int64);

#pragma intrinsic(_byteswap_ushort)
#pragma intrinsic(_byteswap_ulong)
#pragma intrinsic(_byteswap_uint64)
#include <vd2/system/win32/intrin.h>

inline uint16 VDSwizzleU16(uint16 value) { return (uint16)_byteswap_ushort((unsigned short)value); }
inline sint16 VDSwizzleS16(sint16 value) { return (sint16)_byteswap_ushort((unsigned short)value); }
inline uint32 VDSwizzleU32(uint32 value) { return (uint32)_byteswap_ulong((unsigned long)value); }
inline sint32 VDSwizzleS32(sint32 value) { return (sint32)_byteswap_ulong((unsigned long)value); }
inline uint64 VDSwizzleU64(uint64 value) { return (uint32)_byteswap_uint64((unsigned __int64)value); }
inline sint64 VDSwizzleS64(sint64 value) { return (sint32)_byteswap_uint64((unsigned __int64)value); }
inline uint64 VDSwizzleU64(uint64 value) { return (uint64)_byteswap_uint64((unsigned __int64)value); }
inline sint64 VDSwizzleS64(sint64 value) { return (sint64)_byteswap_uint64((unsigned __int64)value); }

inline uint32 VDRotateLeftU32(uint32 value, int bits) { return (uint32)_rotl((unsigned int)value, bits); }
inline uint32 VDRotateRightU32(uint32 value, int bits) { return (uint32)_rotr((unsigned int)value, bits); }
#else
inline uint16 VDSwizzleU16(uint16 value) {
return (value >> 8) + (value << 8);
Expand Down
5 changes: 5 additions & 0 deletions src/thirdparty/VirtualDub/h/vd2/system/filesys.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ uint64 VDFileGetLastWriteTime(const wchar_t *path);
VDStringW VDFileGetRootPath(const wchar_t *partialPath);
VDStringW VDGetFullPath(const wchar_t *partialPath);

extern VDStringW (*VDGetLongPath)(const wchar_t *path);

VDStringW VDMakePath(const wchar_t *base, const wchar_t *file);
bool VDFileIsPathEqual(const wchar_t *path1, const wchar_t *path2);
void VDFileFixDirPath(VDStringW& path);
Expand All @@ -196,6 +198,9 @@ VDStringW VDGetProgramPath();
VDStringW VDGetProgramFilePath();
VDStringW VDGetSystemPath();

void VDGetRootPaths(vdvector<VDStringW>& paths);
VDStringW VDGetRootVolumeLabel(const wchar_t *rootPath);

/////////////////////////////////////////////////////////////////////////////

enum VDFileAttributes {
Expand Down
2 changes: 2 additions & 0 deletions src/thirdparty/VirtualDub/h/vd2/system/filewatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class VDFileWatcher {
bool IsActive() const;

void Init(const wchar_t *file, IVDFileWatcherCallback *cb);
void InitDir(const wchar_t *path, bool subdirs, IVDFileWatcherCallback *cb);
void Shutdown();

bool Wait(uint32 delay = 0xFFFFFFFFU);
Expand All @@ -32,6 +33,7 @@ class VDFileWatcher {

void *mChangeHandle;
uint64 mLastWriteTime;
bool mbWatchDir;
VDStringW mPath;

IVDFileWatcherCallback *mpCB;
Expand Down
2 changes: 2 additions & 0 deletions src/thirdparty/VirtualDub/h/vd2/system/linearalloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ class VDLinearAllocator {
void *Allocate(size_t bytes) {
void *p = mpAllocPtr;

bytes = (bytes + sizeof(void *) - 1) & ((size_t)0 - (size_t)sizeof(void *));

if (mAllocLeft < bytes)
p = AllocateSlow(bytes);
else {
Expand Down
12 changes: 12 additions & 0 deletions src/thirdparty/VirtualDub/h/vd2/system/source/registrymemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,9 @@ void VDRegistryProviderMemory::Key::Remove(VDRegistryProviderMemory::Key *key) {
}

bool VDRegistryProviderMemory::Key::RemoveKey(const char *name) {
if (!name)
name = "";

// look up the subkey
KeyMap::iterator it(mKeyMap.find_as(name));

Expand Down Expand Up @@ -268,6 +271,9 @@ bool VDRegistryProviderMemory::Key::RemoveKey(const char *name) {
}

bool VDRegistryProviderMemory::Key::RemoveValue(const char *name) {
if (!name)
name = "";

ValueMap::iterator it(mValueMap.find_as(name));

if (it == mValueMap.end())
Expand All @@ -282,6 +288,9 @@ bool VDRegistryProviderMemory::Key::RemoveValue(const char *name) {
}

VDRegistryProviderMemory::Value *VDRegistryProviderMemory::Key::OpenValue(const char *name, bool create) {
if (!name)
name = "";

ValueMap::iterator it(mValueMap.find_as(name));

if (it != mValueMap.end())
Expand Down Expand Up @@ -638,6 +647,9 @@ void *VDRegistryProviderMemory::EnumValuesBegin(void *key) {
const char *VDRegistryProviderMemory::EnumValuesNext(void *enumerator) {
Enumerator *en = (Enumerator *)enumerator;

if (!en->mKey)
return NULL;

vdsynchronized(mMutex) {
const char *s = en->mKey->GetValueName(en->mIndex);
if (!s)
Expand Down
6 changes: 6 additions & 0 deletions src/thirdparty/VirtualDub/h/vd2/system/thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ void VDThreadSleep(int milliseconds);

class VDThread {
public:
enum {
kPriorityDefault = INT_MIN
};

VDThread(const char *pszDebugName = NULL); // NOTE: pszDebugName must have static duration
~VDThread() throw();

Expand All @@ -92,6 +96,7 @@ class VDThread {
bool ThreadStart(); // start thread
void ThreadDetach(); // detach thread (wait() won't be called)
void ThreadWait(); // wait for thread to finish
void ThreadSetPriority(int priority);

bool isThreadActive();

Expand Down Expand Up @@ -120,6 +125,7 @@ class VDThread {
const char *mpszDebugName;
VDThreadHandle mhThread;
VDThreadID mThreadID;
int mThreadPriority;
};

///////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 2 additions & 0 deletions src/thirdparty/VirtualDub/h/vd2/system/time.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,14 @@ class VDLazyTimer {
~VDLazyTimer();

void SetOneShot(IVDTimerCallback *pCB, uint32 delay);
void SetPeriodic(IVDTimerCallback *pCB, uint32 delay);
void Stop();

protected:
void StaticTimeCallback(VDZHWND hwnd, VDZUINT msg, VDZUINT_PTR id, VDZDWORD time);

uint32 mTimerId;
bool mbPeriodic;
VDFunctionThunk *mpThunk;
IVDTimerCallback *mpCB;
};
Expand Down
Loading

0 comments on commit 9519fc5

Please sign in to comment.