Browse Source

add wip copy (via cpp2python) of Poikilos' SFR virtualdub plugin

master
poikilos 5 years ago
committed by Jacob Gustafson
parent
commit
da1074739f
  1. 1
      utilities/gimp/SpatialForegroundRemover-python/1.from-cpp.txt
  2. 244
      utilities/gimp/SpatialForegroundRemover-python/extras/FilterSDK/Filter.h.py
  3. 95
      utilities/gimp/SpatialForegroundRemover-python/extras/FilterSDK/ScriptError.h.py
  4. 70
      utilities/gimp/SpatialForegroundRemover-python/extras/FilterSDK/ScriptInterpreter.h.py
  5. 171
      utilities/gimp/SpatialForegroundRemover-python/extras/FilterSDK/ScriptValue.h.py
  6. 174
      utilities/gimp/SpatialForegroundRemover-python/extras/FilterSDK/VBitmap.h.py
  7. 57
      utilities/gimp/SpatialForegroundRemover-python/include/vd2/OldFilterSDK/Filter.h.py
  8. 8
      utilities/gimp/SpatialForegroundRemover-python/include/vd2/OldFilterSDK/ScriptError.h.py
  9. 11
      utilities/gimp/SpatialForegroundRemover-python/include/vd2/OldFilterSDK/ScriptInterpreter.h.py
  10. 17
      utilities/gimp/SpatialForegroundRemover-python/include/vd2/OldFilterSDK/ScriptValue.h.py
  11. 16
      utilities/gimp/SpatialForegroundRemover-python/include/vd2/OldFilterSDK/VBitmap.h.py
  12. 110
      utilities/gimp/SpatialForegroundRemover-python/include/vd2/VDXFrame/Unknown.h.py
  13. 220
      utilities/gimp/SpatialForegroundRemover-python/include/vd2/VDXFrame/VideoFilter.h.py
  14. 46
      utilities/gimp/SpatialForegroundRemover-python/include/vd2/VDXFrame/VideoFilterDialog.h.py
  15. 83
      utilities/gimp/SpatialForegroundRemover-python/include/vd2/VDXFrame/VideoFilterEntry.h.py
  16. 148
      utilities/gimp/SpatialForegroundRemover-python/include/vd2/plugin/vdaudiofilt.h.py
  17. 284
      utilities/gimp/SpatialForegroundRemover-python/include/vd2/plugin/vdinputdriver.h.py
  18. 206
      utilities/gimp/SpatialForegroundRemover-python/include/vd2/plugin/vdplugin.h.py
  19. 549
      utilities/gimp/SpatialForegroundRemover-python/include/vd2/plugin/vdvideofilt.h.py
  20. 127
      utilities/gimp/SpatialForegroundRemover-python/include/vd2/plugin/vdvideoutil.h.py
  21. 144
      utilities/gimp/SpatialForegroundRemover-python/references/yuv2ppm by Scott Scriven (fourcc.org yuv2ppm.c) accessed 2010-03-03.c.py
  22. 21
      utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/resource.h.py
  23. 1187
      utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/colorspacetransform.cpp.py
  24. 60
      utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/colorspacetransform.h.py
  25. 20
      utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/etc/pconvert.cpp.py
  26. 19
      utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/etc/pconvert.h.py
  27. 585
      utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/f_spatialforegroundremover.cpp.py
  28. 86
      utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/f_spatialforegroundremover.h.py
  29. 7
      utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/main.cpp.py
  30. 274
      utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/pimage.cpp.py
  31. 21
      utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/pimage.h.py
  32. 39
      utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/pstring.cpp.py
  33. 21
      utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/pstring.h.py
  34. 1256
      utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/targa--nondotnet/targa.cpp.py
  35. 131
      utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/targa--nondotnet/targa.h.py
  36. 1390
      utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/targa.cpp.py
  37. 151
      utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/targa.h.py
  38. 33
      utilities/gimp/SpatialForegroundRemover-python/src/VDXFrame/include/stdafx.h.py
  39. 220
      utilities/gimp/SpatialForegroundRemover-python/src/VDXFrame/source/VideoFilter.cpp.py
  40. 95
      utilities/gimp/SpatialForegroundRemover-python/src/VDXFrame/source/VideoFilterDialog.cpp.py
  41. 72
      utilities/gimp/SpatialForegroundRemover-python/src/VDXFrame/source/VideoFilterEntry.cpp.py
  42. 25
      utilities/gimp/SpatialForegroundRemover-python/src/VDXFrame/source/stdafx.cpp.py

1
utilities/gimp/SpatialForegroundRemover-python/1.from-cpp.txt

@ -0,0 +1 @@
to Python via cpp2python.txt

244
utilities/gimp/SpatialForegroundRemover-python/extras/FilterSDK/Filter.h.py

@ -0,0 +1,244 @@
# VirtualDub - Video processing and capture application
# Copyright (C) 1998-2002 Avery Lee
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with self program; if not, to the Free Software
# Foundation, Inc., Mass Ave, Cambridge, 02139, USA.
#
#
# FILTER EXEMPTION:
#
# As a special exemption to the GPL in order to permit creation of
# filters that work with multiple programs as well as VirtualDub,
# compiling with self header file shall not be considered creation
# of a derived work; that is, act of compiling with self header
# file does not require your source code or the resulting module
# to be released in source code form or under a GPL-compatible
# license according to parts (2) and (3) of the GPL. A filter built
# using self header file may thus be licensed or dual-licensed so
# that it may be used with VirtualDub as well as an alternative
# product whose license is incompatible with the GPL.
#
# Nothing in self exemption shall be consTrued as applying to
# VirtualDub itself -- that is, exemption does not give you
# permission to use parts of VirtualDub's source besides self
# header file, to dynamically link with VirtualDub as part
# of the filter load process, a fashion not permitted by the
# GPL.
#ifndef f_FILTER_H
#define f_FILTER_H
#include <windows.h>
# This is really dumb, necessary to support VTbls in C++.
struct FilterVTbls
void *pvtblVBitmap
#ifdef VDEXT_MAIN
struct FilterVTbls g_vtbls
#elif defined(VDEXT_NOTMAIN)
extern struct FilterVTbls g_vtbls
#endif
#define INITIALIZE_VTBLS ff.InitVTables(&g_vtbls)
#include "VBitmap.h"
#########
struct CScriptObject
#########
enum
FILTERPARAM_SWAP_BUFFERS = 0x00000001L,
FILTERPARAM_NEEDS_LAST = 0x00000002L,
#define FILTERPARAM_HAS_LAG(frames) ((int)(frames) << 16)
#########/
class VFBitmap
class FilterActivation
struct FilterFunctions
typedef int (*FilterInitProc )(FilterActivation *fa, *ff)
typedef void (*FilterDeinitProc )(FilterActivation *fa, *ff)
typedef int (*FilterRunProc )( FilterActivation *fa, *ff)
typedef long (*FilterParamProc )(FilterActivation *fa, *ff)
typedef int (*FilterConfigProc )(FilterActivation *fa, *ff, hWnd)
typedef void (*FilterStringProc )( FilterActivation *fa, *ff, *buf)
typedef int (*FilterStartProc )(FilterActivation *fa, *ff)
typedef int (*FilterEndProc )(FilterActivation *fa, *ff)
typedef bool (*FilterScriptStrProc)(FilterActivation *fa, *, *, int)
typedef void (*FilterStringProc2 )( FilterActivation *fa, *ff, *buf, maxlen)
typedef int (*FilterSerialize )(FilterActivation *fa, *ff, *buf, maxbuf)
typedef void (*FilterDeserialize )(FilterActivation *fa, *ff, *buf, maxbuf)
typedef void (*FilterCopy )(FilterActivation *fa, *ff, *dst)
typedef int (__cdecl *FilterModuleInitProc)(struct FilterModule *fm, *ff, vdfd_ver, vdfd_compat)
typedef void (__cdecl *FilterModuleDeinitProc)(struct FilterModule *fm, *ff)
#####
typedef void (__cdecl *FilterPreviewButtonCallback)(bool fNewState, *pData)
typedef void (__cdecl *FilterPreviewSampleCallback)(VFBitmap *, lFrame, lCount, *pData)
class IFilterPreview
public:
virtual void SetButtonCallback(FilterPreviewButtonCallback, *)=0
virtual void SetSampleCallback(FilterPreviewSampleCallback, *)=0
virtual bool isPreviewEnabled()=0
virtual void Toggle(HWND)=0
virtual void Display(HWND, bool)=0
virtual void RedoFrame()=0
virtual void RedoSystem()=0
virtual void UndoSystem()=0
virtual void InitButton(HWND)=0
virtual void Close()=0
virtual bool SampleCurrentFrame()=0
virtual long SampleFrames()=0
#####
#define VIRTUALDUB_FILTERDEF_VERSION (8)
#define VIRTUALDUB_FILTERDEF_COMPATIBLE (4)
# v3: added lCurrentSourceFrame to FrameStateInfo
# v4 (1.2): lots of additions (VirtualDub 1.2)
# v5 (1.3d): lots of bugfixes - stretchblt bilinear, non-zero startproc
# v6 (1.4): added error handling functions
# v7 (1.4d): added frame lag, handling
# v8 (1.4.11):
typedef struct FilterModule
struct FilterModule *next, *prev
HINSTANCE hInstModule
FilterModuleInitProc initProc
FilterModuleDeinitProc deinitProc
} FilterModule
typedef struct FilterDefinition
struct FilterDefinition *next, *prev
FilterModule *module
char * name
char * desc
char * maker
void * private_data
int inst_data_size
FilterInitProc initProc
FilterDeinitProc deinitProc
FilterRunProc runProc
FilterParamProc paramProc
FilterConfigProc configProc
FilterStringProc stringProc
FilterStartProc startProc
FilterEndProc endProc
CScriptObject *script_obj
FilterScriptStrProc fssProc
# NEW - 1.4.11
FilterStringProc2 stringProc2
FilterSerialize serializeProc
FilterDeserialize deserializeProc
FilterCopy copyProc
} FilterDefinition
#####
# FilterStateInfo: contains dynamic info about file being processed
class FilterStateInfo
public:
long lCurrentFrame; # current output frame
long lMicrosecsPerFrame; # microseconds per output frame
long lCurrentSourceFrame; # current source frame
long lMicrosecsPerSrcFrame; # microseconds per source frame
long lSourceFrameMS; # source frame timestamp
long lDestFrameMS; # output frame timestamp
# VFBitmap: VBitmap extended to hold filter-specific information
class VFBitmap : public VBitmap
public:
enum
NEEDS_HDC = 0x00000001L,
DWORD dwFlags
HDC hdc
# FilterActivation: This is what is actually passed to filters at runtime.
class FilterActivation
public:
FilterDefinition *filter
void *filter_data
VFBitmap &dst, &src
VFBitmap *__reserved0, last
unsigned long x1, y1, x2, y2
FilterStateInfo *pfsi
IFilterPreview *ifp
FilterActivation(VFBitmap& _dst, _src, *_last) : dst(_dst), src(_src), last(_last) {
FilterActivation( FilterActivation& fa, _dst, _src, *_last)
# These flags must match those in cpuaccel.h!
#ifndef f_VIRTUALDUB_CPUACCEL_H
#define CPUF_SUPPORTS_CPUID (0x00000001L)
#define CPUF_SUPPORTS_FPU (0x00000002L)
#define CPUF_SUPPORTS_MMX (0x00000004L)
#define CPUF_SUPPORTS_INTEGER_SSE (0x00000008L)
#define CPUF_SUPPORTS_SSE (0x00000010L)
#define CPUF_SUPPORTS_SSE2 (0x00000020L)
#define CPUF_SUPPORTS_3DNOW (0x00000040L)
#define CPUF_SUPPORTS_3DNOW_EXT (0x00000080L)
#endif
struct FilterFunctions
FilterDefinition *(*addFilter)(FilterModule *, *, fd_len)
void (*removeFilter)(FilterDefinition *)
bool (*isFPUEnabled)()
bool (*isMMXEnabled)()
void (*InitVTables)(struct FilterVTbls *)
# These functions permit you to throw MyError exceptions from a filter.
# YOU MUST ONLY CALL THESE IN runProc, initProc, startProc.
void (*ExceptOutOfMemory)(); # ADDED: V6 (VirtualDub 1.4)
void (*Except)( char *format, ...); # ADDED: V6 (VirtualDub 1.4)
# These functions are callable at any time.
long (*getCPUFlags)(); # ADDED: V6 (VirtualDub 1.4)
long (*getHostVersionInfo)(char *buffer, len); # ADDED: V7 (VirtualDub 1.4d)
#endif

95
utilities/gimp/SpatialForegroundRemover-python/extras/FilterSDK/ScriptError.h.py

@ -0,0 +1,95 @@
# VirtualDub - Video processing and capture application
# Copyright (C) 1998-2002 Avery Lee
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with self program; if not, to the Free Software
# Foundation, Inc., Mass Ave, Cambridge, 02139, USA.
#
#
# FILTER EXEMPTION:
#
# As a special exemption to the GPL in order to permit creation of
# filters that work with multiple programs as well as VirtualDub,
# compiling with self header file shall not be considered creation
# of a derived work; that is, act of compiling with self header
# file does not require your source code or the resulting module
# to be released in source code form or under a GPL-compatible
# license according to parts (2) and (3) of the GPL. A filter built
# using self header file may thus be licensed or dual-licensed so
# that it may be used with VirtualDub as well as an alternative
# product whose license is incompatible with the GPL.
#
# Nothing in self exemption shall be consTrued as applying to
# VirtualDub itself -- that is, exemption does not give you
# permission to use parts of VirtualDub's source besides self
# header file, to dynamically link with VirtualDub as part
# of the filter load process, a fashion not permitted by the
# GPL.
#ifndef f_SYLIA_SCRIPTERROR_H
#define f_SYLIA_SCRIPTERROR_H
class CScriptError
public:
int err
enum
PARSE_ERROR=1,
SEMICOLON_EXPECTED,
IDENTIFIER_EXPECTED,
TYPE_INT_REQUIRED,
TYPE_ARRAY_REQUIRED,
TYPE_FUNCTION_REQUIRED,
TYPE_OBJECT_REQUIRED,
OBJECT_MEMBER_NAME_REQUIRED,
FUNCCALLEND_EXPECTED,
TOO_MANY_PARAMS,
DIVIDE_BY_ZERO,
VAR_NOT_FOUND,
MEMBER_NOT_FOUND,
OVERLOADED_FUNCTION_NOT_FOUND,
IDENT_TOO_LONG,
OPERATOR_EXPECTED,
CLOSEPARENS_EXPECTED,
CLOSEBRACKET_EXPECTED,
VAR_UNDEFINED,
OUT_OF_STRING_SPACE,
OUT_OF_MEMORY,
INTERNAL_ERROR,
EXTERNAL_ERROR,
FCALL_OUT_OF_RANGE,
FCALL_INVALID_PTYPE,
FCALL_UNKNOWN_STR,
CScriptError(int err_num) : err(err_num) {
int getErr()
return err
#define SCRIPT_ERROR(x) throw CScriptError(CScriptError.##x)
extern "C" __declspec(dllexport) char * __stdcall TranslateScriptError(int)
char inline *TranslateScriptError(CScriptError cse)
return TranslateScriptError(cse.getErr())
#endif

70
utilities/gimp/SpatialForegroundRemover-python/extras/FilterSDK/ScriptInterpreter.h.py

@ -0,0 +1,70 @@
# VirtualDub - Video processing and capture application
# Copyright (C) 1998-2002 Avery Lee
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with self program; if not, to the Free Software
# Foundation, Inc., Mass Ave, Cambridge, 02139, USA.
#
#
# FILTER EXEMPTION:
#
# As a special exemption to the GPL in order to permit creation of
# filters that work with multiple programs as well as VirtualDub,
# compiling with self header file shall not be considered creation
# of a derived work; that is, act of compiling with self header
# file does not require your source code or the resulting module
# to be released in source code form or under a GPL-compatible
# license according to parts (2) and (3) of the GPL. A filter built
# using self header file may thus be licensed or dual-licensed so
# that it may be used with VirtualDub as well as an alternative
# product whose license is incompatible with the GPL.
#
# Nothing in self exemption shall be consTrued as applying to
# VirtualDub itself -- that is, exemption does not give you
# permission to use parts of VirtualDub's source besides self
# header file, to dynamically link with VirtualDub as part
# of the filter load process, a fashion not permitted by the
# GPL.
#ifndef f_SYLIA_SCRIPTINTERPRETER_H
#define f_SYLIA_SCRIPTINTERPRETER_H
class CScriptValue
class CScriptError
struct CScriptObject
class IScriptInterpreter
typedef CScriptValue (*ScriptRootHandlerPtr)(IScriptInterpreter *, *, *)
class IScriptInterpreter
public:
virtual void Destroy() =0
virtual void SetRootHandler(ScriptRootHandlerPtr, *) =0
virtual void ExecuteLine(char *s) =0
virtual void ScriptError(int e) =0
virtual char* TranslateScriptError(CScriptError& cse) =0
virtual char** AllocTempString(long l) =0
virtual CScriptValue LookupObjectMember(CScriptObject *obj, *, *szIdent) = 0
extern "C" __declspec(dllexport) IScriptInterpreter * __stdcall CreateScriptInterpreter()
#define GETPROC_CREATESCRIPTINTERPRETER(hInst) ((IScriptInterpreter *(__stdcall *)())GetProcAddress(hInst, "_CreateScriptInterpreter@0"))
#define EXT_SCRIPT_ERROR(x) (isi.ScriptError((CScriptError.x)))
#endif

171
utilities/gimp/SpatialForegroundRemover-python/extras/FilterSDK/ScriptValue.h.py

@ -0,0 +1,171 @@
# VirtualDub - Video processing and capture application
# Copyright (C) 1998-2002 Avery Lee
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with self program; if not, to the Free Software
# Foundation, Inc., Mass Ave, Cambridge, 02139, USA.
#
#
# FILTER EXEMPTION:
#
# As a special exemption to the GPL in order to permit creation of
# filters that work with multiple programs as well as VirtualDub,
# compiling with self header file shall not be considered creation
# of a derived work; that is, act of compiling with self header
# file does not require your source code or the resulting module
# to be released in source code form or under a GPL-compatible
# license according to parts (2) and (3) of the GPL. A filter built
# using self header file may thus be licensed or dual-licensed so
# that it may be used with VirtualDub as well as an alternative
# product whose license is incompatible with the GPL.
#
# Nothing in self exemption shall be consTrued as applying to
# VirtualDub itself -- that is, exemption does not give you
# permission to use parts of VirtualDub's source besides self
# header file, to dynamically link with VirtualDub as part
# of the filter load process, a fashion not permitted by the
# GPL.
#ifndef f_SYLIA_SCRIPTVALUE_H
#define f_SYLIA_SCRIPTVALUE_H
class CScriptArray
struct CScriptObject
class CScriptValue
class IScriptInterpreter
class VariableTableEntry
typedef CScriptValue (*ScriptObjectLookupFuncPtr)(IScriptInterpreter *, *, *lpVoid, *szName)
typedef CScriptValue (*ScriptFunctionPtr)(IScriptInterpreter *, *, *, int)
typedef void (*ScriptVoidFunctionPtr)(IScriptInterpreter *, *, *, int)
typedef int (*ScriptIntFunctionPtr)(IScriptInterpreter *, *, *, int)
typedef CScriptValue (*ScriptArrayFunctionPtr)(IScriptInterpreter *, *, int)
typedef struct ScriptFunctionDef
ScriptFunctionPtr func_ptr
char *name
char *arg_list
} ScriptFunctionDef
typedef struct ScriptObjectDef
char *name
CScriptObject *obj
} ScriptObjectDef
typedef struct CScriptObject
ScriptObjectLookupFuncPtr Lookup
ScriptFunctionDef *func_list
ScriptObjectDef *obj_list
} CScriptObject
class CScriptValue
public:
enum { T_VOID, T_INT, T_PINT, T_STR, T_ARRAY, T_OBJECT, T_FNAME, T_FUNCTION, T_VARLV } type
CScriptObject *thisPtr
union
int i
int *pi
char **s
ScriptArrayFunctionPtr ary
CScriptObject *obj
ScriptFunctionPtr func
ScriptFunctionDef *fname
VariableTableEntry *vte
} u
void *lpVoid
CScriptValue()
type = T_VOID
CScriptValue(int i)
type = T_INT
u.i = i
CScriptValue(int *pi)
type = T_PINT
u.pi = pi
CScriptValue(char **s)
type = T_STR
u.s = s
CScriptValue(CScriptObject *obj)
type = T_OBJECT
u.obj = obj
CScriptValue(CScriptObject *_thisPtr, csa)
type = T_ARRAY
u.ary = csa
thisPtr = _thisPtr
CScriptValue(CScriptObject *_thisPtr, *sfd)
type = T_FNAME
u.fname = sfd
thisPtr = _thisPtr
CScriptValue(CScriptObject *_thisPtr, fn)
type = T_FUNCTION
u.func = fn
thisPtr = _thisPtr
CScriptValue(VariableTableEntry *vte)
type = T_VARLV
u.vte = vte
bool isVoid()
return type == T_VOID
bool isInt()
return type == T_INT
bool isString()
return type == T_STR
bool isArray()
return type == T_ARRAY
bool isObject()
return type == T_OBJECT
bool isFName()
return type == T_FNAME
bool isFunction()
return type == T_FUNCTION
bool isVarLV()
return type == T_VARLV
int asInt()
return u.i
char ** asString()
return u.s
ScriptArrayFunctionPtr asArray()
return u.ary
CScriptObject * asObject()
return u.obj
ScriptFunctionPtr asFunction()
return u.func
VariableTableEntry* asVarLV()
return u.vte
#endif

174
utilities/gimp/SpatialForegroundRemover-python/extras/FilterSDK/VBitmap.h.py

@ -0,0 +1,174 @@
# VirtualDub - Video processing and capture application
# Copyright (C) 1998-2002 Avery Lee
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with self program; if not, to the Free Software
# Foundation, Inc., Mass Ave, Cambridge, 02139, USA.
#
#
# FILTER EXEMPTION:
#
# As a special exemption to the GPL in order to permit creation of
# filters that work with multiple programs as well as VirtualDub,
# compiling with self header file shall not be considered creation
# of a derived work; that is, act of compiling with self header
# file does not require your source code or the resulting module
# to be released in source code form or under a GPL-compatible
# license according to parts (2) and (3) of the GPL. A filter built
# using self header file may thus be licensed or dual-licensed so
# that it may be used with VirtualDub as well as an alternative
# product whose license is incompatible with the GPL.
#
# Nothing in self exemption shall be consTrued as applying to
# VirtualDub itself -- that is, exemption does not give you
# permission to use parts of VirtualDub's source besides self
# header file, to dynamically link with VirtualDub as part
# of the filter load process, a fashion not permitted by the
# GPL.
#ifndef f_VIRTUALDUB_VBITMAP_H
#define f_VIRTUALDUB_VBITMAP_H
#include <windows.h>
typedef unsigned long Pixel
typedef unsigned long Pixel32
typedef unsigned char Pixel8
typedef long PixCoord
typedef long PixDim
typedef long PixOffset
#ifdef VDEXT_VIDEO_FILTER
#define NOVTABLE __declspec(novtable)
#else:
#define NOVTABLE
#endif
class NOVTABLE VBitmap
public:
Pixel * data
Pixel * palette
int depth
PixCoord w, h
PixOffset pitch
PixOffset modulo
PixOffset size
PixOffset offset
Pixel *Address(PixCoord x, y)
return Addressi(x, h-y-1)
Pixel *Addressi(PixCoord x, y)
return (Pixel *)((char *)data + y*pitch + x*(depth>>3))
Pixel *Address16(PixCoord x, y)
return Address16i(x, h-y-1)
Pixel *Address16i(PixCoord x, y)
return (Pixel *)((char *)data + y*pitch + x*2)
Pixel *Address32(PixCoord x, y)
return Address32i(x, h-y-1)
Pixel *Address32i(PixCoord x, y)
return (Pixel *)((char *)data + y*pitch + x*sizeof(Pixel))
PixOffset PitchAlign4()
return ((w * depth + 31)/32)*4
PixOffset PitchAlign8()
return ((w * depth + 63)/64)*8
PixOffset Modulo()
return pitch - (w*depth+7)/8
PixOffset Size()
return pitch*h
###
VBitmap() throw()
#ifdef VDEXT_VIDEO_FILTER
init()
#endif
VBitmap(void *data, w, h, depth) throw()
VBitmap(void *data, *) throw()
#ifdef VDEXT_VIDEO_FILTER
void init() throw()
*(void **)self = g_vtbls.pvtblVBitmap
#endif
virtual VBitmap& init(void *data, w, h, depth) throw()
virtual VBitmap& init(void *data, *) throw()
virtual void MakeBitmapHeader(BITMAPINFOHEADER *bih) throw()
virtual void AlignTo4() throw()
virtual void AlignTo8() throw()
virtual void BitBlt(PixCoord x2, y2, *src, x1, y1, dx, dy) throw()
virtual void BitBltDither(PixCoord x2, y2, *src, x1, y1, dx, dy, to565) throw()
virtual void BitBlt565(PixCoord x2, y2, *src, x1, y1, dx, dy) throw()
virtual bool BitBltXlat1(PixCoord x2, y2, *src, x1, y1, dx, dy, *tbl) throw()
virtual bool BitBltXlat3(PixCoord x2, y2, *src, x1, y1, dx, dy, *tbl) throw()
virtual bool StretchBltNearestFast(PixCoord x1, y1, dx, dy, *src, x2, y2, dx1, dy1) throw()
virtual bool StretchBltBilinearFast(PixCoord x1, y1, dx, dy, *src, x2, y2, dx1, dy1) throw()
virtual bool RectFill(PixCoord x1, y1, dx, dy, c) throw()
enum
HISTO_LUMA,
HISTO_GRAY,
HISTO_RED,
HISTO_GREEN,
HISTO_BLUE,
virtual bool Histogram(PixCoord x, y, dx, dy, *pHisto, iHistoType) throw()
## NEW AS OF VIRTUALDUB V1.2B
virtual bool BitBltFromYUY2(PixCoord x2, y2, *src, x1, y1, dx, dy) throw()
virtual bool BitBltFromI420(PixCoord x2, y2, *src, x1, y1, dx, dy) throw()
## NEW AS OF VIRTUALDUB V1.4C
virtual void MakeBitmapHeaderNoPadding(BITMAPINFOHEADER *bih) throw()
#####/
bool BitBltFromYUY2Fullscale(PixCoord x2, y2, *src, x1, y1, dx, dy) throw()
private:
bool dualrectclip(PixCoord& x2, y2, *src, x1, y1, dx, dy) throw()
#undef NOVTABLE
#endif

57
utilities/gimp/SpatialForegroundRemover-python/include/vd2/OldFilterSDK/Filter.h.py

@ -0,0 +1,57 @@
#ifndef f_FILTER_H
#define f_FILTER_H
#include <vd2/plugin/vdvideofilt.h>
#include <windows.h>
# This is really dumb, necessary to support VTbls in C++.
typedef struct VDXFilterVTbls
void *pvtblVBitmap
} FilterVTbls
#ifdef VDEXT_MAIN
VDXFilterVTbls g_vtbls
#elif defined(VDEXT_NOTMAIN)
extern VDXFilterVTbls g_vtbls
#endif
#define INITIALIZE_VTBLS ff.InitVTables(&g_vtbls)
#include "VBitmap.h"
typedef .VDXFilterInitProc FilterInitProc
typedef .VDXFilterDeinitProc FilterDeinitProc
typedef .VDXFilterRunProc FilterRunProc
typedef .VDXFilterParamProc FilterParamProc
typedef .VDXFilterConfigProc FilterConfigProc
typedef .VDXFilterStringProc FilterStringProc
typedef .VDXFilterStartProc FilterStartProc
typedef .VDXFilterEndProc FilterEndProc
typedef .VDXFilterScriptStrProc FilterScriptStrProc
typedef .VDXFilterStringProc2 FilterStringProc2
typedef .VDXFilterSerialize FilterSerialize
typedef .VDXFilterDeserialize FilterDeserialize
typedef .VDXFilterCopy FilterCopy
typedef .VDXFilterModuleInitProc FilterModuleInitProc
typedef .VDXFilterModuleDeinitProc FilterModuleDeinitProc
#####
typedef .VDXFilterPreviewButtonCallback FilterPreviewButtonCallback
typedef .VDXFilterPreviewSampleCallback FilterPreviewSampleCallback
typedef .IVDXFilterPreview IFilterPreview
#####
typedef .VDXFilterModule FilterModule
typedef .VDXFilterDefinition FilterDefinition
typedef .VDXFilterStateInfo FilterStateInfo
typedef .VDXFBitmap VFBitmap
typedef .VDXFilterActivation FilterActivation
typedef .VDXFilterFunctions FilterFunctions
#endif

8
utilities/gimp/SpatialForegroundRemover-python/include/vd2/OldFilterSDK/ScriptError.h.py

@ -0,0 +1,8 @@
#ifndef f_SYLIA_SCRIPTERROR_H
#define f_SYLIA_SCRIPTERROR_H
#include <vd2/plugin/vdvideofilt.h>
typedef .VDXScriptError CScriptError
#endif

11
utilities/gimp/SpatialForegroundRemover-python/include/vd2/OldFilterSDK/ScriptInterpreter.h.py

@ -0,0 +1,11 @@
#ifndef f_SYLIA_SCRIPTINTERPRETER_H
#define f_SYLIA_SCRIPTINTERPRETER_H
#include <vd2/plugin/vdvideofilt.h>
typedef .VDXScriptValue CScriptValue
typedef .VDXScriptError CScriptError
typedef .VDXScriptObject CScriptObject
typedef .IVDXScriptInterpreter IScriptInterpreter
#endif

17
utilities/gimp/SpatialForegroundRemover-python/include/vd2/OldFilterSDK/ScriptValue.h.py

@ -0,0 +1,17 @@
#ifndef f_SYLIA_SCRIPTVALUE_H
#define f_SYLIA_SCRIPTVALUE_H
#include <vd2/plugin/vdvideofilt.h>
typedef .VDXScriptObject CScriptObject
typedef .VDXScriptValue CScriptValue
typedef .IVDXScriptInterpreter IScriptInterpreter
typedef .VDXScriptFunctionPtr ScriptFunctionPtr
typedef .VDXVoidScriptFunctionPtr ScriptVoidFunctionPtr
typedef .VDXIntScriptFunctionPtr ScriptIntFunctionPtr
typedef .VDXScriptFunctionDef ScriptFunctionDef
typedef .VDXScriptObject CScriptObject
#endif

16
utilities/gimp/SpatialForegroundRemover-python/include/vd2/OldFilterSDK/VBitmap.h.py

@ -0,0 +1,16 @@
#ifndef f_VIRTUALDUB_VBITMAP_H
#define f_VIRTUALDUB_VBITMAP_H
#include <windows.h>
#include <vd2/plugin/vdvideofilt.h>
typedef unsigned Pixel
typedef unsigned Pixel32
typedef unsigned char Pixel8
typedef int PixCoord
typedef int PixDim
typedef ptrdiff_t PixOffset
typedef .VDXBitmap VBitmap
#endif

110
utilities/gimp/SpatialForegroundRemover-python/include/vd2/VDXFrame/Unknown.h.py

@ -0,0 +1,110 @@
# VDXFrame - Helper library for VirtualDub plugins
# Copyright (C) 2008 Avery Lee
#
# The plugin headers in the VirtualDub plugin SDK are licensed differently
# differently than VirtualDub and the Plugin SDK themselves. This
# particular file is thus licensed as follows (the "zlib" license):
#
# This software is provided 'as-is', any express or implied
# warranty. In no event will the authors be held liable for any
# damages arising from the use of self software.
#
# Permission is granted to anyone to use self software for any purpose,
# including commercial applications, to alter it and redistribute it
# freely, to the following restrictions:
#
# 1. The origin of self software must not be misrepresented; you must
# not claim that you wrote the original software. If you use self
# software in a product, acknowledgment in the product
# documentation would be appreciated but is not required.
# 2. Altered source versions must be plainly marked as such, must
# not be misrepresented as being the original software.
# 3. This notice may not be removed or altered from any source
# distribution.
#ifndef f_VD2_VDXFRAME_UNKNOWN_H
#define f_VD2_VDXFRAME_UNKNOWN_H
#include <vd2/plugin/vdplugin.h>
extern "C" long _InterlockedExchangeAdd(volatile long *p, v)
#pragma intrinsic(_InterlockedExchangeAdd)
template<class T> class vdxunknown : public T
public:
vdxunknown() : mRefCount(0) {
vdxunknown( vdxunknown<T>& src) : mRefCount(0) {} # do not copy the refcount
virtual ~vdxunknown() {
vdxunknown<T>& operator=( vdxunknown<T>&) {} # do not copy the refcount
virtual int VDXAPIENTRY AddRef()
return _InterlockedExchangeAdd(&mRefCount, 1) + 1
virtual int VDXAPIENTRY Release()
rc = _InterlockedExchangeAdd(&mRefCount, -1) - 1
if not mRefCount:
mRefCount = 1
delete self
return 0
return rc
virtual void *VDXAPIENTRY AsInterface(uint32 iid)
if iid == T.kIID:
return static_cast<T *>(self)
if iid == IVDXUnknown.kIID:
return static_cast<IVDXUnknown *>(self)
return NULL
protected:
volatile long mRefCount
template<class T1, T2> class vdxunknown2 : public T1, T2
public:
vdxunknown2() : mRefCount(0) {
vdxunknown2( vdxunknown2& src) : mRefCount(0) {} # do not copy the refcount
virtual ~vdxunknown2() {
vdxunknown2& operator=( vdxunknown2&) {} # do not copy the refcount
virtual int VDXAPIENTRY AddRef()
return _InterlockedExchangeAdd(&mRefCount, 1) + 1
virtual int VDXAPIENTRY Release()
rc = _InterlockedExchangeAdd(&mRefCount, -1) - 1
if not mRefCount:
mRefCount = 1
delete self
return 0
return rc
virtual void *VDXAPIENTRY AsInterface(uint32 iid)
if iid == T1.kIID:
return static_cast<T1 *>(self)
if iid == T2.kIID:
return static_cast<T2 *>(self)
if iid == IVDXUnknown.kIID:
return static_cast<IVDXUnknown *>(static_cast<T1 *>(self))
return NULL
protected:
volatile long mRefCount
#endif

220
utilities/gimp/SpatialForegroundRemover-python/include/vd2/VDXFrame/VideoFilter.h.py

@ -0,0 +1,220 @@
# VDXFrame - Helper library for VirtualDub plugins
# Copyright (C) 2008 Avery Lee
#
# The plugin headers in the VirtualDub plugin SDK are licensed differently
# differently than VirtualDub and the Plugin SDK themselves. This
# particular file is thus licensed as follows (the "zlib" license):
#
# This software is provided 'as-is', any express or implied
# warranty. In no event will the authors be held liable for any
# damages arising from the use of self software.
#
# Permission is granted to anyone to use self software for any purpose,
# including commercial applications, to alter it and redistribute it
# freely, to the following restrictions:
#
# 1. The origin of self software must not be misrepresented; you must
# not claim that you wrote the original software. If you use self
# software in a product, acknowledgment in the product
# documentation would be appreciated but is not required.
# 2. Altered source versions must be plainly marked as such, must
# not be misrepresented as being the original software.
# 3. This notice may not be removed or altered from any source
# distribution.
#ifndef f_VD2_VDXFRAME_VIDEOFILTER_H
#define f_VD2_VDXFRAME_VIDEOFILTER_H
#include <stdlib.h>
#include <stddef.h>
#include <new>
#include <vd2/plugin/vdvideofilt.h>
#####################################/
#/ \class VDXVideoFilter
#/
#/ This class handles most of the grimy work of creating the interface
#/ between your filter and VirtualDub.
#/
class VDXVideoFilter
public:
VDXVideoFilter()
virtual ~VDXVideoFilter()
void SetHooks(VDXFilterActivation *fa, *ff)
# linkage routines
virtual bool Init()
virtual uint32 GetParams()=0
virtual void Start()
virtual void Run() = 0
virtual void End()
virtual bool Configure(VDXHWND hwnd)
virtual void GetSettingString(char *buf, maxlen)
virtual void GetScriptString(char *buf, maxlen)
virtual int Serialize(char *buf, maxbuf)
virtual int Deserialize( char *buf, maxbuf)
virtual sint64 Prefetch(sint64 frame)
virtual bool Prefetch2(sint64 frame, *prefetcher)
virtual bool OnEvent(uint32 event, *eventData)
virtual bool OnInvalidateCaches()
static void __cdecl FilterDeinit (VDXFilterActivation *fa, *ff)
static int __cdecl FilterRun ( VDXFilterActivation *fa, *ff)
static long __cdecl FilterParam (VDXFilterActivation *fa, *ff)
static int __cdecl FilterConfig (VDXFilterActivation *fa, *ff, hWnd)
static int __cdecl FilterStart (VDXFilterActivation *fa, *ff)
static int __cdecl FilterEnd (VDXFilterActivation *fa, *ff)
static void __cdecl FilterString ( VDXFilterActivation *fa, *ff, *buf)
static bool __cdecl FilterScriptStr(VDXFilterActivation *fa, *, *, int)
static void __cdecl FilterString2 ( VDXFilterActivation *fa, *ff, *buf, maxlen)
static int __cdecl FilterSerialize (VDXFilterActivation *fa, *ff, *buf, maxbuf)
static void __cdecl FilterDeserialize (VDXFilterActivation *fa, *ff, *buf, maxbuf)
static sint64 __cdecl FilterPrefetch( VDXFilterActivation *fa, *ff, frame)
static bool __cdecl FilterPrefetch2( VDXFilterActivation *fa, *ff, frame, *prefetcher)
static bool __cdecl FilterEvent( VDXFilterActivation *fa, *ff, event, *eventData)
# member variables
VDXFilterActivation *fa
VDXFilterFunctions *ff
static VDXScriptFunctionDef sScriptMethods[]
protected:
void SafePrintf(char *buf, maxbuf, *format, ...)
#####################################/
# Script method support
#
# To declare a Config() script method, add
#
# VDXVF_DECLARE_SCRIPT_METHODS()
#
# to the public portion of your class definition, then add a method
# table at namespace scope:
#
# VDXVF_BEGIN_SCRIPT_METHODS(SpatialForegroundRemoverFilter)
# VDXVF_DEFINE_SCRIPT_METHOD(SpatialForegroundRemoverFilter, ScriptConfig, "iii")
# VDXVF_END_SCRIPT_METHODS()
#
# Use VDXVF_DEFINE_SCRIPT_METHOD() for the first method, then
# VDXVF_DEFINE_SCRIPT_METHOD2() for any overloads.
#define VDXVF_DECLARE_SCRIPT_METHODS() static VDXScriptFunctionDef sScriptMethods[]
#define VDXVF_BEGIN_SCRIPT_METHODS(klass) VDXScriptFunctionDef klass.sScriptMethods[] =#define VDXVF_DEFINE_SCRIPT_METHOD(klass, method, args) { (VDXScriptFunctionPtr)VDXVideoFilterScriptAdapter<klass, &klass.method>.AdaptFn, "Config", "0" args },
#define VDXVF_DEFINE_SCRIPT_METHOD2(klass, method, args) { (VDXScriptFunctionPtr)VDXVideoFilterScriptAdapter<klass, &klass.method>.AdaptFn, NULL, "0" args },
#define VDXVF_END_SCRIPT_METHODS() { NULL }
extern char VDXVideoFilterConfigureOverloadTest(bool (VDXVideoFilter.*)(VDXHWND))
extern double VDXVideoFilterConfigureOverloadTest(...)
extern char VDXVideoFilterPrefetchOverloadTest(sint64 (VDXVideoFilter.*)(sint64))
extern double VDXVideoFilterPrefetchOverloadTest(...)
extern char VDXVideoFilterPrefetch2OverloadTest(bool (VDXVideoFilter.*)(sint64, *))
extern double VDXVideoFilterPrefetch2OverloadTest(...)
template<class T, void (T.*T_Method)(IVDXScriptInterpreter *, *, int)>
class VDXVideoFilterScriptAdapter
public:
static void AdaptFn(IVDXScriptInterpreter *isi, *fa0, *argv, argc)
VDXFilterActivation *fa = (VDXFilterActivation *)fa0
VDXVideoFilter *base = *(VDXVideoFilter **)fa.filter_data
(static_cast<T *>(base).*T_Method)(isi, argv, argc)
template<class T>
class VDXVideoFilterScriptObjectAdapter
public:
static VDXScriptObject sScriptObject
template<class T>
VDXScriptObject VDXVideoFilterScriptObjectAdapter<T>.sScriptObject =
NULL, (T.sScriptMethods == VDXVideoFilter.sScriptMethods) ? NULL : (VDXScriptFunctionDef *)static_cast< VDXScriptFunctionDef *>(T.sScriptMethods), NULL
#####################################/
#/ \class VDXVideoFilterDefinition
#/
#/ This template creates the FilterDefinition structure for you based on
#/ your filter class.
#/
template<class T>
class VDXVideoFilterDefinition : public VDXFilterDefinition
public:
VDXVideoFilterDefinition( char *pszAuthor, *pszName, *pszDescription)
_next = NULL
_prev = NULL
_module = NULL
name = pszName
desc = pszDescription
maker = pszAuthor
private_data = NULL
inst_data_size = sizeof(T) + sizeof(VDXVideoFilter *)
initProc = FilterInit
deinitProc = T.FilterDeinit
runProc = T.FilterRun
paramProc = T.FilterParam
configProc = sizeof(VDXVideoFilterConfigureOverloadTest(&T.Configure)) > 1 ? T.FilterConfig : NULL
stringProc = T.FilterString
startProc = T.FilterStart
endProc = T.FilterEnd
script_obj = T.sScriptMethods ? const_cast<VDXScriptObject *>(&VDXVideoFilterScriptObjectAdapter<T>.sScriptObject) : 0
fssProc = T.FilterScriptStr
stringProc2 = T.FilterString2
serializeProc = T.FilterSerialize
deserializeProc = T.FilterDeserialize
copyProc = FilterCopy
copyProc2 = FilterCopy2
prefetchProc = sizeof(VDXVideoFilterPrefetchOverloadTest(&T.Prefetch)) > 1 ? T.FilterPrefetch : NULL
prefetchProc2 = sizeof(VDXVideoFilterPrefetch2OverloadTest(&T.Prefetch2)) > 1 or sizeof(VDXVideoFilterPrefetchOverloadTest(&T.Prefetch)) > 1 ? T.FilterPrefetch2 : NULL
eventProc = T.FilterEvent
private:
static int __cdecl FilterInit (VDXFilterActivation *fa, *ff)
T *pThis = new((char *)fa.filter_data + sizeof(VDXVideoFilter *)) T
*(VDXVideoFilter **)fa.filter_data = static_cast<VDXVideoFilter *>(pThis)
pThis.SetHooks(fa, ff)
try
if not pThis.Init():
pThis.~T()
return 1
return 0
catch(...)
pThis.~T()
throw
static void __cdecl FilterCopy (VDXFilterActivation *fa, *ff, *dst)
T *p = new((char *)dst + sizeof(VDXVideoFilter *)) T(*static_cast<T *>(*reinterpret_cast<VDXVideoFilter **>(fa.filter_data)))
p.ff = ff
*(VDXVideoFilter **)dst = p
static void __cdecl FilterCopy2 (VDXFilterActivation *fa, *ff, *dst, *fanew, *ffnew)
T *p = new((char *)dst + sizeof(VDXVideoFilter *)) T(*static_cast<T *>(*reinterpret_cast<VDXVideoFilter **>(fa.filter_data)))
p.ff = ffnew
p.fa = fanew
*(VDXVideoFilter **)dst = p
#endif

46
utilities/gimp/SpatialForegroundRemover-python/include/vd2/VDXFrame/VideoFilterDialog.h.py

@ -0,0 +1,46 @@
# VDXFrame - Helper library for VirtualDub plugins
# Copyright (C) 2008 Avery Lee
#
# The plugin headers in the VirtualDub plugin SDK are licensed differently
# differently than VirtualDub and the Plugin SDK themselves. This
# particular file is thus licensed as follows (the "zlib" license):
#
# This software is provided 'as-is', any express or implied
# warranty. In no event will the authors be held liable for any
# damages arising from the use of self software.
#
# Permission is granted to anyone to use self software for any purpose,
# including commercial applications, to alter it and redistribute it
# freely, to the following restrictions:
#
# 1. The origin of self software must not be misrepresented; you must
# not claim that you wrote the original software. If you use self
# software in a product, acknowledgment in the product
# documentation would be appreciated but is not required.
# 2. Altered source versions must be plainly marked as such, must
# not be misrepresented as being the original software.
# 3. This notice may not be removed or altered from any source
# distribution.
#ifndef f_VD2_VDXFRAME_VIDEOFILTERDIALOG_H
#define f_VD2_VDXFRAME_VIDEOFILTERDIALOG_H
#include <windows.h>
class VDXVideoFilterDialog
public:
VDXVideoFilterDialog()
protected:
HWND mhdlg
LRESULT Show(HINSTANCE hInst, templName, parent)
LRESULT Show(HINSTANCE hInst, templName, parent)
HWND ShowModeless(HINSTANCE hInst, templName, parent)
HWND ShowModeless(HINSTANCE hInst, templName, parent)
static INT_PTR CALLBACK StaticDlgProc(HWND hdlg, msg, wParam, lParam)
virtual INT_PTR DlgProc(UINT msg, wParam, lParam)
#endif

83
utilities/gimp/SpatialForegroundRemover-python/include/vd2/VDXFrame/VideoFilterEntry.h.py

@ -0,0 +1,83 @@
# VDXFrame - Helper library for VirtualDub plugins
# Copyright (C) 2008 Avery Lee
#
# The plugin headers in the VirtualDub plugin SDK are licensed differently
# differently than VirtualDub and the Plugin SDK themselves. This
# particular file is thus licensed as follows (the "zlib" license):
#
# This software is provided 'as-is', any express or implied
# warranty. In no event will the authors be held liable for any
# damages arising from the use of self software.
#
# Permission is granted to anyone to use self software for any purpose,
# including commercial applications, to alter it and redistribute it
# freely, to the following restrictions:
#
# 1. The origin of self software must not be misrepresented; you must
# not claim that you wrote the original software. If you use self
# software in a product, acknowledgment in the product
# documentation would be appreciated but is not required.
# 2. Altered source versions must be plainly marked as such, must
# not be misrepresented as being the original software.
# 3. This notice may not be removed or altered from any source
# distribution.
#ifndef f_VD2_VDXFRAME_VIDEOFILTERENTRY_H
#define f_VD2_VDXFRAME_VIDEOFILTERENTRY_H
#include <vd2/plugin/vdvideofilt.h>
#ifdef _MSC_VER
#pragma once
#endif
struct VDXFilterModule
struct VDXFilterFunctions
struct VDXFilterDefinition
#######################################/
#/ Video filter module entry point declaration macros
#/
#/ To declare the module init and deinit functions:
#/
#/ VDX_DECLARE_VFMODULE()
#/
#/ By default self declares the module as requiring copy contructor support
#/ (V9 / VirtualDub 1.4.12). If you need to declare a different minimum
#/ version, use:
#/
#/ VDX_DECLARE_VFMODULE_APIVER(version)
#/
#define VDX_DECLARE_VFMODULE() VDX_DECLARE_VFMODULE_APIVER(VIRTUALDUB_FILTERDEF_COMPATIBLE_COPYCTOR)
#define VDX_DECLARE_VFMODULE_APIVER(apiver) \
extern "C" __declspec(dllexport) int __cdecl VirtualdubFilterModuleInit2(struct VDXFilterModule *fm, *ff, vdfd_ver, vdfd_compat) { \
return VDXVideoFilterModuleInit2(fm, ff, vdfd_ver, vdfd_compat, (apiver)); \
} \
\
extern "C" __declspec(dllexport) void __cdecl VirtualdubFilterModuleDeinit(struct VDXFilterModule *fm, *ff) { \
VDXVideoFilterModuleDeinit(fm, ff); \
#######################################/
#/ Video filter declaration macros
#/
#/ To declare video filters, the following pattern:
#/
#/ VDX_DECLARE_VIDEOFILTERS_BEGIN()
#/ VDX_DECLARE_VIDEOFILTER(definitionSymbolName)
#/ VDX_DECLARE_VIDEOFILTERS_END()
#/
#/ Each entry points to a variable of type VDXFilterDefinition. Note that these must
#/ be declared as _non-const_ for compatibility with older versions of VirtualDub.
#/ Video filters declared self way are automatically registered by the module init
#/ routine.
#/
#define VDX_DECLARE_VIDEOFILTERS_BEGIN() VDXFilterDefinition *VDXGetVideoFilterDefinition(int index)#define VDX_DECLARE_VIDEOFILTER(defVarName) if (not index--) { extern VDXFilterDefinition defVarName; return &defVarName;
#define VDX_DECLARE_VIDEOFILTERS_END() return NULL; \
def VDXVideoFilterModuleInit2(self, VDXFilterModule *fm, *ff, vdfd_ver, vdfd_compat, ver_compat_target):
def VDXVideoFilterModuleDeinit(self, VDXFilterModule *fm, *ff):
def VDXGetVideoFilterAPIVersion(self):
#endif

148
utilities/gimp/SpatialForegroundRemover-python/include/vd2/plugin/vdaudiofilt.h.py

@ -0,0 +1,148 @@
#ifndef f_VD2_PLUGIN_VDAUDIOFILT_H
#define f_VD2_PLUGIN_VDAUDIOFILT_H
#####################################/
#
# Audio filter support
struct VDAudioFilterDefinition
struct VDXWaveFormat
struct VDPluginCallbacks
enum
kVDPlugin_AudioAPIVersion = 2
struct VDAudioFilterPin
unsigned mGranularity; # Block size a filter reads/writes self pin.
unsigned mDelay; # Delay in samples on self input.
unsigned mBufferSize; # The size, samples, the buffer.
unsigned mCurrentLevel; # The number of samples currently in the buffer.
sint64 mLength; # Approximate length of self stream in us.
VDXWaveFormat *mpFormat
bool mbVBR
bool mbEnded
char _pad[2]
void *mpBuffer
unsigned mSamplesWritten; # The number of samples just written to the buffer.
unsigned mAvailSpace; # Available room pointed to by mpBuffer (output pins only).
uint32 (VDAPIENTRY *mpReadProc)(VDAudioFilterPin *pPin, *dst, samples, bAllowFill, format)
# These helpers are non-virtual inlines and are compiled into filters.
uint32 Read(void *dst, samples, bAllowFill, format)
return mpReadProc(self, dst, samples, bAllowFill, format)
struct VDAudioFilterContext
struct VDAudioFilterCallbacks
VDXWaveFormat *(VDAPIENTRY *AllocPCMWaveFormat)(unsigned sampling_rate, channels, bits, bFloat)
VDXWaveFormat *(VDAPIENTRY *AllocCustomWaveFormat)(unsigned extra_size)
VDXWaveFormat *(VDAPIENTRY *CopyWaveFormat)( VDXWaveFormat *)
void (VDAPIENTRY *FreeWaveFormat)( VDXWaveFormat *)
void (VDAPIENTRY *Wake)( VDAudioFilterContext *pContext)
struct VDAudioFilterContext
void *mpFilterData
VDAudioFilterPin **mpInputs
VDAudioFilterPin **mpOutputs
IVDPluginCallbacks *mpServices
VDAudioFilterCallbacks *mpAudioCallbacks
VDAudioFilterDefinition *mpDefinition
uint32 mAPIVersion
uint32 mInputSamples; # Number of input samples available on all pins.
uint32 mInputGranules; # Number of input granules available on all pins.
uint32 mInputsEnded; # Number of inputs that have ended.
uint32 mOutputSamples; # Number of output sample spaces available on all pins.
uint32 mOutputGranules; # Number of output granule spaces available on all pins.
uint32 mCommonSamples; # Number of input samples and output sample spaces.
uint32 mCommonGranules; # Number of input and output granules.
# This structure is intentionally identical to WAVEFORMATEX, one
# exception -- mExtraSize is *always* present, for PCM.
struct VDXWaveFormat
enum { kTagPCM = 1
uint16 mTag
uint16 mChannels
uint32 mSamplingRate
uint32 mDataRate
uint16 mBlockSize
uint16 mSampleBits
uint16 mExtraSize
enum
kVFARun_OK = 0,
kVFARun_Finished = 1,
kVFARun_InternalWork = 2,
kVFAPrepare_OK = 0,
kVFAPrepare_BadFormat = 1
enum
kVFARead_Native = 0,
kVFARead_PCM8 = 1,
kVFARead_PCM16 = 2,
kVFARead_PCM32F = 3
typedef void * (VDAPIENTRY *VDAudioFilterExtProc )( VDAudioFilterContext *pContext, *pInterfaceName)
typedef uint32 (VDAPIENTRY *VDAudioFilterRunProc )( VDAudioFilterContext *pContext)
typedef sint64 (VDAPIENTRY *VDAudioFilterSeekProc )( VDAudioFilterContext *pContext, microsecs)
typedef uint32 (VDAPIENTRY *VDAudioFilterPrepareProc )( VDAudioFilterContext *pContext)
typedef void (VDAPIENTRY *VDAudioFilterStartProc )( VDAudioFilterContext *pContext)
typedef void (VDAPIENTRY *VDAudioFilterStopProc )( VDAudioFilterContext *pContext)
typedef void (VDAPIENTRY *VDAudioFilterInitProc )( VDAudioFilterContext *pContext)
typedef void (VDAPIENTRY *VDAudioFilterDestroyProc )( VDAudioFilterContext *pContext)
typedef unsigned (VDAPIENTRY *VDAudioFilterSuspendProc )( VDAudioFilterContext *pContext, *dst, size)
typedef void (VDAPIENTRY *VDAudioFilterResumeProc )( VDAudioFilterContext *pContext, *src, size)
typedef unsigned (VDAPIENTRY *VDAudioFilterGetParamProc )( VDAudioFilterContext *pContext, idx, *dst, size)
typedef void (VDAPIENTRY *VDAudioFilterSetParamProc )( VDAudioFilterContext *pContext, idx, *src, variant_count)
typedef bool (VDAPIENTRY *VDAudioFilterConfigProc )( VDAudioFilterContext *pContext, HWND__ *hwnd)
enum
kVFAF_Zero = 0,
kVFAF_HasConfig = 1, # Filter has a configuration dialog.
kVFAF_SerializedIO = 2, # Filter must execute in the serialized I/O thread.
kVFAF_Max = 0xFFFFFFFF,
struct VDAudioFilterVtbl
uint32 mSize
VDAudioFilterDestroyProc mpDestroy
VDAudioFilterPrepareProc mpPrepare
VDAudioFilterStartProc mpStart
VDAudioFilterStopProc mpStop
VDAudioFilterRunProc mpRun
VDAudioFilterSeekProc mpSeek
VDAudioFilterSuspendProc mpSuspend
VDAudioFilterResumeProc mpResume
VDAudioFilterGetParamProc mpGetParam
VDAudioFilterSetParamProc mpSetParam
VDAudioFilterConfigProc mpConfig
VDAudioFilterExtProc mpExt
struct VDAudioFilterDefinition
uint32 mSize; # size of self structure in bytes
uint32 mFlags
uint32 mFilterDataSize
uint32 mInputPins
uint32 mOutputPins
VDXPluginConfigEntry *mpConfigInfo
VDAudioFilterInitProc mpInit
VDAudioFilterVtbl *mpVtbl
#endif

284
utilities/gimp/SpatialForegroundRemover-python/include/vd2/plugin/vdinputdriver.h.py

@ -0,0 +1,284 @@
# VirtualDub - Video processing and capture application
# Plugin headers
# Copyright (C) 1998-2007 Avery Lee, Rights Reserved.
#
# The plugin headers in the VirtualDub plugin SDK are licensed differently
# differently than VirtualDub and the Plugin SDK themselves. This
# particular file is thus licensed as follows (the "zlib" license):
#
# This software is provided 'as-is', any express or implied
# warranty. In no event will the authors be held liable for any
# damages arising from the use of self software.
#
# Permission is granted to anyone to use self software for any purpose,
# including commercial applications, to alter it and redistribute it
# freely, to the following restrictions:
#
# 1. The origin of self software must not be misrepresented; you must
# not claim that you wrote the original software. If you use self
# software in a product, acknowledgment in the product
# documentation would be appreciated but is not required.
# 2. Altered source versions must be plainly marked as such, must
# not be misrepresented as being the original software.
# 3. This notice may not be removed or altered from any source
# distribution.
#ifndef f_VD2_PLUGIN_VDINPUTDRIVER_H
#define f_VD2_PLUGIN_VDINPUTDRIVER_H
#ifdef _MSC_VER
#pragma once
#pragma pack(push, 8)
#endif
#include "vdplugin.h"
#/ Unsigned 32-bit fraction.
struct VDXFraction
uint32 mNumerator
uint32 mDenominator
typedef struct VDXHWNDStruct *VDXHWND
typedef struct VDXBITMAPINFOHEADERStruct
enum { kCompressionRGB = 0
uint32 mSize
sint32 mWidth
sint32 mHeight
uint16 mPlanes
uint16 mBitCount
uint32 mCompression
uint32 mSizeImage
sint32 mXPelsPerMeter
sint32 mYPelsPerMeter
uint32 mClrUsed
uint32 mClrImportant
} VDXBITMAPINFOHEADER
typedef struct VDXWAVEFORMATEXStruct
enum { kFormatPCM = 1
uint16 mFormatTag
uint16 mChannels
uint32 mSamplesPerSec
uint32 mAvgBytesPerSec
uint16 mBlockAlign
uint16 mBitsPerSample
uint16 mExtraSize
} VDXWAVEFORMATEX
struct VDXStreamSourceInfo
VDXFraction mSampleRate
sint64 mSampleCount
VDXFraction mPixelAspectRatio
# V3+ (1.7.X) only
struct VDXStreamSourceInfoV3
VDXStreamSourceInfo mInfo
enum
kFlagVariableSizeSamples = 0x00000001
uint32 mFlags
uint32 mfccHandler; #/< If non-zero, the FOURCC of a codec handler that should be preferred.
class IVDXStreamSource : public IVDXUnknown
public:
enum { kIID = VDXMAKEFOURCC('X', 's', 't', 's')
virtual void VDXAPIENTRY GetStreamSourceInfo(VDXStreamSourceInfo&) = 0
virtual bool VDXAPIENTRY Read(sint64 lStart, lCount, *lpBuffer, cbBuffer, *lBytesRead, *lSamplesRead) = 0
virtual void * VDXAPIENTRY GetDirectFormat() = 0
virtual int VDXAPIENTRY GetDirectFormatLen() = 0
enum ErrorMode
kErrorModeReportAll = 0,
kErrorModeConceal,
kErrorModeDecodeAnyway,
kErrorModeCount
virtual ErrorMode VDXAPIENTRY GetDecodeErrorMode() = 0
virtual void VDXAPIENTRY SetDecodeErrorMode(ErrorMode mode) = 0
virtual bool VDXAPIENTRY IsDecodeErrorModeSupported(ErrorMode mode) = 0
virtual bool VDXAPIENTRY IsVBR() = 0
virtual sint64 VDXAPIENTRY TimeToPositionVBR(sint64 us) = 0
virtual sint64 VDXAPIENTRY PositionToTimeVBR(sint64 samples) = 0
# V3+ (1.7.X)
class IVDXStreamSourceV3 : public IVDXUnknown
public:
enum { kIID = VDXMAKEFOURCC('X', 's', 't', '2')
virtual void VDXAPIENTRY GetStreamSourceInfoV3(VDXStreamSourceInfoV3&) = 0
class IVDXVideoDecoderModel : public IVDXUnknown
public:
enum { kIID = VDXMAKEFOURCC('X', 'v', 'd', 'm')
virtual void VDXAPIENTRY Reset() = 0
virtual void VDXAPIENTRY SetDesiredFrame(sint64 frame_num) = 0
virtual sint64 VDXAPIENTRY GetNextRequiredSample(bool& is_preroll) = 0
virtual int VDXAPIENTRY GetRequiredCount() = 0
class IVDXVideoDecoder : public IVDXUnknown
public:
enum { kIID = VDXMAKEFOURCC('X', 'v', 'd', 'e')
virtual void * VDXAPIENTRY DecodeFrame( void *inputBuffer, data_len, is_preroll, sampleNumber, targetFrame) = 0
virtual uint32 VDXAPIENTRY GetDecodePadding() = 0
virtual void VDXAPIENTRY Reset() = 0
virtual bool VDXAPIENTRY IsFrameBufferValid() = 0
virtual VDXPixmap& VDXAPIENTRY GetFrameBuffer() = 0
virtual bool VDXAPIENTRY SetTargetFormat(int format, useDIBAlignment) = 0
virtual bool VDXAPIENTRY SetDecompressedFormat( VDXBITMAPINFOHEADER *pbih) = 0
virtual bool VDXAPIENTRY IsDecodable(sint64 sample_num) = 0
virtual void * VDXAPIENTRY GetFrameBufferBase() = 0
enum VDXVideoFrameType
kVDXVFT_Independent,
kVDXVFT_Predicted,
kVDXVFT_Bidirectional,
kVDXVFT_Null,
struct VDXVideoFrameInfo
char mTypeChar
uint8 mFrameType
sint64 mBytePosition
struct VDXVideoSourceInfo
enum DecoderModel
kDecoderModelCustom, #/< A custom decoder model is provided.
kDecoderModelDefaultIP #/< Use the default I/P decoder model.
enum Flags
kFlagNone = 0,
kFlagKeyframeOnly = 0x00000001,
kFlagAll = 0xFFFFFFFF
public:
uint32 mFlags
uint32 mWidth
uint32 mHeight
uint8 mDecoderModel
uint8 unused[3]
class IVDXVideoSource : public IVDXUnknown
public:
enum { kIID = VDXMAKEFOURCC('X', 'v', 'd', 's')
virtual void VDXAPIENTRY GetVideoSourceInfo(VDXVideoSourceInfo& info) = 0
virtual bool VDXAPIENTRY CreateVideoDecoderModel(IVDXVideoDecoderModel **) = 0
virtual bool VDXAPIENTRY CreateVideoDecoder(IVDXVideoDecoder **) = 0
virtual void VDXAPIENTRY GetSampleInfo(sint64 sample_num, frameInfo) = 0
virtual bool VDXAPIENTRY IsKey(sint64 sample_num) = 0
virtual sint64 VDXAPIENTRY GetFrameNumberForSample(sint64 sample_num) = 0
virtual sint64 VDXAPIENTRY GetSampleNumberForFrame(sint64 frame_num) = 0
virtual sint64 VDXAPIENTRY GetRealFrame(sint64 frame_num) = 0
virtual sint64 VDXAPIENTRY GetSampleBytePosition(sint64 sample_num) = 0
struct VDXAudioSourceInfo
public:
uint32 mFlags
class IVDXAudioSource : public IVDXUnknown
public:
enum { kIID = VDXMAKEFOURCC('X', 'a', 'd', 's')
virtual void VDXAPIENTRY GetAudioSourceInfo(VDXAudioSourceInfo& info) = 0
class IVDXInputOptions : public IVDXUnknown
public:
enum { kIID = VDXMAKEFOURCC('X', 'i', 'o', 'p')
virtual uint32 VDXAPIENTRY Write(void *buf, buflen) = 0
class IVDXInputFile : public IVDXUnknown
public:
enum { kIID = VDXMAKEFOURCC('X', 'i', 'f', 'l')
virtual bool VDXAPIENTRY PromptForOptions(VDXHWND, **ppOptions) = 0
virtual bool VDXAPIENTRY CreateOptions( void *buf, len, **ppOptions) = 0
virtual void VDXAPIENTRY Init( wchar_t *path, *options) = 0
virtual bool VDXAPIENTRY Append( wchar_t *path) = 0
virtual void VDXAPIENTRY DisplayInfo(VDXHWND hwndParent) = 0
virtual bool VDXAPIENTRY GetVideoSource(int index, **ppVS) = 0
virtual bool VDXAPIENTRY GetAudioSource(int index, **ppAS) = 0
#######################################/
# IVDXInputFileDriver
#
class IVDXInputFileDriver : public IVDXUnknown
public:
enum { kIID = VDXMAKEFOURCC('X', 'i', 'f', 'd')
virtual int VDXAPIENTRY DetectBySignature( void *pHeader, nHeaderSize, *pFooter, nFooterSize, nFileSize) = 0
virtual bool VDXAPIENTRY CreateInputFile(uint32 flags, **ppFile) = 0
struct VDXInputDriverContext
uint32 mAPIVersion
IVDPluginCallbacks *mpCallbacks
typedef bool (VDXAPIENTRY *VDXInputDriverCreateProc)( VDXInputDriverContext *pContext, **)
struct VDXInputDriverDefinition
enum
kFlagNone = 0x00000000,
kFlagSupportsVideo = 0x00000001,
kFlagSupportsAudio = 0x00000002,
kFlagCustomSignature = 0x00010000,
kFlagAll = 0xFFFFFFFF
uint32 mSize; # size of self structure in bytes
uint32 mFlags
sint32 mPriority
uint32 mSignatureLength
void *mpSignature
wchar_t *mpFilenameDetectPattern
wchar_t *mpFilenamePattern
wchar_t *mpDriverTagName
VDXInputDriverCreateProc mpCreate
enum
# V1 (1.7.4.28204): Initial version
# V2 (1.7.5): Default I/P frame model fixed.
kVDXPlugin_InputDriverAPIVersion = 2
#ifdef _MSC_VER
#pragma pack(pop)
#endif
#endif

206
utilities/gimp/SpatialForegroundRemover-python/include/vd2/plugin/vdplugin.h.py

@ -0,0 +1,206 @@
# VirtualDub - Video processing and capture application
# Plugin headers
# Copyright (C) 1998-2007 Avery Lee, Rights Reserved.
#
# The plugin headers in the VirtualDub plugin SDK are licensed differently
# differently than VirtualDub and the Plugin SDK themselves. This
# particular file is thus licensed as follows (the "zlib" license):
#
# This software is provided 'as-is', any express or implied
# warranty. In no event will the authors be held liable for any
# damages arising from the use of self software.
#
# Permission is granted to anyone to use self software for any purpose,
# including commercial applications, to alter it and redistribute it
# freely, to the following restrictions:
#
# 1. The origin of self software must not be misrepresented; you must
# not claim that you wrote the original software. If you use self
# software in a product, acknowledgment in the product
# documentation would be appreciated but is not required.
# 2. Altered source versions must be plainly marked as such, must
# not be misrepresented as being the original software.
# 3. This notice may not be removed or altered from any source
# distribution.
#ifndef f_VD2_PLUGIN_VDPLUGIN_H
#define f_VD2_PLUGIN_VDPLUGIN_H
#ifdef _MSC_VER
#pragma once
#pragma pack(push, 8)
#endif
#include <stddef.h>
# Copied from <vd2/system/vdtypes.h>. Must be in sync.
#ifndef VD_STANDARD_TYPES_DECLARED
#if defined(_MSC_VER)
typedef signed __int64 sint64
typedef unsigned __int64 uint64
#elif defined(__GNUC__)
typedef signed long long sint64
typedef unsigned long long uint64
#endif
typedef signed int sint32
typedef unsigned int uint32
typedef signed short sint16
typedef unsigned short uint16
typedef signed char sint8
typedef unsigned char uint8
typedef sint64 int64
typedef sint32 int32
typedef sint16 int16
typedef sint8 int8
typedef ptrdiff_t sintptr
typedef size_t uintptr
#endif
#ifndef VDXAPIENTRY
#define VDXAPIENTRY __stdcall
#endif
#ifndef VDXAPIENTRYV
#define VDXAPIENTRYV __cdecl
#endif
enum VDXCPUFeatureFlags
kVDXCPUF_CPUID = 0x00000001,
kVDXCPUF_MMX = 0x00000004,
kVDXCPUF_ISSE = 0x00000008,
kVDXCPUF_SSE = 0x00000010,
kVDXCPUF_SSE2 = 0x00000020,
kVDXCPUF_3DNOW = 0x00000040,
kVDXCPUF_3DNOW_EXT = 0x00000080,
kVDXCPUF_SSE3 = 0x00000100,
kVDXCPUF_SSSE3 = 0x00000200
enum
kVDXPlugin_APIVersion = 10
enum
kVDXPluginType_Video, # Updated video filter API is not yet complete.
kVDXPluginType_Audio,
kVDXPluginType_Input
struct VDXPluginInfo
uint32 mSize; # size of self structure in bytes
wchar_t *mpName
wchar_t *mpAuthor
wchar_t *mpDescription
uint32 mVersion; # (major<<24) + (minor<<16) + build. 1.4.1000 would be 0x010403E8.
uint32 mType
uint32 mFlags
uint32 mAPIVersionRequired
uint32 mAPIVersionUsed
uint32 mTypeAPIVersionRequired
uint32 mTypeAPIVersionUsed
void * mpTypeSpecificInfo
typedef VDXPluginInfo * *(VDXAPIENTRY *tpVDXGetPluginInfo)()
typedef VDXPluginInfo VDPluginInfo
typedef tpVDXGetPluginInfo tpVDPluginInfo
class IVDXPluginCallbacks
public:
virtual void * VDXAPIENTRY GetExtendedAPI( char *pExtendedAPIName) = 0
virtual void VDXAPIENTRYV SetError( char *format, ...) = 0
virtual void VDXAPIENTRY SetErrorOutOfMemory() = 0
virtual uint32 VDXAPIENTRY GetCPUFeatureFlags() = 0
typedef IVDXPluginCallbacks IVDPluginCallbacks
struct VDXPluginConfigEntry
enum Type
kTypeInvalid = 0,
kTypeU32 = 1,
kTypeS32,
kTypeU64,
kTypeS64,
kTypeDouble,
kTypeAStr,
kTypeWStr,
kTypeBlock
VDXPluginConfigEntry *next
unsigned idx
uint32 type
wchar_t *name
wchar_t *label
wchar_t *desc
struct VDXPixmap
void *data
uint32 *palette
sint32 w
sint32 h
ptrdiff_t pitch
sint32 format
# Auxiliary planes are always byte-per-pixel.
void *data2; # Cb (U) for YCbCr
ptrdiff_t pitch2
void *data3; # Cr (V) for YCbCr
ptrdiff_t pitch3
struct VDXPixmapLayout
ptrdiff_t data
uint32 *palette
sint32 w
sint32 h
ptrdiff_t pitch
sint32 format
# Auxiliary planes are always byte-per-pixel.
ptrdiff_t data2; # Cb (U) for YCbCr
ptrdiff_t pitch2
ptrdiff_t data3; # Cr (V) for YCbCr
ptrdiff_t pitch3
namespace nsVDXPixmap
enum VDXPixmapFormat
kPixFormat_Null = 0,
kPixFormat_XRGB1555 = 5,
kPixFormat_RGB565 = 6,
kPixFormat_RGB888 = 7,
kPixFormat_XRGB8888 = 8,
kPixFormat_Y8 = 9,
kPixFormat_YUV422_UYVY = 10,
kPixFormat_YUV422_YUYV = 11,
kPixFormat_YUV444_Planar = 13,
kPixFormat_YUV422_Planar = 14,
kPixFormat_YUV420_Planar = 15,
kPixFormat_YUV411_Planar = 16,
kPixFormat_YUV410_Planar = 17
#define VDXMAKEFOURCC(a, b, c, d) ((uint32)(uint8)(d) + ((uint32)(uint8)(c) << 8) + ((uint32)(uint8)(b) << 16) + ((uint32)(uint8)(a) << 24))
class IVDXUnknown
public:
enum { kIID = VDXMAKEFOURCC('X', 'u', 'n', 'k')
virtual int VDXAPIENTRY AddRef() = 0
virtual int VDXAPIENTRY Release() = 0
virtual void *VDXAPIENTRY AsInterface(uint32 iid) = 0
#ifdef _MSC_VER
#pragma pack(pop)
#endif
#endif

549
utilities/gimp/SpatialForegroundRemover-python/include/vd2/plugin/vdvideofilt.h.py

@ -0,0 +1,549 @@
# VirtualDub - Video processing and capture application
# Plugin headers
# Copyright (C) 1998-2007 Avery Lee, Rights Reserved.
#
# The plugin headers in the VirtualDub plugin SDK are licensed differently
# differently than VirtualDub and the Plugin SDK themselves. This
# particular file is thus licensed as follows (the "zlib" license):
#
# This software is provided 'as-is', any express or implied
# warranty. In no event will the authors be held liable for any
# damages arising from the use of self software.
#
# Permission is granted to anyone to use self software for any purpose,
# including commercial applications, to alter it and redistribute it
# freely, to the following restrictions:
#
# 1. The origin of self software must not be misrepresented; you must
# not claim that you wrote the original software. If you use self
# software in a product, acknowledgment in the product
# documentation would be appreciated but is not required.
# 2. Altered source versions must be plainly marked as such, must
# not be misrepresented as being the original software.
# 3. This notice may not be removed or altered from any source
# distribution.
#ifndef f_VD2_PLUGIN_VDVIDEOFILT_H
#define f_VD2_PLUGIN_VDVIDEOFILT_H
#ifdef _MSC_VER
#pragma once
#pragma pack(push, 8)
#endif
#include <stddef.h>
#include "vdplugin.h"
typedef struct VDXHINSTANCEStruct *VDXHINSTANCE
typedef struct VDXHDCStruct *VDXHDC
typedef struct VDXHWNDStruct *VDXHWND
#########
struct VDXScriptObject
struct VDXFilterVTbls
#########
enum
#/ Request distinct source and destination buffers. Otherwise, source and destination buffers
#/ alias (in-place mode).
FILTERPARAM_SWAP_BUFFERS = 0x00000001L,
#/ Request an extra buffer for the previous source frame.
FILTERPARAM_NEEDS_LAST = 0x00000002L,
#/ Filter supports image formats other than RGB32. Filters that support format negotiation must
#/ set self flag for all calls to paramProc.
FILTERPARAM_SUPPORTS_ALTFORMATS = 0x00000004L,
#/ Filter requests 16 byte alignment for source and destination buffers. This guarantees that:
#/
#/ - data and pitch fields are multiples of 16 bytes (aligned)
#/ - an integral number of 16 byte vectors may be read, if the last vector includes
#/ some bytes beyond the end of the scanline (their values are undefined)
#/ - an integral number of 16 byte vectors may be written, if the last vector includes
#/ some bytes beyong the end of the scanline (their values are ignored)
#/
FILTERPARAM_ALIGN_SCANLINES = 0x00000008L,
#/ Filter's output is purely a function of configuration parameters and source image data, not
#/ source or output frame numbers. In other words, output frames produced by a filter instance
#/ can be assumed to be identical images if:
#/
#/ - the same number of source frames are prefetched
#/ - the same type of prefetches are performed (direct vs. non-direct)
#/ - the frame numbers for the two prefetch lists, in order, to identical
#/ source frames
#/ - the prefetch cookies match
#/
#/ Enabling self flag improves the ability of the host to identify identical frames and drop them
#/ in preview or in the output file.
#/
FILTERPARAM_PURE_TRANSFORM = 0x00000010L,
#/ Filter cannot support the requested source format. Note that self sets all bits, the meaning
#/ of other bits is ignored. The one exception is that FILTERPARAM_SUPPORTS_ALTFORMATS is assumed
#/ to be implicitly set.
FILTERPARAM_NOT_SUPPORTED = (long)0xFFFFFFFF
#/ The filter has a delay from source to output. For instance, lag of 3 indicates that the
#/ filter internally buffers three frames, when it is fed frames in sequence, 0 emerges
#/ after frame 3 has been processed. The host attempts to correct timestamps in order to compensate.
#/
#/ VirtualDub 1.9.1 or later: Setting self flag can have a performance penalty, it causes the host
#/ to request additional frames to try to produce the correct requested output frames.
#/
#define FILTERPARAM_HAS_LAG(frames) ((int)(frames) << 16)
#########/
class VDXFBitmap
class VDXFilterActivation
struct VDXFilterFunctions
struct VDXFilterModule
class IVDXVideoPrefetcher
enum
kVDXVFEvent_None = 0,
kVDXVFEvent_InvalidateCaches = 1
typedef int (__cdecl *VDXFilterInitProc )(VDXFilterActivation *fa, *ff)
typedef void (__cdecl *VDXFilterDeinitProc )(VDXFilterActivation *fa, *ff)
typedef int (__cdecl *VDXFilterRunProc )( VDXFilterActivation *fa, *ff)
typedef long (__cdecl *VDXFilterParamProc )(VDXFilterActivation *fa, *ff)
typedef int (__cdecl *VDXFilterConfigProc )(VDXFilterActivation *fa, *ff, hWnd)
typedef void (__cdecl *VDXFilterStringProc )( VDXFilterActivation *fa, *ff, *buf)
typedef int (__cdecl *VDXFilterStartProc )(VDXFilterActivation *fa, *ff)
typedef int (__cdecl *VDXFilterEndProc )(VDXFilterActivation *fa, *ff)
typedef bool (__cdecl *VDXFilterScriptStrProc)(VDXFilterActivation *fa, *, *, int)
typedef void (__cdecl *VDXFilterStringProc2 )( VDXFilterActivation *fa, *ff, *buf, maxlen)
typedef int (__cdecl *VDXFilterSerialize )(VDXFilterActivation *fa, *ff, *buf, maxbuf)
typedef void (__cdecl *VDXFilterDeserialize )(VDXFilterActivation *fa, *ff, *buf, maxbuf)
typedef void (__cdecl *VDXFilterCopy )(VDXFilterActivation *fa, *ff, *dst)
typedef sint64 (__cdecl *VDXFilterPrefetch )( VDXFilterActivation *fa, *ff, frame)
typedef void (__cdecl *VDXFilterCopy2Proc )(VDXFilterActivation *fa, *ff, *dst, *fa2, *ff2)
typedef bool (__cdecl *VDXFilterPrefetch2Proc)( VDXFilterActivation *fa, *ff, frame, *prefetcher)
typedef bool (__cdecl *VDXFilterEventProc )( VDXFilterActivation *fa, *ff, event, *eventData)
typedef int (__cdecl *VDXFilterModuleInitProc)(VDXFilterModule *fm, *ff, vdfd_ver, vdfd_compat)
typedef void (__cdecl *VDXFilterModuleDeinitProc)(VDXFilterModule *fm, *ff)
#####
typedef void (__cdecl *VDXFilterPreviewButtonCallback)(bool fNewState, *pData)
typedef void (__cdecl *VDXFilterPreviewSampleCallback)(VDXFBitmap *, lFrame, lCount, *pData)
class IVDXFilterPreview
public:
virtual void SetButtonCallback(VDXFilterPreviewButtonCallback, *)=0
virtual void SetSampleCallback(VDXFilterPreviewSampleCallback, *)=0
virtual bool isPreviewEnabled()=0
virtual void Toggle(VDXHWND)=0
virtual void Display(VDXHWND, bool)=0
virtual void RedoFrame()=0
virtual void RedoSystem()=0
virtual void UndoSystem()=0
virtual void InitButton(VDXHWND)=0
virtual void Close()=0
virtual bool SampleCurrentFrame()=0
virtual long SampleFrames()=0
class IVDXFilterPreview2 : public IVDXFilterPreview
public:
virtual bool IsPreviewDisplayed() = 0
class IVDXVideoPrefetcher : public IVDXUnknown
public:
enum { kIID = VDXMAKEFOURCC('X', 'v', 'p', 'f')
#/ Request a video frame fetch from an upstream source.
virtual void VDXAPIENTRY PrefetchFrame(sint32 srcIndex, frame, cookie) = 0
#/ Request a video frame fetch from an upstream source in direct mode.
#/ This specifies that the output frame is the same as the input frame.
#/ There cannot be more than one direct fetch and there must be no standard
#/ fetches at the same time. There can, however, symbolic fetches.
virtual void VDXAPIENTRY PrefetchFrameDirect(sint32 srcIndex, frame) = 0
#/ Request a symbolic fetch from a source. This does not actually fetch
#/ any frames, marks an association from source to output. This is
#/ useful for indicating the approximate center of where an output derives
#/ in a source, if those frames aren't fetched (perhaps due to caching).
#/ There may be either zero or one symbolic fetch per source.
#/
#/ If no symbolic fetches are performed, symbolic frame is assumed to
#/ be the rounded mean of the fetched source frames.
virtual void VDXAPIENTRY PrefetchFrameSymbolic(sint32 srcIndex, frame) = 0
#####
enum
# This is the highest API version supported by self header file.
VIRTUALDUB_FILTERDEF_VERSION = 14,
# This is the absolute lowest API version supported by self header file.
# Note that V4 is rather old, to VirtualDub 1.2.
# Chances are you will need to declare a higher version.
VIRTUALDUB_FILTERDEF_COMPATIBLE = 4,
# API V9 is a slightly saner baseline, it is the first API
# version that has copy constructor support. You may still need to
# declare a higher vdfd_compat version in your module init if you
# need features beyond V9 (VirtualDub 1.4.12).
VIRTUALDUB_FILTERDEF_COMPATIBLE_COPYCTOR = 9
# v3: added lCurrentSourceFrame to FrameStateInfo
# v4 (1.2): lots of additions (VirtualDub 1.2)
# v5 (1.3d): lots of bugfixes - stretchblt bilinear, non-zero startproc
# v6 (1.4): added error handling functions
# v7 (1.4d): added frame lag, handling
# v8 (1.4.11): added string2 proc
# v9 (1.4.12): added (working) copy constructor
# v10 (1.5.10): added preview flag
# v11 (1.7.0): guaranteed src structure setup before configProc; added IVDFilterPreview2
# v12 (1.8.0): support for frame alteration
# v13 (1.8.2): added mOutputFrame field to VDXFilterStateInfo
# v14 (1.9.1): added copyProc2, prefetchProc2, input/output frame arrays
struct VDXFilterDefinition
void *_next; # deprecated - set to NULL
void *_prev; # deprecated - set to NULL
void *_module; # deprecated - set to NULL
char * name
char * desc
char * maker
void * private_data
int inst_data_size
VDXFilterInitProc initProc
VDXFilterDeinitProc deinitProc
VDXFilterRunProc runProc
VDXFilterParamProc paramProc
VDXFilterConfigProc configProc
VDXFilterStringProc stringProc
VDXFilterStartProc startProc
VDXFilterEndProc endProc
VDXScriptObject *script_obj
VDXFilterScriptStrProc fssProc
# NEW - 1.4.11
VDXFilterStringProc2 stringProc2
VDXFilterSerialize serializeProc
VDXFilterDeserialize deserializeProc
VDXFilterCopy copyProc
VDXFilterPrefetch prefetchProc; # (V12/V1.7.4+)
# NEW - V14 / 1.9.1
VDXFilterCopy2Proc copyProc2
VDXFilterPrefetch2Proc prefetchProc2
VDXFilterEventProc eventProc
#####
# FilterStateInfo: contains dynamic info about file being processed
class VDXFilterStateInfo
public:
sint32 lCurrentFrame; # current sequence frame (previously called output frame)
sint32 lMicrosecsPerFrame; # microseconds per sequence frame
sint32 lCurrentSourceFrame; # current source frame
sint32 lMicrosecsPerSrcFrame; # microseconds per source frame
sint32 lSourceFrameMS; # source frame timestamp
sint32 lDestFrameMS; # output frame timestamp
enum
kStateNone = 0x00000000,
kStatePreview = 0x00000001, # (V1.5.10+) Job output is not being saved to disk.
kStateRealTime = 0x00000002, # (V1.5.10+) Operation is running in real-time (capture, playback).
kStateMax = 0xFFFFFFFF
uint32 flags; # (V10 / 1.5.10+ only)
sint32 mOutputFrame; # (V13/V1.8.2+) current output frame
# VDXFBitmap: VBitmap extended to hold filter-specific information
class VDXBitmap
public:
void * _vtable; # Reserved - do not use.
uint32 * data; # Pointer to start of _bottom-most_ scanline of plane 0.
uint32 * palette; # Pointer to palette (reserved - set to NULL).
sint32 depth; # Bit depth, bits. Set to zero if mpPixmap/mpPixmapLayout are active.
sint32 w; # Width of bitmap, pixels.
sint32 h; # Height of bitmap, pixels.
ptrdiff_t pitch; # Distance, bytes, the start of one scanline in plane 0 to the next.
ptrdiff_t modulo; # Distance, bytes, the end of one scanline in plane 0 to the start of the next.
ptrdiff_t size; # Size of plane 0, padding.
ptrdiff_t offset; # Offset from beginning of buffer to beginning of plane 0.
uint32 *Address32(int x, y)
return Address32i(x, h-y-1)
uint32 *Address32i(int x, y)
return (uint32 *)((char *)data + y*pitch + x*4)
void AlignTo4()
pitch = w << 2
void AlignTo8()
pitch = ((w+1)&~1) << 2
class VDXFBitmap : public VDXBitmap
public:
enum
#/ Set in paramProc if the filter requires a Win32 GDI display context
#/ for a bitmap. (Deprecated as of API V12 - do not use)
NEEDS_HDC = 0x00000001L,
uint32 dwFlags
VDXHDC hdc
uint32 mFrameRateHi; # Frame rate numerator (V1.7.4+)
uint32 mFrameRateLo; # Frame rate denominator (V1.7.4+)
sint64 mFrameCount; # Frame count; -1 if unlimited or indeterminate (V1.7.4+)
VDXPixmapLayout *mpPixmapLayout
VDXPixmap *mpPixmap
uint32 mAspectRatioHi; #/< Pixel aspect ratio fraction (numerator). 0/0 = unknown
uint32 mAspectRatioLo; #/< Pixel aspect ratio fraction (denominator).
sint64 mFrameNumber; #/< Current frame number (zero based).
sint64 mFrameTimestampStart; #/< Starting timestamp of frame, 100ns units.
sint64 mFrameTimestampEnd; #/< Ending timestamp of frame, 100ns units.
sint64 mCookie; #/< Cookie supplied when frame was requested.
# VDXFilterActivation: This is what is actually passed to filters at runtime.
class VDXFilterActivation
public:
VDXFilterDefinition *filter; #
void *filter_data
VDXFBitmap& dst
VDXFBitmap& src
VDXFBitmap *_reserved0
VDXFBitmap * last
uint32 x1
uint32 y1
uint32 x2
uint32 y2
VDXFilterStateInfo *pfsi
IVDXFilterPreview *ifp
IVDXFilterPreview2 *ifp2; # (V11+)
uint32 mSourceFrameCount; # (V14+)
VDXFBitmap * *mpSourceFrames; # (V14+)
VDXFBitmap * *mpOutputFrames; # (V14+)
# These flags must match those in cpuaccel.h!
#ifndef f_VIRTUALDUB_CPUACCEL_H
#define CPUF_SUPPORTS_CPUID (0x00000001L)
#define CPUF_SUPPORTS_FPU (0x00000002L)
#define CPUF_SUPPORTS_MMX (0x00000004L)
#define CPUF_SUPPORTS_INTEGER_SSE (0x00000008L)
#define CPUF_SUPPORTS_SSE (0x00000010L)
#define CPUF_SUPPORTS_SSE2 (0x00000020L)
#define CPUF_SUPPORTS_3DNOW (0x00000040L)
#define CPUF_SUPPORTS_3DNOW_EXT (0x00000080L)
#endif
struct VDXFilterFunctions
VDXFilterDefinition *(__cdecl *addFilter)(VDXFilterModule *, *, fd_len)
void (__cdecl *removeFilter)(VDXFilterDefinition *)
bool (__cdecl *isFPUEnabled)()
bool (__cdecl *isMMXEnabled)()
void (__cdecl *InitVTables)(VDXFilterVTbls *)
# These functions permit you to throw MyError exceptions from a filter.
# YOU MUST ONLY CALL THESE IN runProc, initProc, startProc.
void (__cdecl *ExceptOutOfMemory)(); # ADDED: V6 (VirtualDub 1.4)
void (__cdecl *Except)( char *format, ...); # ADDED: V6 (VirtualDub 1.4)
# These functions are callable at any time.
long (__cdecl *getCPUFlags)(); # ADDED: V6 (VirtualDub 1.4)
long (__cdecl *getHostVersionInfo)(char *buffer, len); # ADDED: V7 (VirtualDub 1.4d)
#####################################/
class VDXScriptValue
class VDXScriptError
struct VDXScriptObject
class VDXScriptError
public:
enum
PARSE_ERROR=1,
SEMICOLON_EXPECTED,
IDENTIFIER_EXPECTED,
TYPE_INT_REQUIRED,
TYPE_ARRAY_REQUIRED,
TYPE_FUNCTION_REQUIRED,
TYPE_OBJECT_REQUIRED,
OBJECT_MEMBER_NAME_REQUIRED,
FUNCCALLEND_EXPECTED,
TOO_MANY_PARAMS,
DIVIDE_BY_ZERO,
VAR_NOT_FOUND,
MEMBER_NOT_FOUND,
OVERLOADED_FUNCTION_NOT_FOUND,
IDENT_TOO_LONG,
OPERATOR_EXPECTED,
CLOSEPARENS_EXPECTED,
CLOSEBRACKET_EXPECTED,
VAR_UNDEFINED,
OUT_OF_STRING_SPACE,
OUT_OF_MEMORY,
INTERNAL_ERROR,
EXTERNAL_ERROR,
FCALL_OUT_OF_RANGE,
FCALL_INVALID_PTYPE,
FCALL_UNKNOWN_STR,
ARRAY_INDEX_OUT_OF_BOUNDS,
NUMERIC_OVERFLOW,
STRING_NOT_AN_INTEGER_VALUE,
STRING_NOT_A_REAL_VALUE,
ASSERTION_FAILED,
AMBIGUOUS_CALL,
CANNOT_CAST
class IVDXScriptInterpreter
public:
virtual void _placeholder1() {
virtual void _placeholder2(void *, *) {
virtual void _placeholder3(char *s) {
virtual void ScriptError(int e)=0
virtual void _placeholder4(VDXScriptError& cse) {
virtual char** AllocTempString(long l)=0
virtual void _placeholder5() {
#define EXT_SCRIPT_ERROR(x) (isi.ScriptError((VDXScriptError.x)))
typedef VDXScriptValue (*VDXScriptFunctionPtr)(IVDXScriptInterpreter *, *, *, int)
typedef void (*VDXScriptVoidFunctionPtr)(IVDXScriptInterpreter *, *, *, int)
typedef int (*VDXScriptIntFunctionPtr)(IVDXScriptInterpreter *, *, *, int)
struct VDXScriptFunctionDef
VDXScriptFunctionPtr func_ptr
char *name
char *arg_list
struct VDXScriptObject
void *_lookup; # reserved - set to NULL
VDXScriptFunctionDef *func_list
void *_obj_list; # reserved - set to NULL
class VDXScriptValue
public:
enum { T_VOID, T_INT, T_PINT, T_STR, T_ARRAY, T_OBJECT, T_FNAME, T_FUNCTION, T_VARLV, T_LONG, T_DOUBLE } type
VDXScriptObject *thisPtr
union
int i
char **s
sint64 l
double d
} u
VDXScriptValue()
type = T_VOID
VDXScriptValue(int i)
type = T_INT
u.i = i
VDXScriptValue(sint64 l)
type = T_LONG
u.l = l
VDXScriptValue(double d)
type = T_DOUBLE
u.d = d
VDXScriptValue(char **s)
type = T_STR
u.s = s
bool isVoid()
return type == T_VOID
bool isInt()
return type == T_INT
bool isString()
return type == T_STR
bool isLong()
return type == T_LONG
bool isDouble()
return type == T_DOUBLE
int asInt()
return u.i
sint64 asLong()
return u.l
double asDouble()
return u.d
char ** asString()
return u.s
#ifdef _MSC_VER
#pragma pack(pop)
#endif
#endif

127
utilities/gimp/SpatialForegroundRemover-python/include/vd2/plugin/vdvideoutil.h.py

@ -0,0 +1,127 @@
#ifndef f_VD2_PLUGIN_VDVIDEOUTIL_H
#define f_VD2_PLUGIN_VDVIDEOUTIL_H
template<class T>
T *vd_ptroffset(T *p, diff)
return (T *)((char *)p + diff)
template<class T>
class vd_row_iter
public:
vd_row_iter() {
vd_row_iter(T *p, pitch) : mp(p), mpitch(pitch) {
vd_row_iter(T *p, pitch, y) : mp(vd_ptroffset(p, pitch*y)), mpitch(pitch) {
vd_row_iter( VFBitmap& bm, x = 0, y = 0) : mp(vd_ptroffset((T*)bm.data, bm.pitch*(bm.h - 1 - y))+x), mpitch(-bm.pitch) {
operator T*()
return mp
T& operator[](int x)
return mp[x]
void mulstep(int x)
mpitch *= x
vd_row_iter<T>& operator+=(int y)
mp = vd_ptroffset(mp, * y)
return *self
vd_row_iter<T>& operator-=(int y)
mp = vd_ptroffset(mp, -(mpitch * y))
return *self
vd_row_iter<T>& operator++()
mp = vd_ptroffset(mp, mpitch)
return *self
vd_row_iter<T> operator++(int)
vd_row_iter<T> temp(*self)
mp = vd_ptroffset(mp, mpitch)
return temp
vd_row_iter<T>& operator--()
mp = vd_ptroffset(mp, -mpitch)
return *self
vd_row_iter<T> operator--(int)
vd_row_iter<T> temp(*self)
mp = vd_ptroffset(mp, -mpitch)
return temp
protected:
T *mp
ptrdiff_t mpitch
typedef vd_row_iter<uint32> vd_pixrow_iter
inline uint32 vd_pixavg_down(uint32 x, y)
return (x&y) + (((x^y)&0xfefefefe)>>1)
inline uint32 vd_pixavg_up(uint32 x, y)
return (x|y) - (((x^y)&0xfefefefe)>>1)
inline void vd_pixunpack(uint32 px, r, g, b)
r = (px>>16)&255
g = (px>> 8)&255
b = (px )&255
inline uint32 vd_pixpack(int r, g, b)
if ((unsigned)r >= 256) r = ~(r>>31) & 255
if ((unsigned)g >= 256) g = ~(g>>31) & 255
if ((unsigned)b >= 256) b = ~(b>>31) & 255
return (r<<16) + (g<<8) + b
inline uint32 vd_pixpackfast(int r, g, b)
return (r<<16) + (g<<8) + b
struct vd_transform_pixmap_helper
vd_transform_pixmap_helper( VFBitmap& dst)
: p((uint32 *)dst.data)
, pitch(dst.pitch)
, w(dst.w)
, h(dst.h) {
operator bool()
return False
uint32 *p
ptrdiff_t pitch
int w, h
#define vd_transform_pixmap_blt(dst, src) \
if(dstinfo = dst);else \
if(srcinfo = src);else \
for(y = 0, h = dstinfo.h, w = dstinfo.w; y < h; ++y, dstinfo.p=vd_ptroffset(dstinfo.p, dstinfo.pitch), srcinfo.p=vd_ptroffset(srcinfo.p, srcinfo.pitch)) \
for(x = 0; x < dstinfo.w; ++x) \
switch(out = dstinfo.p[x]) case 0: default: \
switch( in = srcinfo.p[x]) case 0: default:
#define vd_transform_pixmap_inplace(dst) \
if(dstinfo = dst);else \
for(y = 0, h = dstinfo.h, w = dstinfo.w; y < h; ++y, dstinfo.p=vd_ptroffset(dstinfo.p, dstinfo.pitch)) \
for(x = 0; x < dstinfo.w; ++x) \
switch(px = dstinfo.p[x]) case 0: default: \
#define vd_maketable256_16(x) formula((x+0)),formula((x+1)),formula((x+2)),formula((x+3)),formula((x+4)),formula((x+5)),formula((x+6)),formula((x+7)),formula((x+8)),formula((x+9)),formula((x+10)),formula((x+11)),formula((x+12)),formula((x+13)),formula((x+14)),formula((x+15))
#define vd_maketable256 vd_maketable256_16(0x00),vd_maketable256_16(0x10),vd_maketable256_16(0x20),vd_maketable256_16(0x30),vd_maketable256_16(0x40),vd_maketable256_16(0x50),vd_maketable256_16(0x60),vd_maketable256_16(0x70),vd_maketable256_16(0x80),vd_maketable256_16(0x90),vd_maketable256_16(0xA0),vd_maketable256_16(0xB0),vd_maketable256_16(0xC0),vd_maketable256_16(0xD0),vd_maketable256_16(0xE0),vd_maketable256_16(0xF0),
#endif

144
utilities/gimp/SpatialForegroundRemover-python/references/yuv2ppm by Scott Scriven (fourcc.org yuv2ppm.c) accessed 2010-03-03.c.py

@ -0,0 +1,144 @@
#include <stdio.h>
#include <stdlib.h>
'''
Compile thusly:
cc -o yuv2ppm yuv2ppm.c
'''
''' example.ppm
P3
# feep.ppm
4 4
15
0 0 0 0 0 0 0 0 0 15 0 15
0 0 0 0 15 7 0 0 0 0 0 0
0 0 0 0 0 0 0 15 7 0 0 0
15 0 15 0 0 0 0 0 0 0 0 0
'''
'''
Use "P6" for binary data, or "P3" for ascii data.
'''
def make_outfile(self, *outfile, *infile): int i
for(i=0; infile[i]; i++)
outfile[i] = infile[i]
outfile[i++] = '.'
outfile[i++] = 'p'
outfile[i++] = 'p'
outfile[i++] = 'm'
outfile[i++] = 0
return 0
def yuv2rgb(self, y, u, v): unsigned int pixel32
unsigned char *pixel = (unsigned char *)&pixel32
int r, g, b
#if 0
'''
One formula I found: (not the right one)
R = 1.164(Y - 16) + 1.596(Cr - 128)
G = 1.164(Y - 16) - 0.813(Cr - 128) - 0.391(Cb - 128)
B = 1.164(Y - 16) + 2.018(Cb - 128)
'''
r = (1.164 * (y - 16))
+ (2.018 * (v - 128))
g = (1.164 * (y - 16))
- (0.813 * (u - 128))
- (0.391 * (v - 128))
b = (1.164 * (y - 16))
+ (1.596 * (u - 128))
#else:
'''
Another formula I found: (seems to work)
R = Y + 1.370705 (V-128)
G = Y - 0.698001 (V-128) - 0.337633 (U-128)
B = Y + 1.732446 (U-128)
'''
r = y + (1.370705 * (v-128))
g = y - (0.698001 * (v-128)) - (0.337633 * (u-128))
b = y + (1.732446 * (u-128))
#endif
# Even with proper conversion, values still need clipping.
if (r > 255) r = 255
if (g > 255) g = 255
if (b > 255) b = 255
if (r < 0) r = 0
if (g < 0) g = 0
if (b < 0) b = 0
# Values only go from 0-220.. Why?
pixel[0] = r * 220 / 256
pixel[1] = g * 220 / 256
pixel[2] = b * 220 / 256
pixel[3] = 0
''' Debug
printf("yuv2rgb(%i, %i, %i) . %i, %i, %i (0x%x)\n",
y, u, v,
pixel[0], pixel[1], pixel[2],
pixel32)
'''
return pixel32
def yuv2ppm(self, *infile, *outfile): FILE *in, *out
int i
unsigned int pixel_16
unsigned char pixel_24[3]
unsigned int pixel32
int y, u, v, y2
char *ppmheader = "P6\n# Generated by yuv2ppm\n720 486\n255\n"
in = fopen(infile, "rb")
out = fopen(outfile, "wb")
if (not in or not out) return 0
fprintf(out, ppmheader)
for(i=0; i<720*486/2; i++)
fread(&pixel_16, 4, 1, in)
pixel_24[0] = pixel_24[1] = pixel_24[2] = 0
u = ((pixel_16 & 0x000000ff))
y = ((pixel_16 & 0x0000ff00)>>8)
v = ((pixel_16 & 0x00ff0000)>>16)
y2 = ((pixel_16 & 0xff000000)>>24)
pixel32 = yuv2rgb(y, u, v)
pixel_24[0] = (pixel32 & 0x000000ff)
pixel_24[1] = (pixel32 & 0x0000ff00) >> 8
pixel_24[2] = (pixel32 & 0x00ff0000) >> 16
# For binary PPM
fwrite(pixel_24, 3, 1, out)
# For ascii PPM
#fprintf(out, "%i %i %i\n",
# pixel_24[0],
# pixel_24[1],
# pixel_24[2])
pixel32 = yuv2rgb(y2, u, v)
pixel_24[0] = (pixel32 & 0x000000ff)
pixel_24[1] = (pixel32 & 0x0000ff00) >> 8
pixel_24[2] = (pixel32 & 0x00ff0000) >> 16
# For binary PPM
fwrite(pixel_24, 3, 1, out)
# For ascii PPM
#fprintf(out, "%i %i %i\n",
# pixel_24[0],
# pixel_24[1],
# pixel_24[2])
fclose(in)
fclose(out)
return 1
def main(self, argc, **argv): char *infile, outfile[256]
int i
int success
for(i=1; i<argc; i++)
success = 0
infile = argv[i]
make_outfile(outfile, infile)
printf("%s . %s... ", infile, outfile)
fflush(stdout)
success = yuv2ppm(infile, outfile)
if success:
printf("Done.\n")
else:
printf("Failed. Aborting.\n")
return 1
return 0

21
utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/resource.h.py

@ -0,0 +1,21 @@
#{{NO_DEPENDENCIES}
# Microsoft Visual C++ generated include file.
# Used by SpatialForegroundRemover.rc
#
#define IDCANCEL2 3
#define IDC_PREVIEW 3
#define IDD_FILTER_SPATIALFOREGROUNDREMOVER 101
#define IDC_REACH 1001
#define IDC_RADIALSAMPLES 1002
#define IDC_DIFFUSION 1003
# Next default values for objects
#
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1002
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

1187
utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/colorspacetransform.cpp.py

File diff suppressed because it is too large

60
utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/colorspacetransform.h.py

@ -0,0 +1,60 @@
#ifndef COLORSPACETRANSFORM_H
#define COLORSPACETRANSFORM_H
#include <cstdio>
#include <cstdlib> #rand etc
#include <string>
#include <iostream>
#include <climits> #<limits.h>
##define CT_TESTLIMITS
#include "frameworkdummy.h"
#include "preporting.h"
using namespace std
namespace ProtoArmor
char c255=(char)255
extern float YCToRgb_fMaxY
extern float YCToRgb_fMaxU
extern float YCToRgb_fMaxV
extern float YCToRgb_fMinY
extern float YCToRgb_fMinU
extern float YCToRgb_fMinV
extern float RgbToYC_fMaxY
extern float RgbToYC_fMaxU
extern float RgbToYC_fMaxV
extern float RgbToYC_fMinY
extern float RgbToYC_fMinU
extern float RgbToYC_fMinV
extern float YCToRgb_byMaxR
extern float YCToRgb_byMaxG
extern float YCToRgb_byMaxB
extern float YCToRgb_byMinR
extern float YCToRgb_byMinB
extern float YCToRgb_byMinG
#class CONVERT_FAKESTATIC_CLASS#public:
# static byte ToByte(float val)
# static byte ToByte(double val)
# static char ToChar8(float val)
# static char ToChar8(double val)
#
def GetCurrentOrPrevFrameFor(self, sAnyFrameFile, iFrame):
def IsDigit(self, val):
#void YUV4xxSubsampledPlanarToYUV444NonPlanar(unsigned char* dest, bAddDestAlpha, char* source, char* source_Stride, int source_J, int source_a, int source_b, int w, int h)
#void RgbToYC(byte &Y, &U, &V, r, g, b)
def RgbToYC(self, char &Y, char &U, char &V, char r, char g, char b):
#void YCToRgb(byte &r, &g, &b, Y, U, V)
def YCToRgb(self, char &r, char &g, char &b, char Y, char U, char V):
def YUV444NonPlanarToRGB(self, char* dest, bDestHasAlphaChannel, bSetDestAlphaTo255_IgnoredIfNoDestAlpha, char* source, int iPixels):
void CopySurface_BitdepthSensitive(unsigned char* dest, int dest_BytesPP, int dest_Stride, char* source, int source_BytesPP, int source_Stride, int w, int h); # void CopySurface_BitdepthSensitive(unsigned char* dest, int dest_BytesPP, char* source, int source_BytesPP, int iTotalPixels)
def CopyPlaneToNonPlanar(self, char* dest, int DestChannelIndex, int dest_BytesPP, char* source, int source_Stride, int w, int h, bSamplesOnSecondLineOfSource):
def CopyNonPlanarToPlane(self, char* dest, int dest_Stride, bSamplesOnSecondLineOfDest, char* source, int SourceChannelIndex, int source_BytesPP, int w, int h):
def SaveRaw(self, sFile, char* buffer, iBytes):
def Heal_ToNearestPixel(self, char* dest, int dest_BytesPP, int dest_Stride, char* mask, int mask_BytesPP, int mask_Stride, int mask_Channel, int w, int h, rReachMultiplier_UNUSED, rRadialSampleSpacing_UNUSED, rDiffusionMultiplier):
def Heal_WithAveraging_Permutations(self, char* dest0, int dest_BytesPP, int dest_Stride, char* mask0, int mask_BytesPP, int mask_Stride, int mask_Channel, int w, int h, rReachMultiplier, rRadialSampleSpacing, rDiffusionMultiplier, bHorizonalSearch, bVerticalSearch):
def Diffuse(self, char* dest0, int dest_w, int dest_h, int dest_BytesPP, int dest_Stride, at_x, at_y, char* brush0, int brush_w, int brush_y, int brush_BytesPP, int brush_Stride, int brush_Channel, iPixelsRadius, bRandom):
def Heal_WithAveraging_Sequential(self, char* dest, int dest_BytesPP, int dest_Stride, char* mask, int mask_BytesPP, int mask_Stride, int mask_Channel, int w, int h, rReachMultiplier, rRadialSampleSpacing, rDiffusionMultiplier):
}#end namespace
#endif

20
utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/etc/pconvert.cpp.py

@ -0,0 +1,20 @@
#ifndef PMATH_CPP
#define PMATH_CPP
############/ UNUSED: see Convert in frameworkdummy.h and ByRound in pmath.h
#include "pconvert.h"
#include <cmath>#<math.h>
namespace ProtoArmor
def Abs(self, val):
return (val>=255.0f) ? 255 : ((val<=0.0f)?0:(byte)val)
def Abs(self, val):
return (val>=255.0) ? 255 : ((val<=0.0)?0:(byte)val)
}#end namespace
#endif

19
utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/etc/pconvert.h.py

@ -0,0 +1,19 @@
#ifndef PCONVERT_H
#define PCONVERT_H
#include <string>
#include <climits> #<limits.h>
#include "preporting.h"
#include "frameworkdummy.h"
using namespace std
namespace ProtoArmor
class PConvert
public:
static void ToByte(float val)
static void ToByte(float val)
}#end namespace
#endif

585
utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/f_spatialforegroundremover.cpp.py

@ -0,0 +1,585 @@
##define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <commctrl.h>
#include <stdio.h>
#include <vd2/VDXFrame/VideoFilter.h>
#include <vd2/VDXFrame/VideoFilterDialog.h>
#include "../resource.h"
#include "f_spatialforegroundremover.h"
#include <ctime>
#include "pimage.h"
#include "pmath.h"
extern int g_VFVAPIVersion
using namespace ProtoArmor
#######################################/
PMathStatic* pmathstatic=NULL
def DlgProc(self, msg, wParam, lParam):
switch(msg)
case WM_INITDIALOG:
return not OnInit()
case WM_DESTROY:
OnDestroy()
break
case WM_COMMAND:
if OnCommand(LOWORD(wParam)):
return TRUE
break
case WM_HSCROLL:
if mifp and SaveToConfig():
mifp.RedoFrame()
return TRUE
return FALSE
def OnInit(self):
mOldConfig = mConfig
SendDlgItemMessage(mhdlg, IDC_REACH, TBM_SETRANGE, TRUE, MAKELONG(0, 2000))
SendDlgItemMessage(mhdlg, IDC_RADIALSAMPLES, TBM_SETRANGE, TRUE, MAKELONG(0, 2000))
SendDlgItemMessage(mhdlg, IDC_DIFFUSION, TBM_SETRANGE, TRUE, MAKELONG(0, 2000))
LoadFromConfig()
hwndFirst = GetDlgItem(mhdlg, IDC_REACH)
if hwndFirst:
SendMessage(mhdlg, WM_NEXTDLGCTL, (WPARAM)hwndFirst, TRUE)
hwndPreview = GetDlgItem(mhdlg, IDC_PREVIEW)
if hwndPreview and mifp:
EnableWindow(hwndPreview, TRUE)
mifp.InitButton((VDXHWND)hwndPreview)
return False
def OnDestroy(self):
if mifp:
mifp.InitButton(NULL)
def OnCommand(self, cmd):
switch(cmd)
case IDOK:
SaveToConfig()
EndDialog(mhdlg, True)
return True
case IDCANCEL:
mConfig = mOldConfig
EndDialog(mhdlg, False)
return True
case IDC_PREVIEW:
if mifp:
mifp.Toggle((VDXHWND)mhdlg)
return True
return False
def LoadFromConfig(self):
SendDlgItemMessage(mhdlg, IDC_REACH, TBM_SETPOS, TRUE, (int)(0.5f + mConfig.mReach * 1000.0f))
SendDlgItemMessage(mhdlg, IDC_RADIALSAMPLES, TBM_SETPOS, TRUE, (int)(0.5f + mConfig.mRadialSamples * 1000.0f))
SendDlgItemMessage(mhdlg, IDC_DIFFUSION, TBM_SETPOS, TRUE, (int)(0.5f + mConfig.mDiffusion * 1000.0f))
def SaveToConfig(self):
fReach = (float)SendDlgItemMessage(mhdlg, IDC_REACH, TBM_GETPOS, 0, 0) / 1000.0f
fRadialSamples = (float)SendDlgItemMessage(mhdlg, IDC_RADIALSAMPLES, TBM_GETPOS, 0, 0) / 1000.0f
fDiffusion = (float)SendDlgItemMessage(mhdlg, IDC_DIFFUSION, TBM_GETPOS, 0, 0) / 1000.0f
if (fReach != mConfig.mReach
or fRadialSamples != mConfig.mRadialSamples
or fDiffusion != mConfig.mDiffusion)
mConfig.mReach = fReach
mConfig.mRadialSamples = fRadialSamples
mConfig.mDiffusion = fDiffusion
return True
return False
VDXVF_BEGIN_SCRIPT_METHODS(SpatialForegroundRemoverFilter)
VDXVF_DEFINE_SCRIPT_METHOD(SpatialForegroundRemoverFilter, ScriptConfig, "iii")
VDXVF_END_SCRIPT_METHODS()
SpatialForegroundRemoverFilter.~SpatialForegroundRemoverFilter()
if pmathstatic!=NULL:
delete pmathstatic
pmathstatic=NULL
if fx_buffer!=NULL:
free(fx_buffer)
fx_buffer=NULL
def GetParams(self):
if g_VFVAPIVersion >= 12:
switch(fa.src.mpPixmapLayout.format)
case nsVDXPixmap.kPixFormat_XRGB8888:
break
case nsVDXPixmap.kPixFormat_YUV444_Planar:
break
case nsVDXPixmap.kPixFormat_YUV422_Planar:
break
case nsVDXPixmap.kPixFormat_YUV420_Planar:
break
case nsVDXPixmap.kPixFormat_YUV411_Planar:
break
case nsVDXPixmap.kPixFormat_YUV410_Planar:
break
default:
return FILTERPARAM_NOT_SUPPORTED
fa.dst.offset = fa.src.offset
return FILTERPARAM_SUPPORTS_ALTFORMATS
def Start(self):
#PReporting.setIsMegaDebug(True);#debug only
if (pmathstatic==NULL) pmathstatic=new PMathStatic();#PMathStatic pmathstatic
fx_buffer_w=0
fx_buffer_h=0
fx_buffer_BytesPP=0
fx_buffer_Stride=0
fx_buffer=NULL
fx_buffer_BytesTotal=0
time_t rawtime; ##include <ctime> #<time.h>
struct tm * timeinfo
time(&rawtime)
timeinfo=localtime(&rawtime)
cerr<<(timeinfo.tm_year+1900)<<"-"<<(timeinfo.tm_mon+1)<<"-"<<(timeinfo.tm_mday)<<" "<<timeinfo.tm_hour<<":"<<timeinfo.tm_min<<":"<<timeinfo.tm_sec<<endl
def DrawDebugSquareTo_fx_buffer(self):
for (int iDebug=0; iDebug<=fa.pfsi.lCurrentSourceFrame; iDebug++)
for (int yDebug=0; yDebug<=fa.pfsi.lCurrentSourceFrame; yDebug++)
if iDebug<fa.dst.w and yDebug<fa.dst.h:
int iLocDebug=yDebug*fx_buffer_Stride+iDebug*fx_buffer_BytesPP
fx_buffer[iLocDebug]=128
if fx_buffer_BytesPP>2:
fx_buffer[iLocDebug+1]=128
fx_buffer[iLocDebug+2]=128
#targaMask.arrbyData[yDebug*targaMask.Stride()+iDebug*targaMask.BytesPP()+mask_Channel]=255;#fx_buffer[iLocDebug+3]=255;#alpha
}#end DrawDebugSquareTo_fx_buffer
def DrawDebugCircleTo_fx_buffer(self):
for (int iDebug=0; iDebug<PMath.ppiCache_Used and iDebug<fa.pfsi.lCurrentSourceFrame; iDebug++)
if PMath.ppiCache[iDebug].x<fa.dst.w and PMath.ppiCache[iDebug].y<fa.dst.h:
int iLocDebug=PMath.ppiCache[iDebug].y*fx_buffer_Stride+PMath.ppiCache[iDebug].x*fx_buffer_BytesPP
fx_buffer[iLocDebug]=255
fx_buffer[iLocDebug+1]=255
fx_buffer[iLocDebug+2]=255
#targaMask.arrbyData[PMath.ppiCache[iDebug].y*targaMask.Stride()+PMath.ppiCache[iDebug].x*targaMask.BytesPP()+mask_Channel]=255;#fx_buffer[iLocDebug+3]=255;#alpha
}#if within range
}#debug only (result should be WHITE circle inside GRAY square)
def Run(self):
#PReporting.setIsUltraDebug(True)
#mConfig.mReach
#mConfig.mRadialSamples
#mConfig.mDiffusion
bool bHorizontalSearch=True
bool bVerticalSearch=False
bool bUnknownPixelFormat=False
bool bGood=False
cerr<<"SpatialForegroundRemoverFilter.Run..."<<endl
try
#*fa.pfsi.lCurrentFrame#current sequence frame, called output frame
cerr<<"SpatialForegroundRemoverFilter.Run: frame "<<fa.pfsi.lCurrentSourceFrame<<"..."<<endl
string MaskFile_Name=""
string MaskFile_UserInput="spatialforegroundremover.tga";#in current working dir (which is the VirtualDub folder)
for (int iDigits=0; iDigits<10; iDigits++)
string sDigits=string("")
for (int iBuild=0; iBuild<iDigits; iBuild++)
sDigits+=string("0")
string sFileTheoretical=string("spatialforegroundremover")+sDigits+string(".tga")
if File.Exists(sFileTheoretical) :
MaskFile_UserInput=sFileTheoretical
#cerr<<sFileTheoretical<<" sequence start frame found"<<endl
break
#else cerr<<sFileTheoretical<<" sequence start frame not found"<<endl
#string MaskFile_Test1="C:\\Documents and Settings\\Owner\\Desktop\\heal-mask1c-80662.tga"
#string MaskFile_Test2="E:\\Videos\\Projects\\etc\\OldFHC,The\\heal-mask1c-80662.tga"
if (File.Exists(MaskFile_UserInput)) MaskFile_Name=MaskFile_UserInput
#elif (File.Exists(MaskFile_Test1)) MaskFile_Name=MaskFile_Test1
#elif (File.Exists(MaskFile_Test2)) MaskFile_Name=MaskFile_Test2
if MaskFile_Name!="":
string MaskFile_CurrentOrPrev_AbsOrRelName=GetCurrentOrPrevFrameFor(MaskFile_Name,fa.pfsi.lCurrentFrame); #GetCurrentOrPrevFrameFor(MaskFile_Name,fa.pfsi.lCurrentSourceFrame)
cerr<<"SpatialForegroundRemoverFilter.Run: Loading Mask "<<MaskFile_CurrentOrPrev_AbsOrRelName<<"..."<<flush
bool bTest=self.targaMask.Load(MaskFile_CurrentOrPrev_AbsOrRelName)
cerr<<(bTest?"OK":"FAILED")<<endl
}#end if mask found
else:
cerr<<"SpatialForegroundRemoverFilter.Run: Using Mask (none, continue)"<<endl
unsigned int mask_Channel=0; #NOTE: uses blue if mask is 32- or 24-bit
rRadialSampleSpacing = ((double)mConfig.mRadialSamples*360.0>1.0) ? (360.0/((double)mConfig.mRadialSamples*360.0)) : 360.0
cerr<<"{Reach:"<<mConfig.mReach<<"; RadialSamples:"<<mConfig.mRadialSamples<<"; RadialSampleSpacing:"<<rRadialSampleSpacing<<"; Diffusion:"<<mConfig.mDiffusion<<"; PReporting.iDebugLevel:"<<PReporting.getDebugLevel()<<"}..."<<endl;#Console.Error.WriteLine(Convert.ToString("{Reach:")+Convert.ToString(mConfig.mReach)+Convert.ToString("; RadialSamples:")+Convert.ToString(mConfig.mRadialSamples)+Convert.ToString("; Diffusion:")+Convert.ToString(mConfig.mDiffusion)+Convert.ToString("}..."))
unsigned int vdpixmapSource_BytesPP=3
#unsigned int targaTemp_BytesPP=4
if g_VFVAPIVersion >= 12:
vdpixmapDest = *fa.dst.mpPixmap
vdpixmapSource = *fa.src.mpPixmap
#int sw
#int sh
#NOTES:
#-data and pitch are Y
#-data2 and pitch2 are Cb (U)
#-data3 and pitch3 are Cr (V)
#Steps:
#-load targaMask: if loaded but frame is less than current frame, for a later one <= current
#-prepare fx_buffer (will become interleaved YUV444)
#-transfer dest frame to fx_buffer
# --if BGR24 then transfer using memcpy
# --if YUV (even if 444 since planar) then transfer using YUV4xxSubsampledPlanarToYUV444NonPlanar adding alpha channel
# --if BGRA32 transfer using CopySurface_BitdepthSensitive(fx_buffer,fx_buffer_BytesPP,fx_buffer_Stride,vdpixmapSource.data,vdpixmapSource_BytesPP,vdpixmapSource.pitch,h)
#-NOTE: after previous step it is fine for fx_buffer to be either YUV444 or RGB24
#-DEPRECATED 2010-06: Create targaTemp (re-Init only if different size than dest), at 32-bit
#-calculate healed color for each pixel of the color channels of of 32-bit (YUV4444 or BGRA) targa where targaMask is nonzero
# --using fx_buffer
# --keep in mind that self may place YUV values into targa
# --NEW 2010-06: use mask to alpha blend the intensity of the effect
#-DEPRECATED 2010-06: copy value of targaMask to alpha channel of targaTemp
#-DEPRECATED 2010-06: overlay targaTemp to fx_buffer using alpha
#-NEW 2010-06: using the three appropriate CopyNonPlanarToPlane calls, healed fx_buffer directly to virtualdub dst planes.
#-if dest is (YUV444 non-planar [RARE] OR BGR24) copy fx_buffer directly to dest using memcpy
# --elif dest is BGRA32 copy using CopySurface_BitdepthSensitive(vdpixmapSource.data,vdpixmapSource_BytesPP,fx_buffer,fx_buffer_BytesPP,h*w)
# --else dest is neither YUV444 nor RGB nor RGBA: Copy using YUV444ToYUV4xx
cerr<<"VirtualDub API version 12 or higher found"<<endl
CTBufferInit(vdpixmapSource.w,vdpixmapSource.h,4);#fx_buffer=malloc etc
bool bShowDebugCircle=False;#to be changed below
bool bShowDebugSquare=False;#to be changed below
#bool bShowTargaTempDebugCircle
#bool bShowTargaTempDebugSquare
bool HasFullLumaRes=True
bool bSamplesOnSecondLine=False
switch(vdpixmapSource.format)
case nsVDXPixmap.kPixFormat_XRGB8888:
bSamplesOnSecondLine=True
vdpixmapSource_BytesPP=4
Console.Error.WriteLine("SpatialForegroundRemoverFilter.Run: Using xRGB32")
#NOTE: outermost "else" case should use same steps as self case!
# --EXCEPT accessing fa instead of *fa.dst.mpPixmap (a.k.a. vdpixmapSource)
CopySurface_BitdepthSensitive((unsigned char*)fx_buffer,fx_buffer_BytesPP,fx_buffer_Stride,(unsigned char*)vdpixmapSource.data,vdpixmapSource_BytesPP,vdpixmapSource.pitch,vdpixmapSource.w,vdpixmapSource.h)
#targaTemp.Init(vdpixmapSource.w,vdpixmapSource.h,targaTemp_BytesPP,True)
#if PReporting.getIsUltraDebug(): # CopySurface_BitdepthSensitive((unsigned char*)targaTemp.arrbyData,targaTemp.BytesPP(),targaTemp.Stride(),(unsigned char*)vdpixmapSource.data,vdpixmapSource_BytesPP,vdpixmapSource.pitch,vdpixmapSource.w,vdpixmapSource.h)
# targaTemp.Save("SpatialForegroundRemover-ARGB32-debug.tga")
#
break
case nsVDXPixmap.kPixFormat_RGB888:
bSamplesOnSecondLine=True
vdpixmapSource_BytesPP=3
Console.Error.WriteLine("SpatialForegroundRemoverFilter.Run: Using RGB24")
memcpy(fx_buffer,vdpixmapSource.data,vdpixmapSource.h*vdpixmapSource.pitch)
#targaTemp.Init(vdpixmapSource.w,vdpixmapSource.h,targaTemp_BytesPP,True)
#if PReporting.getIsUltraDebug(): # CopySurface_BitdepthSensitive((unsigned char*)targaTemp.arrbyData,targaTemp.BytesPP(),targaTemp.Stride(),(unsigned char*)vdpixmapSource.data,vdpixmapSource_BytesPP,vdpixmapSource.pitch,vdpixmapSource.w,vdpixmapSource.h)
# targaTemp.Save("SpatialForegroundRemover-RGB24-debug.tga")
#
break
case nsVDXPixmap.kPixFormat_YUV444_Planar:
bSamplesOnSecondLine=True
vdpixmapSource_BytesPP=3
Console.Error.WriteLine("SpatialForegroundRemoverFilter.Run: Using YUV 4:4:4 Planar")
HasFullLumaRes=True
CopyPlaneToNonPlanar(fx_buffer, 0, fx_buffer_BytesPP, (unsigned char*)vdpixmapSource.data, vdpixmapSource.pitch, vdpixmapSource.w, vdpixmapSource.h, HasFullLumaRes)
CopyPlaneToNonPlanar(fx_buffer, 1, fx_buffer_BytesPP, (unsigned char*)vdpixmapSource.data2, vdpixmapSource.pitch2, vdpixmapSource.w, vdpixmapSource.h, bSamplesOnSecondLine)
CopyPlaneToNonPlanar(fx_buffer, 2, fx_buffer_BytesPP, (unsigned char*)vdpixmapSource.data3, vdpixmapSource.pitch3, vdpixmapSource.w, vdpixmapSource.h, bSamplesOnSecondLine)
#targaTemp.Init(vdpixmapSource.w,vdpixmapSource.h,targaTemp_BytesPP,False)
#if PReporting.getIsUltraDebug(): # YUV444NonPlanarToRGB((unsigned char*)targaTemp.arrbyData, (targaTemp.BytesPP()>3)?True:False, False, fx_buffer, fx_buffer_w*fx_buffer_h)
# SaveRaw("debug-SpatialForegroundRemover-converted-to-YUV444NonPlanar.raw",(unsigned char*)fx_buffer,fx_buffer_Stride*fx_buffer_h)
# targaTemp.Save("SpatialForegroundRemover-YUV444-debug-to-RGB24.tga")
# YUV444NonPlanarToRGB(targaTemp.arrbyData,fx_buffer,targaTemp.BytesBuffer)
#
break
case nsVDXPixmap.kPixFormat_YUV422_Planar:
bSamplesOnSecondLine=True
vdpixmapSource_BytesPP=3
Console.Error.WriteLine("SpatialForegroundRemoverFilter.Run: Using YUV 4:2:2 Planar")
HasFullLumaRes=True
CopyPlaneToNonPlanar(fx_buffer, 0, fx_buffer_BytesPP, (unsigned char*)vdpixmapSource.data, vdpixmapSource.pitch, vdpixmapSource.w, vdpixmapSource.h, HasFullLumaRes)
CopyPlaneToNonPlanar(fx_buffer, 1, fx_buffer_BytesPP, (unsigned char*)vdpixmapSource.data2, vdpixmapSource.pitch2, vdpixmapSource.w, vdpixmapSource.h, bSamplesOnSecondLine)
CopyPlaneToNonPlanar(fx_buffer, 2, fx_buffer_BytesPP, (unsigned char*)vdpixmapSource.data3, vdpixmapSource.pitch3, vdpixmapSource.w, vdpixmapSource.h, bSamplesOnSecondLine)
#targaTemp.Init(vdpixmapSource.w,vdpixmapSource.h,targaTemp_BytesPP,True)
#if PReporting.getIsUltraDebug(): # SaveRaw("debug-SpatialForegroundRemover-converted-to-YUV444NonPlanar.raw",(unsigned char*)fx_buffer,fx_buffer_Stride*fx_buffer_h)
# YUV444NonPlanarToRGB((unsigned char*)targaTemp.arrbyData, False, False, fx_buffer, vdpixmapSource.w*vdpixmapSource.h)
# targaTemp.Save("SpatialForegroundRemover-YUV422Planes-debug-to-RGB24.tga")
# #YUV444NonPlanarToRGB(targaTemp.arrbyData,fx_buffer,targaTemp.BytesBuffer)
#
#TransformY8(vdpixmapDest.data, vdpixmapDest.pitch, vdpixmapDest.w, vdpixmapDest.h, mConfig.mYScale)
#sw = (vdpixmapSource.w + 1) >> 1
#sh = vdpixmapSource.h
#TransformY8(vdpixmapDest.data2, vdpixmapDest.pitch2, sw, sh, mConfig.mUScale)
#TransformY8(vdpixmapDest.data3, vdpixmapDest.pitch3, sw, sh, mConfig.mVScale)
break
case nsVDXPixmap.kPixFormat_YUV420_Planar:
bSamplesOnSecondLine=False
vdpixmapSource_BytesPP=3
Console.Error.WriteLine("SpatialForegroundRemoverFilter.Run: Using YUV 4:2:0 Planar")
HasFullLumaRes=True
#NOTE: fx_buffer is 32-bit (see CTBufferInit(...) call above)
CopyPlaneToNonPlanar(fx_buffer, 0, fx_buffer_BytesPP, (unsigned char*)vdpixmapSource.data, vdpixmapSource.pitch, vdpixmapSource.w, vdpixmapSource.h, HasFullLumaRes)
CopyPlaneToNonPlanar(fx_buffer, 1, fx_buffer_BytesPP, (unsigned char*)vdpixmapSource.data2, vdpixmapSource.pitch2, vdpixmapSource.w, vdpixmapSource.h, bSamplesOnSecondLine)
CopyPlaneToNonPlanar(fx_buffer, 2, fx_buffer_BytesPP, (unsigned char*)vdpixmapSource.data3, vdpixmapSource.pitch3, vdpixmapSource.w, vdpixmapSource.h, bSamplesOnSecondLine)
#targaTemp.Init(vdpixmapSource.w,vdpixmapSource.h,targaTemp_BytesPP,True)
#PReporting.setIsUltraDebug(True);#debug only
#if PReporting.getIsUltraDebug(): #SaveRaw("debug-SpatialForegroundRemover-converted-to-YUV444NonPlanar.raw",(unsigned char*)fx_buffer,fx_buffer_Stride*fx_buffer_h)
#YUV444NonPlanarToRGB((unsigned char*)targaTemp.arrbyData, False, False, fx_buffer, vdpixmapSource.w*vdpixmapSource.h)
#targaTemp.Save("SpatialForegroundRemover-YUV420-debug-YUV420Planes-to-RGB.tga")
#YUV444NonPlanarToRGB(targaTemp.arrbyData,fx_buffer,targaTemp.BytesBuffer)
#
#TODO:
#--DEPRECATED 2010-06: copy (without alpha) fx_buffer (444 or BGR) onto targaTemp BGR
# (need copy before healing; healed fx_buffer will be drawn onto it using mask)
#Console.Error.WriteLine("SpatialForegroundRemoverFilter.Run: Copy to targaTemp")
if PReporting.getIsUltraDebug():
if fx_buffer_BytesPP>3:
unsigned char* lpLineNow=fx_buffer
unsigned char* lpNow
for (unsigned int y=0; y<fx_buffer_h; y++)
lpNow=lpLineNow
for (unsigned int x=0; x<fx_buffer_w; x++)
lpNow[3]=255
lpNow+=fx_buffer_BytesPP
}#end for x
lpLineNow+=fx_buffer_Stride
}#end for y
}#end if fx_buffer has alpha channel
}#end if bUltraDebug
#CopySurface_BitdepthSensitive(targaTemp.arrbyData, targaTemp.BytesPP(), targaTemp.Stride(), fx_buffer, fx_buffer_BytesPP, fx_buffer_Stride, fx_buffer_w, fx_buffer_h)
#if PReporting.getIsUltraDebug(): # targaTemp.Save("SpatialForegroundRemover-YUV420-debug1-YUV420Planes-to-RGB.tga")
#
#--heal fx_buffer
Console.Error.WriteLine("SpatialForegroundRemoverFilter.Run: heal fx_buffer...")
#PReporting.setIsUltraDebug(True);#debug only
#Heal_WithAveraging_Sequential
Heal_WithAveraging_Permutations(fx_buffer,fx_buffer_BytesPP,fx_buffer_Stride,targaMask.arrbyData,targaMask.BytesPP(),targaMask.Stride(),mask_Channel,fx_buffer_w,fx_buffer_h,(double)mConfig.mReach,rRadialSampleSpacing,(double)mConfig.mDiffusion, bHorizontalSearch, bVerticalSearch)
#Console.Error.Write("debugging frame "+Convert.ToString(fa.pfsi.lCurrentSourceFrame))
#Console.Error.WriteLine("done. (debug circle drawing)")
#Heal_ToNearestPixel(fx_buffer,fx_buffer_BytesPP,fx_buffer_Stride,targaMask.arrbyData,targaMask.BytesPP(),targaMask.Stride(),mask_Channel,fx_buffer_w,fx_buffer_h,(double)mConfig.mReach,rRadialSampleSpacing,(double)mConfig.mDiffusion)
#if PReporting.getIsUltraDebug(): # #NOTE: copying to targaTemp at self point causes debug to be DESTRUCTIVE
# #CopySurface_BitdepthSensitive(targaTemp.arrbyData, targaTemp.BytesPP(), targaTemp.Stride(), fx_buffer, fx_buffer_BytesPP, fx_buffer_Stride, fx_buffer_w, fx_buffer_h)
# #SaveRaw("SpatialForegroundRemover-YUV420-debug-YUV420Planes-to-RGB-AFTERHEAL.raw",(unsigned char*)fx_buffer,vdpixmapSource.w*vdpixmapSource.h*fx_buffer_BytesPP)
# #targaTemp.Save("SpatialForegroundRemover-YUV420-debug-YUV420Planes-to-RGB-AFTERHEAL-DESTRUCTIVEDEBUG.tga")
# Targa targaDebug
# targaDebug.From(fx_buffer_w,fx_buffer_h,fx_buffer_BytesPP,fx_buffer,False)
# #targaDebug.Init(fx_buffer_w,fx_buffer_h,fx_buffer_BytesPP,True)
# #targaDebug.CopyBufferFrom(fx_buffer)
# targaDebug.Save("SpatialForegroundRemover-YUV420-debug2-HEAL-STEP1of2-fx_buffer.tga")
# targaMask.Save("SpatialForegroundRemover-YUV420-debug0-MASK.tga")
#
#--DEPRECATED 2010-06: overlay (with targaMask as alpha) healed fx_buffer (444 or BGR) onto targaTemp BGR
#Console.Error.WriteLine("SpatialForegroundRemoverFilter.Run: overlay healed channels to targaTemp using targaMask...")
#PImage.Draw(targaTemp.arrbyData,0,0,targaTemp.Width(),targaTemp.Height(),targaTemp.BytesPP(),targaTemp.Stride(),fx_buffer,fx_buffer_w,fx_buffer_h,fx_buffer_BytesPP,fx_buffer_Stride,targaMask.arrbyData,targaMask.BytesPP(),targaMask.Stride(),mask_Channel)
#if PReporting.getIsUltraDebug(): # targaTemp.Save("SpatialForegroundRemover-YUV420-debug3-HEAL-STEP2of2-444-after-overlay.tga")
#
if PReporting.getIsMegaDebug():
bShowDebugCircle=True
if bShowDebugSquare:
DrawDebugSquareTo_fx_buffer()
}#end if bShowDebugSquare
#Console.Error.Write("...")
if bShowDebugCircle:
PReporting.setParticiple("showing debug circle")
DrawDebugCircleTo_fx_buffer()
}#end if bShowDebugCircle
#--DEPRECATED 2010-06: copy non-planar targaTemp (444 or BGR) channels onto vdpixmapDest planes
#CopyNonPlanarToPlane((unsigned char*)vdpixmapDest.data,vdpixmapDest.pitch,HasFullLumaRes,targaTemp.arrbyData,0,targaTemp.BytesPP(),targaTemp.Width(),targaTemp.Height());#CopyNonPlanarToPlane((unsigned char*)vdpixmapDest.data,vdpixmapDest.pitch,bSamplesOnSecondLine,fx_buffer,0,fx_buffer_BytesPP,fx_buffer_w,fx_buffer_h)
#CopyNonPlanarToPlane((unsigned char*)vdpixmapDest.data2,vdpixmapDest.pitch2,bSamplesOnSecondLine,targaTemp.arrbyData,1,targaTemp.BytesPP(),targaTemp.Width(),targaTemp.Height());#CopyNonPlanarToPlane((unsigned char*)vdpixmapDest.data2,vdpixmapDest.pitch2,bSamplesOnSecondLine,fx_buffer,1,fx_buffer_BytesPP,fx_buffer_w,fx_buffer_h)
#CopyNonPlanarToPlane((unsigned char*)vdpixmapDest.data3,vdpixmapDest.pitch3,bSamplesOnSecondLine,targaTemp.arrbyData,2,targaTemp.BytesPP(),targaTemp.Width(),targaTemp.Height());#CopyNonPlanarToPlane((unsigned char*)vdpixmapDest.data3,vdpixmapDest.pitch3,bSamplesOnSecondLine,fx_buffer,2,fx_buffer_BytesPP,fx_buffer_w,fx_buffer_h)
#--NEW 2010-06: copy fx_buffer non-planar channels to vdpixmapDest planes
#Console.Error.WriteLine("SpatialForegroundRemoverFilter.Run: copy channels to video planes...")
PReporting.setParticiple("copying planes")
CopyNonPlanarToPlane((unsigned char*)vdpixmapDest.data,vdpixmapDest.pitch,HasFullLumaRes,fx_buffer,0,fx_buffer_BytesPP,fx_buffer_w,fx_buffer_h);#CopyNonPlanarToPlane((unsigned char*)vdpixmapDest.data,vdpixmapDest.pitch,bSamplesOnSecondLine,fx_buffer,0,fx_buffer_BytesPP,fx_buffer_w,fx_buffer_h)
CopyNonPlanarToPlane((unsigned char*)vdpixmapDest.data2,vdpixmapDest.pitch2,bSamplesOnSecondLine,fx_buffer,1,fx_buffer_BytesPP,fx_buffer_w,fx_buffer_h);#CopyNonPlanarToPlane((unsigned char*)vdpixmapDest.data2,vdpixmapDest.pitch2,bSamplesOnSecondLine,fx_buffer,1,fx_buffer_BytesPP,fx_buffer_w,fx_buffer_h)
CopyNonPlanarToPlane((unsigned char*)vdpixmapDest.data3,vdpixmapDest.pitch3,bSamplesOnSecondLine,fx_buffer,2,fx_buffer_BytesPP,fx_buffer_w,fx_buffer_h);#CopyNonPlanarToPlane((unsigned char*)vdpixmapDest.data3,vdpixmapDest.pitch3,bSamplesOnSecondLine,fx_buffer,2,fx_buffer_BytesPP,fx_buffer_w,fx_buffer_h)
if PReporting.getIsMegaDebug()) Console.Error.WriteLine("Finished case for YUV420Planes-to-RGB in SpatialForegroundRemover":
break
case nsVDXPixmap.kPixFormat_YUV411_Planar:
bSamplesOnSecondLine=True
vdpixmapSource_BytesPP=3
Console.Error.WriteLine("SpatialForegroundRemoverFilter.Run: Using YUV 4:1:1")
HasFullLumaRes=True
CopyPlaneToNonPlanar(fx_buffer, 0, fx_buffer_BytesPP, (unsigned char*)vdpixmapSource.data, vdpixmapSource.pitch, vdpixmapSource.w, vdpixmapSource.h, HasFullLumaRes)
CopyPlaneToNonPlanar(fx_buffer, 1, fx_buffer_BytesPP, (unsigned char*)vdpixmapSource.data2, vdpixmapSource.pitch2, vdpixmapSource.w, vdpixmapSource.h, bSamplesOnSecondLine)
CopyPlaneToNonPlanar(fx_buffer, 2, fx_buffer_BytesPP, (unsigned char*)vdpixmapSource.data3, vdpixmapSource.pitch3, vdpixmapSource.w, vdpixmapSource.h, bSamplesOnSecondLine)
#targaTemp.Init(vdpixmapSource.w,vdpixmapSource.h,targaTemp_BytesPP,True)
#if PReporting.getIsUltraDebug(): # SaveRaw("SpatialForegroundRemover-converted-to-YUV444NonPlanar.raw",(unsigned char*)fx_buffer,fx_buffer_Stride*fx_buffer_h)
# YUV444NonPlanarToRGB((unsigned char*)targaTemp.arrbyData, False, False, fx_buffer, vdpixmapSource.w*vdpixmapSource.h)
# targaTemp.Save("SpatialForegroundRemover-YUV420-debug-YUV411Planes-to-RGB.tga")
# #YUV444NonPlanarToRGB(targaTemp.arrbyData,fx_buffer,targaTemp.BytesBuffer)
#
#TransformY8(vdpixmapDest.data, vdpixmapDest.pitch, vdpixmapDest.w, vdpixmapDest.h, mConfig.mReach)
#sw = (vdpixmapSource.w + 3) >> 2
#sh = vdpixmapSource.h
#TransformY8(vdpixmapDest.data2, vdpixmapDest.pitch2, sw, sh, mConfig.mUScale)
#TransformY8(vdpixmapDest.data3, vdpixmapDest.pitch3, sw, sh, mConfig.mVScale)
break
case nsVDXPixmap.kPixFormat_YUV410_Planar:
bSamplesOnSecondLine=False
vdpixmapSource_BytesPP=3
Console.Error.WriteLine("SpatialForegroundRemoverFilter.Run: Using YUV 4:1:0")
HasFullLumaRes=True
CopyPlaneToNonPlanar(fx_buffer, 0, fx_buffer_BytesPP, (unsigned char*)vdpixmapSource.data, vdpixmapSource.pitch, vdpixmapSource.w, vdpixmapSource.h, HasFullLumaRes)
CopyPlaneToNonPlanar(fx_buffer, 1, fx_buffer_BytesPP, (unsigned char*)vdpixmapSource.data2, vdpixmapSource.pitch2, vdpixmapSource.w, vdpixmapSource.h, bSamplesOnSecondLine)
CopyPlaneToNonPlanar(fx_buffer, 2, fx_buffer_BytesPP, (unsigned char*)vdpixmapSource.data3, vdpixmapSource.pitch3, vdpixmapSource.w, vdpixmapSource.h, bSamplesOnSecondLine)
#targaTemp.Init(vdpixmapSource.w,vdpixmapSource.h,targaTemp_BytesPP,True)
#if PReporting.getIsUltraDebug(): # SaveRaw("debug-SpatialForegroundRemover-converted-to-YUV444NonPlanar.raw",(unsigned char*)fx_buffer,fx_buffer_Stride*fx_buffer_h)
# YUV444NonPlanarToRGB((unsigned char*)targaTemp.arrbyData, False, False, fx_buffer, vdpixmapSource.w*vdpixmapSource.h)
# targaTemp.Save("SpatialForegroundRemover-YUV420-debug-YUV410Planes-to-RGB.tga")
# #YUV444NonPlanarToRGB(targaTemp.arrbyData,fx_buffer,targaTemp.BytesBuffer)
#
#TransformY8(vdpixmapDest.data, vdpixmapDest.pitch, vdpixmapDest.w, vdpixmapDest.h, mConfig.mReach)
#sw = (vdpixmapSource.w + 3) >> 2
#sh = (vdpixmapSource.h + 3) >> 2
#TransformY8(vdpixmapDest.data2, vdpixmapDest.pitch2, sw, sh, mConfig.mUScale)
#TransformY8(vdpixmapDest.data3, vdpixmapDest.pitch3, sw, sh, mConfig.mVScale)
break
case nsVDXPixmap.kPixFormat_YUV422_UYVY:
bSamplesOnSecondLine=True
vdpixmapSource_BytesPP=3
Console.Error.WriteLine("SpatialForegroundRemoverFilter.Run: Using YUV 4:2:2 UYVY")
Console.Error.WriteLine("SpatialForegroundRemoverFilter.Run Error: has not yet implemented YUV422_UYVY")
break
case nsVDXPixmap.kPixFormat_YUV422_YUYV:
bSamplesOnSecondLine=True
vdpixmapSource_BytesPP=3
Console.Error.WriteLine("SpatialForegroundRemoverFilter.Run: Using YUV 4:2:2 YUYV")
Console.Error.WriteLine("SpatialForegroundRemoverFilter.Run Error: has not yet implemented YUV422_YUYV")
break
default:
Console.Error.WriteLine("SpatialForegroundRemoverFilter.Run Error: has not yet implemented less than 24-bit (has only 24- and 32-bit YUV and RGB formats)")
bUnknownPixelFormat=True
break
}#end switch
bGood=True
if (bUnknownPixelFormat) bGood=False
else:
vdpixmapSource_BytesPP=3
cerr<<"SpatialForegroundRemoverFilter.Run: using VirtualDub API less than 12"<<endl
CopySurface_BitdepthSensitive(fx_buffer,fx_buffer_BytesPP,fx_buffer_Stride,(unsigned char*)fa.dst.data,vdpixmapSource_BytesPP,fa.dst.pitch,fa.dst.w,fa.dst.h)
Heal_WithAveraging_Sequential(fx_buffer,fx_buffer_BytesPP,fx_buffer_Stride,targaMask.arrbyData,targaMask.BytesPP(),targaMask.Stride(),mask_Channel,fx_buffer_w,fx_buffer_h,(double)mConfig.mReach,rRadialSampleSpacing,(double)mConfig.mDiffusion)
CopySurface_BitdepthSensitive((unsigned char*)fa.dst.data,vdpixmapSource_BytesPP,fa.dst.pitch,fx_buffer,fx_buffer_BytesPP,fx_buffer_Stride,fx_buffer_w,fx_buffer_h)
#targaTemp.Init(fa.dst.w,fa.dst.h,targaTemp_BytesPP,True)
#if PReporting.getIsUltraDebug(): # CopySurface_BitdepthSensitive((unsigned char*)targaTemp.arrbyData, targaTemp.BytesPP(), targaTemp.Stride(), (unsigned char*)fa.dst.data, vdpixmapSource_BytesPP, fa.dst.pitch, fa.dst.w, fa.dst.h);#YUV444NonPlanarToRGB((unsigned char*)targaTemp.arrbyData, False, False, (unsigned char*)fa.dst.data, fa.dst.h*fa.dst.w)
# targaTemp.Save("SpatialForegroundRemover-RGB(VirtualDub API less than 12)-debug-RGB-to-RGB.tga")
# #YUV444NonPlanarToRGB(targaTemp.arrbyData,fx_buffer,targaTemp.BytesBuffer)
#
bGood=True
catch (exception& exn)
bGood=False
PReporting.ShowExn(exn,"","SpatialForegroundRemover.Run")
catch (...)
bGood=False
PReporting.ShowUnknownExn("","SpatialForegroundRemover.Run")
if PReporting.getIsUltraDebug():
Console.Error.WriteLine((bGood?"OK(SpatialForegroundRemover.Run)":"FAILED(SpatialForegroundRemover.Run)"))
Console.Error.WriteLine("Colorspace Conversion debugging info:")
Console.Error.WriteLine(Convert.ToString("YCToRgb source (byte to float direct cast) range {")
+Convert.ToString("Y:")+Convert.ToString(YCToRgb_fMinY)+"to"+Convert.ToString(YCToRgb_fMaxY)+Convert.ToString("; ")
+Convert.ToString("U:")+Convert.ToString(YCToRgb_fMinU)+"to"+Convert.ToString(YCToRgb_fMaxU)+Convert.ToString("; ")
+Convert.ToString("V:")+Convert.ToString(YCToRgb_fMinV)+"to"+Convert.ToString(YCToRgb_fMaxV)+Convert.ToString("; ")
+"}")
Console.Error.WriteLine(Convert.ToString("YCToRgb destination (float to byte) range {")
+Convert.ToString("r:")+Convert.ToString(YCToRgb_byMinR)+"to"+Convert.ToString(YCToRgb_byMaxR)+Convert.ToString("; ")
+Convert.ToString("g:")+Convert.ToString(YCToRgb_byMinG)+"to"+Convert.ToString(YCToRgb_byMaxG)+Convert.ToString("; ")
+Convert.ToString("b:")+Convert.ToString(YCToRgb_byMinB)+"to"+Convert.ToString(YCToRgb_byMaxB)+Convert.ToString("; ")
+"}")
Console.Error.WriteLine(Convert.ToString("RgbToYC destination (byte to float will be rounded to byte) range {")
+Convert.ToString("y:")+Convert.ToString(RgbToYC_fMinY)+"to"+Convert.ToString(RgbToYC_fMaxY)+Convert.ToString("; ")
+Convert.ToString("u:")+Convert.ToString(RgbToYC_fMinU)+"to"+Convert.ToString(RgbToYC_fMaxU)+Convert.ToString("; ")
+Convert.ToString("v:")+Convert.ToString(RgbToYC_fMinV)+"to"+Convert.ToString(RgbToYC_fMaxV)+Convert.ToString("; ")
+"}")
if (PReporting.getIsMegaDebug()) cerr<<endl<<endl
return
}#end SpatialForegroundRemoverFilter.Run
def Configure(self, hwnd):
SpatialForegroundRemoverFilterDialog dlg(mConfig, fa.ifp)
return dlg.Show((HWND)hwnd)
def GetSettingString(self, *buf, maxlen):
SafePrintf(buf, maxlen, " (Reach%.1f%%, RSamples%.1f%%, Diffusion%.1f%%)"
, mConfig.mReach * 100.0f
, mConfig.mRadialSamples * 100.0f
, mConfig.mDiffusion * 100.0f
)
def GetScriptString(self, *buf, maxlen):
SafePrintf(buf, maxlen, "Config(%u, %u, %u)"
, (unsigned)(mConfig.mReach * 1000.0f + 0.5f)
, (unsigned)(mConfig.mRadialSamples * 1000.0f + 0.5f)
, (unsigned)(mConfig.mDiffusion * 1000.0f + 0.5f)
)
def ScriptConfig(self, *isi, *argv, argc):
mConfig.mReach = argv[0].asInt() / 1000.0f
mConfig.mRadialSamples = argv[1].asInt() / 1000.0f
mConfig.mDiffusion = argv[2].asInt() / 1000.0f
def CTBufferInit(self, int w, int h, int BytesPP):
self.fx_buffer_BytesPP=BytesPP
self.fx_buffer_h=h
self.fx_buffer_w=w
self.fx_buffer_Stride=self.fx_buffer_BytesPP*self.fx_buffer_w
if (self.fx_buffer==NULL:
or (self.fx_buffer_BytesTotal!=(self.fx_buffer_h*self.fx_buffer_Stride)) )
if self.fx_buffer!=NULL:
free(self.fx_buffer)
self.fx_buffer=NULL
self.fx_buffer_BytesTotal=self.fx_buffer_h*self.fx_buffer_Stride
self.fx_buffer=(unsigned char*)malloc(self.fx_buffer_BytesTotal)
}#end CTBufferInit
#######################################/
extern filterDef_SpatialForegroundRemover = VDXVideoFilterDefinition<SpatialForegroundRemoverFilter>("ProtoArmor", "Spatial Foreground Remover", "Removes the destination's foreground at pixels that are non-zero in the specified mask by gathering information from the surrounding destination pixels where mask's pixel value is zero.")

86
utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/f_spatialforegroundremover.h.py

@ -0,0 +1,86 @@
#ifndef F_SPATIALFOREGROUNDREMOVER_H
#define F_SPATIALFOREGROUNDREMOVER_H
#include <cstdio>
#include <string>
#include "targa.h"
#include "colorspacetransform.h"
using namespace std
using namespace ProtoArmor
class SpatialForegroundRemoverFilterConfig
public:
SpatialForegroundRemoverFilterConfig()
: mReach(1.0f)
, mRadialSamples(1.0f)
, mDiffusion(1.0f)
public:
float mReach
float mRadialSamples
float mDiffusion
#######################################/
class SpatialForegroundRemoverFilterDialog : public VDXVideoFilterDialog
public:
SpatialForegroundRemoverFilterDialog(SpatialForegroundRemoverFilterConfig& config, *ifp) : mConfig(config), mifp(ifp) {
bool Show(HWND parent)
return 0 != VDXVideoFilterDialog.Show(NULL, MAKEINTRESOURCE(IDD_FILTER_SPATIALFOREGROUNDREMOVER), parent)
virtual INT_PTR DlgProc(UINT msg, wParam, lParam)
protected:
bool OnInit()
bool OnCommand(int cmd)
void OnDestroy()
void LoadFromConfig()
bool SaveToConfig()
SpatialForegroundRemoverFilterConfig& mConfig
SpatialForegroundRemoverFilterConfig mOldConfig
IVDXFilterPreview * mifp
#######################################/
class SpatialForegroundRemoverFilter : public VDXVideoFilter
public:
virtual uint32 GetParams()
virtual void Start()
virtual void Run()
virtual bool Configure(VDXHWND hwnd)
virtual void GetSettingString(char *buf, maxlen)
virtual void GetScriptString(char *buf, maxlen)
VDXVF_DECLARE_SCRIPT_METHODS()
~SpatialForegroundRemoverFilter()
private:
Targa targaTemp
Targa targaMask
void DrawDebugCircleTo_fx_buffer()
void DrawDebugSquareTo_fx_buffer()
protected:
unsigned int fx_buffer_w
unsigned int fx_buffer_h
unsigned int fx_buffer_BytesPP
unsigned int fx_buffer_Stride
unsigned int fx_buffer_BytesTotal
unsigned char* fx_buffer
void ScriptConfig(IVDXScriptInterpreter *isi, *argv, argc)
void CTBufferInit(unsigned int w, int h, int BytesPP)
SpatialForegroundRemoverFilterConfig mConfig
#endif

7
utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/main.cpp.py

@ -0,0 +1,7 @@
#include <vd2/VDXFrame/VideoFilterEntry.h>
VDX_DECLARE_VIDEOFILTERS_BEGIN()
VDX_DECLARE_VIDEOFILTER(filterDef_SpatialForegroundRemover)
VDX_DECLARE_VIDEOFILTERS_END()
VDX_DECLARE_VFMODULE()

274
utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/pimage.cpp.py

@ -0,0 +1,274 @@
#ifndef PIMAGE_CPP
#define PIMAGE_CPP
#include "pimage.h"
#include "pmath.h"
namespace ProtoArmor
bool PImage.bPushToNearest_ShowMaskChannelError=True
bool PImage.bPushToNearestNondirectional_ShowMaskChannelError=True
#/<summary>
#/Returns nearest pixel where channel mask_Channel is outside mask_Threshold
#/xStart, should normally be a pixel center (will be rounded to find pixel location)
#/(nondirectional overload)
#/</summary>
#/<param name="xStart"></param>
#/<param name="yStart"></param>
#/<return>returns False if edge was found before a near pixel was found</return>
def PushToNearest(self, xStart, yStart, mask, int mask_w, int mask_h, int mask_BytesPP, int mask_Stride, int mask_Channel, mask_Threshold, bGreaterThanThreshold_FalseForLessThan):
bool bFound=False
if mask_Channel>=mask_BytesPP:
if bPushToNearestNondirectional_ShowMaskChannelError:
Console.Error.WriteLine("PushToNearest [nondirectional version] error: channel index "+Convert.ToString(mask_Channel)+" (starting from 0) does not exist in "+Convert.ToString(mask_BytesPP*8)+"-bit ("+Convert.ToString(mask_BytesPP)+" bytes per pixel) image--last channel will be used. This message will only be shown once")
bPushToNearestNondirectional_ShowMaskChannelError=False
mask_Channel=mask_BytesPP-1
#double closest_Dist=DBL_MAX
#double closest_X=-1
#double closest_Y=-1
double mask_rH=(double)mask_h
double mask_rW=(double)mask_w
double pointNow_Dist=-1.0
#unsigned int uiLoc
#unsigned int uiLineLoc=mask_Channel
double rRadNow=0.0
double rRadMax=0.0
double dAbsNow;#just for caching Abs method result
#NOTE: Since checks distance to all corners,
# still works if xStart, is outside of image.
dAbsNow=PMath.Dist(xStart,yStart,0.0,0.0)
if (dAbsNow>rRadMax) rRadMax=dAbsNow
dAbsNow=PMath.Dist(xStart,yStart,0.0,mask_rH)
if (dAbsNow>rRadMax) rRadMax=dAbsNow
dAbsNow=PMath.Dist(xStart,yStart,mask_rW,0.0)
if (dAbsNow>rRadMax) rRadMax=dAbsNow
dAbsNow=PMath.Dist(xStart,yStart,mask_rW,mask_rH)
if (dAbsNow>rRadMax) rRadMax=dAbsNow
double rDegPerPix
double rAngleNow
double xNow=xStart
double yNow=yStart
unsigned int xRound=(unsigned int)(xNow+.5)
unsigned int yRound=(unsigned int)(yNow+.5)
if not (xRound<0orxRound>=mask_woryRound<0oryRound>=mask_h):
if ( bGreaterThanThreshold_FalseForLessThan
? (mask[yRound*mask_Stride+xRound*mask_BytesPP+mask_Channel]>mask_Threshold)
: (mask[yRound*mask_Stride+xRound*mask_BytesPP+mask_Channel]<mask_Threshold) )
xStart=(double)xRound
yStart=(double)yRound
bFound=True
double rRadAdd=.5
if ( ((double)xRound!=xStart) or ((double)yRound!=yStart) ) rRadAdd=.25; #in case start is on border
#unsigned int xRoundPrev=0
#unsigned int yRoundPrev=-1
if not bFound:
for (rRadNow=rRadAdd; rRadNow<=rRadMax; rRadNow+=rRadAdd)
rDegPerPix=PMath.DegreesPerPixelAt(rRadNow)
if rDegPerPix>0.0:
for (rAngleNow=0.0; rAngleNow<360.0; rAngleNow+=rDegPerPix)
xNow=xStart+PMath.XOfRThetaDeg(rRadNow,rAngleNow)
yNow=yStart+PMath.YOfRThetaDeg(rRadNow,rAngleNow)
xRound=(unsigned int)(xNow+.5)
yRound=(unsigned int)(yNow+.5)
if not (xRound<0orxRound>=mask_woryRound<0oryRound>=mask_h):
if ( bGreaterThanThreshold_FalseForLessThan
? (mask[yRound*mask_Stride+xRound*mask_BytesPP+mask_Channel]>mask_Threshold)
: (mask[yRound*mask_Stride+xRound*mask_BytesPP+mask_Channel]<mask_Threshold) )
xStart=(double)xRound
yStart=(double)yRound
bFound=True
break
}#end if match (outside threshold)
}#end if in range
}#end for rAngleNow
}#end if rDegPerPix>0.0
else:
if PReporting.getIsMegaDebug()) Console.Error.WriteLine("PushToClosest error: rDegPerPix too small {rDegPerPix"+Convert.ToString(rDegPerPix)+"}":
if (bFound) break
}#end for rRadNow
}#end if not matched (i.e. if not already on the pixel)
'''
for (double y=0; y<mask_rH; y+=1.0) uiLoc=uiLineLoc
for (double x=0; x<mask_rW; x+=1.0) if ( bGreaterThanThreshold_FalseForLessThan
? (mask[uiLoc]>mask_Threshold)
: (mask[uiLoc]<mask_Threshold) ) pointNow_Dist=PMath.Dist(x,y,xStart,yStart)
if pointNow_Dist<closest_Dist: closest_Dist=pointNow_Dist
closest_X=x
closest_X=y
bFound=True
}#end if outside threshold color
uiLoc+=mask_BytesPP
}#end for x
uiLineLoc+=mask_Stride
}#end for y
if bFound: xStart=closest_X
yStart=closest_Y
'''
return bFound
}#end PushToNearest nondirectional version
#/<summary>
#/Returns nearest pixel where channel mask_Channel is outside mask_Threshold,
#only looking at pixels on the line at the given angle rDirection_Deg
#/xStart, should normally be a pixel center (will be rounded to find pixel location)
#/; directional overload; does not work with out-of-range starting point (checked after rounding)
#/</summary>
#/<param name="xStart"></param>
#/<param name="yStart"></param>
#/<return>returns False if edge was found before a near pixel was found</return>
def PushToNearest(self, xStart, yStart, rDirection_Deg, mask, int mask_w, int mask_h, int mask_BytesPP, int mask_Stride, int mask_Channel, mask_Threshold, bGreaterThanThreshold_FalseForLessThan):
bool bFound=False
if mask_Channel>=mask_BytesPP:
if bPushToNearest_ShowMaskChannelError:
Console.Error.WriteLine("PushToNearest(...,direction,...): error, index "+Convert.ToString(mask_Channel)+" (starting from 0) does not exist in "+Convert.ToString(mask_BytesPP*8)+"-bit ("+Convert.ToString(mask_BytesPP)+" bytes per pixel) image--last channel will be used. This message will only be shown once")
bPushToNearest_ShowMaskChannelError=False
mask_Channel=mask_BytesPP-1
#double xStart, yStart, rDirection_Deg
#byte* mask
#uint mask_w, mask_h
#uint mask_BytesPP
#uint mask_Stride
#uint mask_Channel
#byte mask_Threshold #mask_Needlean
double dSubsampleSpacing=.125;#not 1 since could be intersecting pixels at any point (.125 is 8x subsampling)
#use int to avoid out-of-range starting point
int ixStart
int iyStart
unsigned int uiLoc
int mask_iW=(int)mask_w
int mask_iH=(int)mask_h
do
ixStart=(int)(xStart+.5); #+.5 for rounding
iyStart=(int)(yStart+.5); #+.5 for rounding
if (ixStart<0 or ixStart>=mask_iW or iyStart<0 or iyStart>=mask_iH) break
#if ixStart>=0 and ixStart<mask_iW and iyStart>=0 and iyStart<mask_iH: uiLoc=iyStart*mask_Stride+ixStart*mask_BytesPP+mask_Channel
if ( bGreaterThanThreshold_FalseForLessThan
?(mask[uiLoc]>mask_Threshold)
:(mask[uiLoc]<mask_Threshold) )
bFound=True
break
#
#else break
PMath.Travel2d(xStart,yStart,rDirection_Deg,dSubsampleSpacing)
while (not bFound)
return bFound
}#end PushToNearest
#/<summary>
#/Draws to src0 to dest0 at (xDestStart,yDestStart) using mask0 as alpha for source
#--alpha is neither modified on dest0 nor used from src0
#/</summary>
#/<param name="mask0">must be same size as source</param>
def Draw(self, char* dest0, xDestStart, yDestStart, int dest_w, int dest_h, int dest_BytesPP, int dest_Stride, char* src0, int src_w, int src_h, int src_BytesPP, int src_Stride, char* mask0, int mask_BytesPP, int mask_Stride, int mask_Channel):
bool bGood=True
try
if (PReporting.getIsMegaDebug()) cerr<<"Draw(dest,...,src,...,mask,...)..."<<flush
unsigned int xSrcStart=0
unsigned int ySrcStart=0
if xDestStart<0:
xSrcStart=0-xDestStart
xDestStart=0
if yDestStart<0:
ySrcStart=0-yDestStart
yDestStart=0
unsigned int xSrc=xSrcStart
unsigned int ySrc=ySrcStart
unsigned int xDest=xDestStart
unsigned int yDest=yDestStart
float rCookedAlpha
unsigned int iSrcChan
unsigned int iDestChan
#unsigned int Debug_PixelsDone=0;#debug only
if dest0!=null:
if src0!=null:
if mask0!=null:
if (xDestStart>=0 and xDestStart<dest_w and yDestStart>=0 and yDestStart<dest_h
and xSrc>=0 and xSrc<src_w and ySrc>=0 and ySrc<src_w)
unsigned char* destLineLoc=&dest0[yDestStart*dest_Stride+xDestStart*dest_BytesPP]
unsigned char* srcLineLoc=&src0[ySrc*src_Stride+xSrc*src_BytesPP]
unsigned char* maskLineLoc=&mask0[mask_Channel+ySrc*mask_Stride+xSrc*mask_BytesPP]
unsigned char* destLoc
unsigned char* srcLoc
unsigned char* maskLoc
for (yDest=yDestStart; yDest<dest_h and ySrc<src_h; yDest++)
destLoc=destLineLoc
srcLoc=srcLineLoc
maskLoc=maskLineLoc
xSrc=xSrcStart
for (xDest=xDestStart; xDest<dest_w and xSrc<src_w; xDest++)
rCookedAlpha=(float)*maskLoc/255.0f
float rCookedInverseAlpha=1.0f-rCookedAlpha
iSrcChan=0
for (iDestChan=0; iDestChan<dest_BytesPP; iDestChan++)
#alpha formula: (src-dest)*alpharatio+dest
#for each channel of dest (<3 excludes alpha)
if iDestChan<3:
*destLoc=PMath.ByRound( (float)( (float)(*srcLoc-*destLoc)*rCookedAlpha + (float)*destLoc ) )
#*destLoc=PMath.ByRound( (float)( rCookedInverseAlpha*(float)*destLoc + rCookedAlpha*(float)*srcLoc ) )
if iSrcChan<src_BytesPP:
iSrcChan++
srcLoc++
destLoc++
while (iSrcChan<src_BytesPP)
iSrcChan++
srcLoc++
maskLoc+=mask_BytesPP; #does NOT need to be incremented during pixel above since only 1 channel is needed
xSrc++
#Debug_PixelsDone++
}#end for xDest while xDest&sSrc both in range
destLineLoc+=dest_Stride
srcLineLoc+=src_Stride
maskLineLoc+=mask_Stride
ySrc++
}#end for yDest while yDest*ySrc both in range
if (PReporting.getIsMegaDebug()) Console.Error.WriteLine((string)"OK ("
#+"Debug_PixelsDone:"+Convert.ToString(Debug_PixelsDone)
+"; xDestStart:"+Convert.ToString(xDestStart)
+"; yDestStart:"+Convert.ToString(yDestStart)
+"; xDest:"+Convert.ToString(xDest)
+"; yDest:"+Convert.ToString(yDest)
+"; dest_w:"+Convert.ToString(dest_w)
+"; dest_h:"+Convert.ToString(dest_h)
+"; xSrcStart:"+Convert.ToString(xSrcStart)
+"; ySrcStart:"+Convert.ToString(ySrcStart)
+"; xSrc:"+Convert.ToString(xSrc)
+"; ySrc:"+Convert.ToString(ySrc)
+"; src_w:"+Convert.ToString(src_w)
+"; src_h:"+Convert.ToString(src_h)
+(string)")")
}#end if any pixels within range
else:
if PReporting.getIsMegaDebug():
Console.Error.WriteLine("Draw(dest,...,src,...,mask,...): no pixels within range")
else Console.Error.WriteLine("Draw using mask buffer Error: null mask for source")
else Console.Error.WriteLine("Draw using mask buffer Error: null source")
else Console.Error.WriteLine("Draw using mask buffer Error: null destination")
catch (exception& exn)
bGood=False
PReporting.ShowExn(exn,"drawing using mask buffer","PImage.Draw")
return bGood
}#end Draw using mask buffer
}#end namespace
#endif

21
utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/pimage.h.py

@ -0,0 +1,21 @@
#ifndef PIMAGE_H
#define PIMAGE_H
#include <string>
#include "preporting.h"
#include "frameworkdummy.h"
using namespace std
namespace ProtoArmor
class PImage
public:
static bool bPushToNearest_ShowMaskChannelError
static bool bPushToNearestNondirectional_ShowMaskChannelError
static bool PushToNearest(double& xStart, yStart, mask, int mask_w, int mask_h, int mask_BytesPP, int mask_Stride, int mask_Channel, mask_Threshold, bGreaterThanThreshold_FalseForLessThan)
static bool PushToNearest(double& xStart, yStart, rDirection_Deg, mask, int mask_w, int mask_h, int mask_BytesPP, int mask_Stride, int mask_Channel, mask_Threshold, bGreaterThanThreshold_FalseForLessThan)
static bool Draw(unsigned char* dest0, xDestStart, yDestStart, int dest_w, int dest_h, int dest_BytesPP, int dest_Stride, char* src0, int src_w, int src_h, int src_BytesPP, int src_Stride, char* mask0, int mask_BytesPP, int mask_Stride, int mask_Channel)
}#end namespace
#endif

39
utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/pstring.cpp.py

@ -0,0 +1,39 @@
#ifndef PSTRING_CPP
#define PSTRING_CPP
#include "pstring.h"
using namespace std
namespace ProtoArmor
char PString.carrDigit[]= {'0','1','2','3','4','5','6','7','8','9'}; #char carrDigit[10]
'''
PString.carrDigit[0]='0'
PString.carrDigit[1]='1'
PString.carrDigit[2]='2'
PString.carrDigit[3]='3'
PString.carrDigit[4]='4'
PString.carrDigit[5]='5'
PString.carrDigit[6]='6'
PString.carrDigit[7]='7'
PString.carrDigit[8]='8'
PString.carrDigit[9]='9'
'''
def SequenceDigits(self, val, iMinDigits):
string sReturn=Convert.ToString(val)
while ((int)sReturn.length()<iMinDigits) sReturn="0"+sReturn
return sReturn
}#end SequenceDigits
def IsDigit(self, val):
bool bReturn=False
for (int i=0; i<=9; i++)
if val==PString.carrDigit[i]:
bReturn=True
break
return bReturn
}#end IsDigit
}#end namespace
#endif

21
utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/pstring.h.py

@ -0,0 +1,21 @@
#ifndef PSTRING_H
#define PSTRING_H
#include <cstdio>
#include <string>
#include <iostream>
#include "frameworkdummy.h"
using namespace std
namespace ProtoArmor
class PString
public:
#static char carrDigit[10]
static char carrDigit[]
static string SequenceDigits(int val, iMinDigits)
static bool IsDigit(char val)
}#end namespace
#endif

1256
utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/targa--nondotnet/targa.cpp.py

File diff suppressed because it is too large

131
utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/targa--nondotnet/targa.h.py

@ -0,0 +1,131 @@
#ifndef TARGA_H
#define TARGA_H
#include <iostream>
#include <iomanip>
#include <fstream>
#include <memory>
#include "frameworkdummy.h"
using namespace std
namespace ProtoArmor
#Sequential targa.TypeTarga values:
TypeNoImageData = 0
TypeUncompressedColorMapped = 1
TypeUncompressedTrueColor = 2
TypeUncompressedGrayscale = 3
TypeCompressedColorMapped = 9
TypeCompressedTrueColor = 10
TypeCompressedGrayscale = 11
TypeCompressedColorMappedHuffmanAndDeltaAndRLE = 32
TypeCompressedColorMappedHuffmanAndDeltaAndRLE4PassQuadTree = 33
#Sequential targa.MapType values
MapType256 = 1
#targa.bitsDescriptor bits:
lownibble565Or888NoAlpha = 0; #bit3
lownibbleAlpha5551 = 1; #bit3 #TODO: read GGGBBBBB ARRRRRGG since targa is always low-high (little endian)
lownibbleAlpha8888 = 8; #bit3
bitReserved4 = 16; #bit4
bitNoFlip_NonTruevision = 32; #bit5 #Truevision is a registered trademark of Truevision
bitInterleave4Way = 64; #bit6
bitInterleave2Way = 128; #bit7
##region prototypes
def RLESizeUncompressed(self, arrbySrc, iStart, iSrcSize, iBytesPerChunk):
def Compare(self, arrbySrc1, iSrcLoc1, arrbySrc2, iSrcLoc2, iRun):
def RLECompress(self, iReturnLength, arrbySrc, iSrcStart, iBytesPerChunk, iBytesToParse, bCountOnlyAndReturnNull):
def RLECompress(self, iReturnLength, arrbySrc, iSrcStart, iBytesPerChunk, iBytesToParse):
def RLEUncompress(self, iReturnLength, arrbySrc, iSrcStart, iBytesPerChunk, iBytesToParse, bCountOnlyAndReturnNull):
def RLEUncompress(self, iReturnLength, arrbySrc, iSrcStart, iBytesPerChunk, iBytesToParse):
def RLEUncompress(self, arrbyDest, iDestSize, arrbySrc, iSrcSize, iBytesPerChunk):
def RLEUncompress(self, arrbyDest, iDestSizeIrrelevantIfCountOnlyIsTrue, arrbySrc, iSrcSize, iBytesPerChunk, iDestStart, iSrcStart, bCountOnlyAndDontTouchDest):
##region TargaFooter
class TargaFooter
private:
byte *dump
uint u32SizeofDump
public:
TargaFooter()
TargaFooter(byte* lpbyDataPointerToKeep, u32Size)
TargaFooter(byte* arrbyDataSrcToCopyFrom, u32Start, u32Count, u32ActualSourceBufferSize)
~TargaFooter()
bool Init()
bool Init(byte* lpbyDataPointerToKeep, u32Size)
bool Init(FILE* fileNowToReadToEnd)
bool Init(byte* arrbyDataSrc, u32SrcStart, u32Count, u32ActualSourceBufferSize)
int TargaFooter.WriteTo(FILE* pfileAlreadyOpen_ToNotCloseInThisMethod)
int WriteTo(char* byarrDest, iAtDest, iSizeOfDest)
uint ByteCount()
##endregion TargaFooter
##endregion prototypes
class Targa
public:
string sFile
TargaFooter footer
byte *arrbyData
Targa()
~Targa()
int BytesPP()
int Stride()
int BytesAsUncompressed()
int BytesBuffer()
bool Init(int iSetWidth, iSetHeight, iSetBytesPP, bReallocateBuffers)
bool CopyTo(Targa &targaDest)
bool DrawFast(byte* arrbyDest, xAtDest, yAtDest, iDestWidth, iDestHeight, iDestBytesPP, iDestStride)
void ToRect(ref_Rectangle rectReturn)
void ToRect(ref_RectangleF rectReturn)
bool From(int iWidthTo, iHeightTo, iBytesPP, arrbySrc, bUsePointerNotCopyData)
bool From(int iWidthTo, iHeightTo, iBytesPP, arrbySrc, bUsePointerNotCopyData, u32SrcStart)
int SafeCopyFrom(int iWidthTo, iHeightTo, iBytesPP, arrbySrc, u32SrcRealLen)
int SafeCopyFrom(int iWidthTo, iHeightTo, iBytesPP, arrbySrc, u32SrcRealLen, bReInitializeAll)
int SafeCopyFrom(int iWidthTo, iHeightTo, iBytesPP, arrbySrc, u32SrcRealLen, u32SrcStart, bReInitializeAll)
#int SafeCopyFrom(int iWidthTo, iHeightTo, iBytesPP, fileNow, u32SrcRealLen)
int SafeCopyFrom(int iWidthTo, iHeightTo, iBytesPP, fileNow, bReInitializeAll)
#int SafeCopyFrom(int iWidthTo, iHeightTo, iBytesPP, fileNow, u32SrcStart, bReInitializeAll)
byte* GetBufferPointer()
bool IsLoaded()
bool Save()
bool Save(string sFileNow)
bool Load(string sFileNow)
bool IsOK()
bool Flip()
bool HasAttrib(byte bit)
bool IsSavedAsFlipped()
bool IsCompressed()
bool SetCompressionRLE(bool bOn)
string Dump()
string Dump(bool bDumpFull)
string Description()
string Description(bool bVerbose)
private:
void DeriveVars()
void InitNull()
bool MarkAsCompressed(bool bAsCompressed)
#header:
#(byte)(length of id),(byte)(int)MapType,(byte)(int)TypeTarga,(ushort)iMapOrigin,(ushort)iMapLength,(byte)iMapBitDepth,(ushort)xImageLeft,(ushort)yImageBottom,(ushort)iWidth,(ushort)iHeight,(byte)iBitDepth,(byte)bitsDescriptor,(byte[length of id])sID,(byte[iMapLength])(arrbyColorMap),(byte[iBytesAsUncompressed])(arrbyData)
#int iIDLength; #1 byte implied (length of sID)
int MapType; #1 byte
int TypeTarga; #1 byte
int iMapOrigin; #2 bytes
int iMapLength; #2 bytes
int iMapBitDepth; #1 byte
int xImageLeft; #2 bytes
int yImageBottom; #2 bytes #TODO: don't flip if not zero
int iWidth; #2 bytes
int iHeight; #2 bytes
int iBitDepth; #1 byte #TODO: 16 is 5.5.5.1 (not !not )IF(not !not ) low nibble of descriptor is 1 (otherwise 5.6.5 and descriptor low nibble is zero)
byte bitsDescriptor; #1 byte #(default zero)
string sID; #array of [iTagLength] bytes #[bySizeofID] -- custom non-terminated string
byte *arrbyColorMap; #array of [] bytes #[byMapBitDepth*wMapLength] -- the palette
#arrbyData
#derived fields:
int iBytesPP
int iStride
int iBytesAsUncompressed;#byte sizeof image data only
int iBytesBuffer
};#end class Targa
}#end namespace
#endif

1390
utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/targa.cpp.py

File diff suppressed because it is too large

151
utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/targa.h.py

@ -0,0 +1,151 @@
#ifndef TARGA_H
#define TARGA_H
#include <iostream>
#include <iomanip>
#include <fstream>
#include <memory>
#include "frameworkdummy.h"
#include "pmemory.h"
#include "preporting.h"
using namespace std
namespace ProtoArmor
#Sequential targa.TypeTarga values:
TypeNoImageData = 0
TypeUncompressedColorMapped = 1
TypeUncompressedTrueColor = 2
TypeUncompressedGrayscale = 3
TypeCompressedColorMapped = 9
TypeCompressedTrueColor = 10
TypeCompressedGrayscale = 11
TypeCompressedColorMappedHuffmanAndDeltaAndRLE = 32
TypeCompressedColorMappedHuffmanAndDeltaAndRLE4PassQuadTree = 33
#Sequential targa.MapType values
MapType256 = 1
#targa.bitsDescriptor low nibble sequential values:
lownibble565Or888NoAlpha = 0; #bits 0-3
lownibbleAlpha5551 = 1; #bits 0-3 #TODO: read GGGBBBBB ARRRRRGG since targa is always low-high (little endian)
lownibbleAlpha8888 = 8; #bits 0-3
#targa.bitsDescriptor bits:
bitReserved4 = 16; #bit4
bitNoFlip_NonTruevision = 32; #bit5 #Truevision is a registered trademark of Truevision
bitInterleave4Way = 64; #bit6 (of 0 to 7)
bitInterleave2Way = 128; #bit7 (highest bit)
##region prototypes
def RLESizeUncompressed(self, arrbySrc, iStart, iSrcSize, iBytesPerChunk):
def Compare(self, arrbySrc1, iSrcLoc1, arrbySrc2, iSrcLoc2, iRun):
def RLECompress(self, iReturnLength, arrbySrc, iSrcStart, iBytesPerChunk, iBytesToParse, bCountOnlyAndReturnNull):
def RLECompress(self, iReturnLength, arrbySrc, iSrcStart, iBytesPerChunk, iBytesToParse):
def RLEUncompress(self, iReturnLength, arrbySrc, iSrcStart, iBytesPerChunk, iBytesToParse, bCountOnlyAndReturnNull):
def RLEUncompress(self, iReturnLength, arrbySrc, iSrcStart, iBytesPerChunk, iBytesToParse):
def RLEUncompress(self, arrbyDest, iDestSize, arrbySrc, iSrcSize, iBytesPerChunk):
def RLEUncompress(self, arrbyDest, iDestSizeIrrelevantIfCountOnlyIsTrue, arrbySrc, iSrcSize, iBytesPerChunk, iDestStart, iSrcStart, bCountOnlyAndDontTouchDest):
##endregion prototypes
##region TargaFooter
class TargaFooter
private:
byte *dump
uint dump_Length
public:
TargaFooter()
TargaFooter(byte* lpbyDataPointerToKeep, u32Size)
TargaFooter(byte* arrbyDataSrcToCopyFrom, u32Start, u32Count, u32ActualSourceBufferSize)
~TargaFooter()
bool Init()
bool Init(BinaryReader& streamIn_ToReadToEnd)
bool Init(byte* lpbyDataPointerToKeep, u32Size)
bool Init(byte* arrbyDataSrc, u32SrcStart, u32Count, u32ActualSourceBufferSize)
bool WriteTo(BinaryWriter &streamOut)
uint ByteCount()
##endregion TargaFooter
class Targa
public:
string sFile
TargaFooter footer
byte *arrbyData
Targa()
~Targa()
int Width()
int Height()
int BytesPP()
int Stride()
int BytesAsUncompressed()
int BytesBuffer()
bool Init(int iSetWidth, iSetHeight, iSetBytesPP, bReallocateBuffers)
bool CopyTo(Targa &targaDest)
bool DrawFast(byte* arrbyDest, xAtDest, yAtDest, iDestWidth, iDestHeight, iDestBytesPP, iDestStride)
void ToRect(ref_Rectangle rectReturn)
void ToRect(ref_RectangleF rectReturn)
bool From(int iWidthTo, iHeightTo, iBytesPP, arrbySrc, bUsePointerNotCopyData)
bool From(int iWidthTo, iHeightTo, iBytesPP, arrbySrc, bUsePointerNotCopyData, u32SrcStart)
int SafeCopyFrom(int iWidthTo, iHeightTo, iBytesPP, &streamIn, bReInitializeAll)
int SafeCopyFrom(int iWidthTo, iHeightTo, iBytesPP, arrbySrc, u32SrcRealLen)
int SafeCopyFrom(int iWidthTo, iHeightTo, iBytesPP, arrbySrc, u32SrcRealLen, bReInitializeAll)
int SafeCopyFrom(int iWidthTo, iHeightTo, iBytesPP, arrbySrc, u32SrcRealLen, u32SrcStart, bReInitializeAll)
byte* GetBufferPointer()
bool IsLoaded()
bool Save()
bool Save(string sFileNow)
bool Load(string sFileNow)
bool IsOK()
bool Flip()
bool HasAttrib(byte bit)
bool IsSavedAsFlipped()
bool IsCompressed()
bool SetCompressionRLE(bool bOn)
string Dump()
string Dump(bool bDumpFull)
string Description()
string Description(bool bVerbose)
void Reflect(int& x, y)
void Wrap(int& x, y)
int getChannel_Fast(int x, y, iChan)
int getChannelReflected(int x, y, iChan)
void getColorRgbReflected(byte& R, G, B, x, y)
void getColorArgbReflected(byte& A, R, G, B, x, y)
void getColorRgb_Fast(byte& R, G, B, x, y)
void getColorArgb_Fast(byte& A, R, G, B, x, y)
private:
void DeriveVars()
void InitNull()
bool MarkAsCompressed(bool bAsCompressed)
#header:
#(byte)(length of id),(byte)(int)MapType,(byte)(int)TypeTarga,(ushort)iMapOrigin,(ushort)iMapLength,(byte)iMapBitDepth,(ushort)xImageLeft,(ushort)yImageBottom,(ushort)iWidth,(ushort)iHeight,(byte)iBitDepth,(byte)bitsDescriptor,(byte[length of id])sID,(byte[iMapLength])(arrbyColorMap),(byte[iBytesAsUncompressed])(arrbyData)
#int iIDLength; #1 byte implied (length of sID)
int MapType; #1 byte
int TypeTarga; #1 byte
int iMapOrigin; #2 bytes
int iMapLength; #2 bytes
int iMapBitDepth; #1 byte
int xImageLeft; #2 bytes
int yImageBottom; #2 bytes #TODO: don't flip if not zero
int iWidth; #2 bytes
int iHeight; #2 bytes
int iBitDepth; #1 byte #TODO: 16 is 5.5.5.1 (not !not )IF(not !not ) low nibble of descriptor is 1 (otherwise 5.6.5 and descriptor low nibble is zero)
#/<summary>
#/Bits 0-3: number of bits of the pixel that are the alpha channel (i.e. 8 for BGRA32 or 1 for 5551 or 0 for BGRx32)
#/Bit 4: reserved
#/Bit 5: screen origin -- {0:lower left; 1:upper left} usually 0
#/Bits 7-6: interleaving nibble {00:non-interleaved; 01:even-odd; 10:four way; 11: reserved
#/</summary>
byte bitsDescriptor; #1 byte #(usually zero; 17th byte)
string sID; #array of [iTagLength] bytes #[bySizeofID] -- custom non-terminated string
byte *arrbyColorMap; #array of [] bytes #[byMapBitDepth*wMapLength] -- the palette
#arrbyData
#derived fields:
int iBytesPP
int iStride
int iBytesAsUncompressed;#byte sizeof image data only
int iBytesBuffer
}#end namespace
#endif

33
utilities/gimp/SpatialForegroundRemover-python/src/VDXFrame/include/stdafx.h.py

@ -0,0 +1,33 @@
# VDXFrame - Helper library for VirtualDub plugins
# Copyright (C) 2008 Avery Lee
#
# The plugin headers in the VirtualDub plugin SDK are licensed differently
# differently than VirtualDub and the Plugin SDK themselves. This
# particular file is thus licensed as follows (the "zlib" license):
#
# This software is provided 'as-is', any express or implied
# warranty. In no event will the authors be held liable for any
# damages arising from the use of self software.
#
# Permission is granted to anyone to use self software for any purpose,
# including commercial applications, to alter it and redistribute it
# freely, to the following restrictions:
#
# 1. The origin of self software must not be misrepresented; you must
# not claim that you wrote the original software. If you use self
# software in a product, acknowledgment in the product
# documentation would be appreciated but is not required.
# 2. Altered source versions must be plainly marked as such, must
# not be misrepresented as being the original software.
# 3. This notice may not be removed or altered from any source
# distribution.
#define _CRT_SECURE_NO_DEPRECATE
#define _CRT_SECURE_NO_WARNINGS
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <windows.h>

220
utilities/gimp/SpatialForegroundRemover-python/src/VDXFrame/source/VideoFilter.cpp.py

@ -0,0 +1,220 @@
# VDXFrame - Helper library for VirtualDub plugins
# Copyright (C) 2008 Avery Lee
#
# The plugin headers in the VirtualDub plugin SDK are licensed differently
# differently than VirtualDub and the Plugin SDK themselves. This
# particular file is thus licensed as follows (the "zlib" license):
#
# This software is provided 'as-is', any express or implied
# warranty. In no event will the authors be held liable for any
# damages arising from the use of self software.
#
# Permission is granted to anyone to use self software for any purpose,
# including commercial applications, to alter it and redistribute it
# freely, to the following restrictions:
#
# 1. The origin of self software must not be misrepresented; you must
# not claim that you wrote the original software. If you use self
# software in a product, acknowledgment in the product
# documentation would be appreciated but is not required.
# 2. Altered source versions must be plainly marked as such, must
# not be misrepresented as being the original software.
# 3. This notice may not be removed or altered from any source
# distribution.
#include "stdafx.h"
#include <vd2/VDXFrame/VideoFilter.h>
#####################################/
VDXVideoFilter.VDXVideoFilter()
VDXVideoFilter.~VDXVideoFilter()
def SetHooks(self, *fa, *ff):
self.fa = fa
self.ff = ff
#####################################/
def Init(self):
return True
def Start(self):
def End(self):
def Configure(self, hwnd):
return hwnd != NULL
def GetSettingString(self, *buf, maxlen):
def GetScriptString(self, *buf, maxlen):
def Serialize(self, *buf, maxbuf):
return 0
def Deserialize(self, *buf, maxbuf):
return 0
def Prefetch(self, frame):
return frame
def Prefetch2(self, frame, *prefetcher):
prefetcher.PrefetchFrame(0, Prefetch(frame), 0)
return True
def OnEvent(self, event, *eventData):
switch(event)
case kVDXVFEvent_InvalidateCaches:
return OnInvalidateCaches()
default:
return False
def OnInvalidateCaches(self):
return False
#####################################/
void __cdecl VDXVideoFilter.FilterDeinit (VDXFilterActivation *fa, *ff)
(*reinterpret_cast<VDXVideoFilter **>(fa.filter_data)).~VDXVideoFilter()
int __cdecl VDXVideoFilter.FilterRun ( VDXFilterActivation *fa, *ff)
VDXVideoFilter *pThis = *reinterpret_cast<VDXVideoFilter **>(fa.filter_data)
pThis.fa = const_cast<VDXFilterActivation *>(fa)
pThis.Run()
return 0
long __cdecl VDXVideoFilter.FilterParam (VDXFilterActivation *fa, *ff)
VDXVideoFilter *pThis = *reinterpret_cast<VDXVideoFilter **>(fa.filter_data)
pThis.fa = fa
return pThis.GetParams()
int __cdecl VDXVideoFilter.FilterConfig (VDXFilterActivation *fa, *ff, hwnd)
VDXVideoFilter *pThis = *reinterpret_cast<VDXVideoFilter **>(fa.filter_data)
pThis.fa = fa
return not pThis.Configure(hwnd)
int __cdecl VDXVideoFilter.FilterStart (VDXFilterActivation *fa, *ff)
VDXVideoFilter *pThis = *reinterpret_cast<VDXVideoFilter **>(fa.filter_data)
pThis.fa = fa
pThis.Start()
return 0
int __cdecl VDXVideoFilter.FilterEnd (VDXFilterActivation *fa, *ff)
VDXVideoFilter *pThis = *reinterpret_cast<VDXVideoFilter **>(fa.filter_data)
pThis.fa = fa
pThis.End()
return 0
void __cdecl VDXVideoFilter.FilterString ( VDXFilterActivation *fa, *ff, *buf)
VDXVideoFilter *pThis = *reinterpret_cast<VDXVideoFilter **>(fa.filter_data)
pThis.fa = const_cast<VDXFilterActivation *>(fa)
pThis.GetScriptString(buf, 80)
bool __cdecl VDXVideoFilter.FilterScriptStr(VDXFilterActivation *fa, *ff, *buf, buflen)
VDXVideoFilter *pThis = *reinterpret_cast<VDXVideoFilter **>(fa.filter_data)
pThis.fa = fa
pThis.GetScriptString(buf, buflen)
return True
void __cdecl VDXVideoFilter.FilterString2 ( VDXFilterActivation *fa, *ff, *buf, maxlen)
VDXVideoFilter *pThis = *reinterpret_cast<VDXVideoFilter **>(fa.filter_data)
pThis.fa = const_cast<VDXFilterActivation *>(fa)
pThis.GetSettingString(buf, maxlen)
int __cdecl VDXVideoFilter.FilterSerialize (VDXFilterActivation *fa, *ff, *buf, maxbuf)
VDXVideoFilter *pThis = *reinterpret_cast<VDXVideoFilter **>(fa.filter_data)
pThis.fa = fa
return pThis.Serialize(buf, maxbuf)
void __cdecl VDXVideoFilter.FilterDeserialize (VDXFilterActivation *fa, *ff, *buf, maxbuf)
VDXVideoFilter *pThis = *reinterpret_cast<VDXVideoFilter **>(fa.filter_data)
pThis.fa = fa
pThis.Deserialize(buf, maxbuf)
sint64 __cdecl VDXVideoFilter.FilterPrefetch( VDXFilterActivation *fa, *ff, frame)
VDXVideoFilter *pThis = *reinterpret_cast<VDXVideoFilter **>(fa.filter_data)
pThis.fa = const_cast<VDXFilterActivation *>(fa)
return pThis.Prefetch(frame)
bool __cdecl VDXVideoFilter.FilterPrefetch2( VDXFilterActivation *fa, *ff, frame, *prefetcher)
VDXVideoFilter *pThis = *reinterpret_cast<VDXVideoFilter **>(fa.filter_data)
pThis.fa = const_cast<VDXFilterActivation *>(fa)
return pThis.Prefetch2(frame, prefetcher)
bool __cdecl VDXVideoFilter.FilterEvent( VDXFilterActivation *fa, *ff, event, *eventData)
VDXVideoFilter *pThis = *reinterpret_cast<VDXVideoFilter **>(fa.filter_data)
pThis.fa = const_cast<VDXFilterActivation *>(fa)
return pThis.OnEvent(event, eventData)
def SafePrintf(self, *buf, maxbuf, *format, ...):
if maxbuf <= 0:
return
va_list val
va_start(val, format)
if (unsigned)_vsnprintf(buf, maxbuf, format, val) >= (unsigned)maxbuf:
buf[maxbuf - 1] = 0
va_end(val)
VDXScriptFunctionDef VDXVideoFilter.sScriptMethods[1]= {0

95
utilities/gimp/SpatialForegroundRemover-python/src/VDXFrame/source/VideoFilterDialog.cpp.py

@ -0,0 +1,95 @@
# VDXFrame - Helper library for VirtualDub plugins
# Copyright (C) 2008 Avery Lee
#
# The plugin headers in the VirtualDub plugin SDK are licensed differently
# differently than VirtualDub and the Plugin SDK themselves. This
# particular file is thus licensed as follows (the "zlib" license):
#
# This software is provided 'as-is', any express or implied
# warranty. In no event will the authors be held liable for any
# damages arising from the use of self software.
#
# Permission is granted to anyone to use self software for any purpose,
# including commercial applications, to alter it and redistribute it
# freely, to the following restrictions:
#
# 1. The origin of self software must not be misrepresented; you must
# not claim that you wrote the original software. If you use self
# software in a product, acknowledgment in the product
# documentation would be appreciated but is not required.
# 2. Altered source versions must be plainly marked as such, must
# not be misrepresented as being the original software.
# 3. This notice may not be removed or altered from any source
# distribution.
#include "stdafx.h"
#include <windows.h>
#include <vd2/VDXFrame/VideoFilterDialog.h>
namespace
#if defined(_MSC_VER) and _MSC_VER >= 1300
extern "C" char __ImageBase
def GetLocalHInstance(self):
return (HINSTANCE)&__ImageBase
#else:
def GetLocalHInstance(self):
meminfo = {0
if not VirtualQuery(GetLocalHInstance, &meminfo, sizeof(meminfo)):
return NULL
return (HINSTANCE)meminfo.AllocationBase
#endif
VDXVideoFilterDialog.VDXVideoFilterDialog()
: mhdlg(NULL)
def Show(self, hInst, templName, parent):
if not hInst:
hInst = GetLocalHInstance()
return DialogBoxParamA(hInst, templName, parent, StaticDlgProc, (LPARAM)self)
def Show(self, hInst, templName, parent):
if not hInst:
hInst = GetLocalHInstance()
return DialogBoxParamW(hInst, templName, parent, StaticDlgProc, (LPARAM)self)
def ShowModeless(self, hInst, templName, parent):
if not hInst:
hInst = GetLocalHInstance()
return CreateDialogParamA(hInst, templName, parent, StaticDlgProc, (LPARAM)self)
def ShowModeless(self, hInst, templName, parent):
if not hInst:
hInst = GetLocalHInstance()
return CreateDialogParamW(hInst, templName, parent, StaticDlgProc, (LPARAM)self)
INT_PTR CALLBACK VDXVideoFilterDialog.StaticDlgProc(HWND hdlg, msg, wParam, lParam)
VDXVideoFilterDialog *pThis
if msg == WM_INITDIALOG:
pThis = (VDXVideoFilterDialog *)lParam
SetWindowLongPtr(hdlg, DWLP_USER, (LONG_PTR)pThis)
pThis.mhdlg = hdlg
else:
pThis = (VDXVideoFilterDialog *)GetWindowLongPtr(hdlg, DWLP_USER)
return pThis ? pThis.DlgProc(msg, wParam, lParam) : FALSE
def DlgProc(self, msg, wParam, lParam):
return FALSE

72
utilities/gimp/SpatialForegroundRemover-python/src/VDXFrame/source/VideoFilterEntry.cpp.py

@ -0,0 +1,72 @@
# VDXFrame - Helper library for VirtualDub plugins
# Copyright (C) 2008 Avery Lee
#
# The plugin headers in the VirtualDub plugin SDK are licensed differently
# differently than VirtualDub and the Plugin SDK themselves. This
# particular file is thus licensed as follows (the "zlib" license):
#
# This software is provided 'as-is', any express or implied
# warranty. In no event will the authors be held liable for any
# damages arising from the use of self software.
#
# Permission is granted to anyone to use self software for any purpose,
# including commercial applications, to alter it and redistribute it
# freely, to the following restrictions:
#
# 1. The origin of self software must not be misrepresented; you must
# not claim that you wrote the original software. If you use self
# software in a product, acknowledgment in the product
# documentation would be appreciated but is not required.
# 2. Altered source versions must be plainly marked as such, must
# not be misrepresented as being the original software.
# 3. This notice may not be removed or altered from any source
# distribution.
#include "stdafx.h"
#include <vd2/VDXFrame/VideoFilterEntry.h>
int g_VFVAPIVersion
VDXFilterDefinition **g_VDXRegisteredFilters
int g_VDXRegisteredFilterCount
VDXFilterDefinition *VDXGetVideoFilterDefinition(int index)
def VDXVideoFilterModuleInit2(self, VDXFilterModule *fm, *ff, vdfd_ver, vdfd_compat, ver_compat_target):
def_count = 0
while(VDXGetVideoFilterDefinition(def_count))
++def_count
g_VDXRegisteredFilters = (VDXFilterDefinition **)malloc(sizeof(VDXFilterDefinition *) * def_count)
if not g_VDXRegisteredFilters:
return 1
memset(g_VDXRegisteredFilters, 0, sizeof(VDXFilterDefinition *) * def_count)
for(int i=0; i<def_count; ++i)
g_VDXRegisteredFilters[i] = ff.addFilter(fm, VDXGetVideoFilterDefinition(i), sizeof(VDXFilterDefinition))
g_VFVAPIVersion = vdfd_ver
vdfd_ver = VIRTUALDUB_FILTERDEF_VERSION
vdfd_compat = ver_compat_target
return 0
def VDXVideoFilterModuleDeinit(self, VDXFilterModule *fm, *ff):
if g_VDXRegisteredFilters:
for(int i=g_VDXRegisteredFilterCount-1; i>=0; --i)
VDXFilterDefinition *def = g_VDXRegisteredFilters[i]
if def:
ff.removeFilter(def)
free(g_VDXRegisteredFilters)
g_VDXRegisteredFilters = NULL
def VDXGetVideoFilterAPIVersion(self):
return g_VFVAPIVersion

25
utilities/gimp/SpatialForegroundRemover-python/src/VDXFrame/source/stdafx.cpp.py

@ -0,0 +1,25 @@
# VDXFrame - Helper library for VirtualDub plugins
# Copyright (C) 2008 Avery Lee
#
# The plugin headers in the VirtualDub plugin SDK are licensed differently
# differently than VirtualDub and the Plugin SDK themselves. This
# particular file is thus licensed as follows (the "zlib" license):
#
# This software is provided 'as-is', any express or implied
# warranty. In no event will the authors be held liable for any
# damages arising from the use of self software.
#
# Permission is granted to anyone to use self software for any purpose,
# including commercial applications, to alter it and redistribute it
# freely, to the following restrictions:
#
# 1. The origin of self software must not be misrepresented; you must
# not claim that you wrote the original software. If you use self
# software in a product, acknowledgment in the product
# documentation would be appreciated but is not required.
# 2. Altered source versions must be plainly marked as such, must
# not be misrepresented as being the original software.
# 3. This notice may not be removed or altered from any source
# distribution.
#include "stdafx.h"
Loading…
Cancel
Save