From 9d9e45eb72c6d9f1913e5db3354b400ba833a3e9 Mon Sep 17 00:00:00 2001 From: poikilos <7557867+poikilos@users.noreply.github.com> Date: Wed, 26 Feb 2020 20:57:17 -0500 Subject: [PATCH] Delete SFR for migrating it to to channel_tools. --- .../1.from-cpp.txt | 1 - .../extras/FilterSDK/Filter.h.py | 244 --- .../extras/FilterSDK/ScriptError.h.py | 95 -- .../extras/FilterSDK/ScriptInterpreter.h.py | 70 - .../extras/FilterSDK/ScriptValue.h.py | 171 -- .../extras/FilterSDK/VBitmap.h.py | 174 --- .../include/vd2/OldFilterSDK/Filter.h.py | 57 - .../include/vd2/OldFilterSDK/ScriptError.h.py | 8 - .../vd2/OldFilterSDK/ScriptInterpreter.h.py | 11 - .../include/vd2/OldFilterSDK/ScriptValue.h.py | 17 - .../include/vd2/OldFilterSDK/VBitmap.h.py | 16 - .../include/vd2/VDXFrame/Unknown.h.py | 110 -- .../include/vd2/VDXFrame/VideoFilter.h.py | 220 --- .../vd2/VDXFrame/VideoFilterDialog.h.py | 46 - .../vd2/VDXFrame/VideoFilterEntry.h.py | 83 - .../include/vd2/plugin/vdaudiofilt.h.py | 148 -- .../include/vd2/plugin/vdinputdriver.h.py | 284 ---- .../include/vd2/plugin/vdplugin.h.py | 206 --- .../include/vd2/plugin/vdvideofilt.h.py | 549 ------- .../include/vd2/plugin/vdvideoutil.h.py | 127 -- ...cc.org yuv2ppm.c) accessed 2010-03-03.c.py | 144 -- .../SpatialForegroundRemover/resource.h.py | 21 - .../source/colorspacetransform.cpp.py | 1187 -------------- .../source/colorspacetransform.h.py | 60 - .../source/etc/pconvert.cpp.py | 20 - .../source/etc/pconvert.h.py | 19 - .../source/f_spatialforegroundremover.cpp.py | 585 ------- .../source/f_spatialforegroundremover.h.py | 86 - .../source/main.cpp.py | 7 - .../source/pimage.cpp.py | 274 ---- .../source/pimage.h.py | 21 - .../source/pstring.cpp.py | 39 - .../source/pstring.h.py | 21 - .../source/targa--nondotnet/targa.cpp.py | 1256 --------------- .../source/targa--nondotnet/targa.h.py | 131 -- .../source/targa.cpp.py | 1390 ----------------- .../source/targa.h.py | 151 -- .../src/VDXFrame/include/stdafx.h.py | 33 - .../src/VDXFrame/source/VideoFilter.cpp.py | 220 --- .../VDXFrame/source/VideoFilterDialog.cpp.py | 95 -- .../VDXFrame/source/VideoFilterEntry.cpp.py | 72 - .../src/VDXFrame/source/stdafx.cpp.py | 25 - 42 files changed, 8494 deletions(-) delete mode 100644 utilities/gimp/SpatialForegroundRemover-python/1.from-cpp.txt delete mode 100644 utilities/gimp/SpatialForegroundRemover-python/extras/FilterSDK/Filter.h.py delete mode 100644 utilities/gimp/SpatialForegroundRemover-python/extras/FilterSDK/ScriptError.h.py delete mode 100644 utilities/gimp/SpatialForegroundRemover-python/extras/FilterSDK/ScriptInterpreter.h.py delete mode 100644 utilities/gimp/SpatialForegroundRemover-python/extras/FilterSDK/ScriptValue.h.py delete mode 100644 utilities/gimp/SpatialForegroundRemover-python/extras/FilterSDK/VBitmap.h.py delete mode 100644 utilities/gimp/SpatialForegroundRemover-python/include/vd2/OldFilterSDK/Filter.h.py delete mode 100644 utilities/gimp/SpatialForegroundRemover-python/include/vd2/OldFilterSDK/ScriptError.h.py delete mode 100644 utilities/gimp/SpatialForegroundRemover-python/include/vd2/OldFilterSDK/ScriptInterpreter.h.py delete mode 100644 utilities/gimp/SpatialForegroundRemover-python/include/vd2/OldFilterSDK/ScriptValue.h.py delete mode 100644 utilities/gimp/SpatialForegroundRemover-python/include/vd2/OldFilterSDK/VBitmap.h.py delete mode 100644 utilities/gimp/SpatialForegroundRemover-python/include/vd2/VDXFrame/Unknown.h.py delete mode 100644 utilities/gimp/SpatialForegroundRemover-python/include/vd2/VDXFrame/VideoFilter.h.py delete mode 100644 utilities/gimp/SpatialForegroundRemover-python/include/vd2/VDXFrame/VideoFilterDialog.h.py delete mode 100644 utilities/gimp/SpatialForegroundRemover-python/include/vd2/VDXFrame/VideoFilterEntry.h.py delete mode 100644 utilities/gimp/SpatialForegroundRemover-python/include/vd2/plugin/vdaudiofilt.h.py delete mode 100644 utilities/gimp/SpatialForegroundRemover-python/include/vd2/plugin/vdinputdriver.h.py delete mode 100644 utilities/gimp/SpatialForegroundRemover-python/include/vd2/plugin/vdplugin.h.py delete mode 100644 utilities/gimp/SpatialForegroundRemover-python/include/vd2/plugin/vdvideofilt.h.py delete mode 100644 utilities/gimp/SpatialForegroundRemover-python/include/vd2/plugin/vdvideoutil.h.py delete mode 100644 utilities/gimp/SpatialForegroundRemover-python/references/yuv2ppm by Scott Scriven (fourcc.org yuv2ppm.c) accessed 2010-03-03.c.py delete mode 100644 utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/resource.h.py delete mode 100644 utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/colorspacetransform.cpp.py delete mode 100644 utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/colorspacetransform.h.py delete mode 100644 utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/etc/pconvert.cpp.py delete mode 100644 utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/etc/pconvert.h.py delete mode 100644 utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/f_spatialforegroundremover.cpp.py delete mode 100644 utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/f_spatialforegroundremover.h.py delete mode 100644 utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/main.cpp.py delete mode 100644 utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/pimage.cpp.py delete mode 100644 utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/pimage.h.py delete mode 100644 utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/pstring.cpp.py delete mode 100644 utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/pstring.h.py delete mode 100644 utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/targa--nondotnet/targa.cpp.py delete mode 100644 utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/targa--nondotnet/targa.h.py delete mode 100644 utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/targa.cpp.py delete mode 100644 utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/targa.h.py delete mode 100644 utilities/gimp/SpatialForegroundRemover-python/src/VDXFrame/include/stdafx.h.py delete mode 100644 utilities/gimp/SpatialForegroundRemover-python/src/VDXFrame/source/VideoFilter.cpp.py delete mode 100644 utilities/gimp/SpatialForegroundRemover-python/src/VDXFrame/source/VideoFilterDialog.cpp.py delete mode 100644 utilities/gimp/SpatialForegroundRemover-python/src/VDXFrame/source/VideoFilterEntry.cpp.py delete mode 100644 utilities/gimp/SpatialForegroundRemover-python/src/VDXFrame/source/stdafx.cpp.py diff --git a/utilities/gimp/SpatialForegroundRemover-python/1.from-cpp.txt b/utilities/gimp/SpatialForegroundRemover-python/1.from-cpp.txt deleted file mode 100644 index d30fc72..0000000 --- a/utilities/gimp/SpatialForegroundRemover-python/1.from-cpp.txt +++ /dev/null @@ -1 +0,0 @@ -to Python via cpp2python.txt diff --git a/utilities/gimp/SpatialForegroundRemover-python/extras/FilterSDK/Filter.h.py b/utilities/gimp/SpatialForegroundRemover-python/extras/FilterSDK/Filter.h.py deleted file mode 100644 index 951de78..0000000 --- a/utilities/gimp/SpatialForegroundRemover-python/extras/FilterSDK/Filter.h.py +++ /dev/null @@ -1,244 +0,0 @@ -# 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 - -# 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 diff --git a/utilities/gimp/SpatialForegroundRemover-python/extras/FilterSDK/ScriptError.h.py b/utilities/gimp/SpatialForegroundRemover-python/extras/FilterSDK/ScriptError.h.py deleted file mode 100644 index 292a575..0000000 --- a/utilities/gimp/SpatialForegroundRemover-python/extras/FilterSDK/ScriptError.h.py +++ /dev/null @@ -1,95 +0,0 @@ -# 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 diff --git a/utilities/gimp/SpatialForegroundRemover-python/extras/FilterSDK/ScriptInterpreter.h.py b/utilities/gimp/SpatialForegroundRemover-python/extras/FilterSDK/ScriptInterpreter.h.py deleted file mode 100644 index 8e859a3..0000000 --- a/utilities/gimp/SpatialForegroundRemover-python/extras/FilterSDK/ScriptInterpreter.h.py +++ /dev/null @@ -1,70 +0,0 @@ -# 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 diff --git a/utilities/gimp/SpatialForegroundRemover-python/extras/FilterSDK/ScriptValue.h.py b/utilities/gimp/SpatialForegroundRemover-python/extras/FilterSDK/ScriptValue.h.py deleted file mode 100644 index 04af39b..0000000 --- a/utilities/gimp/SpatialForegroundRemover-python/extras/FilterSDK/ScriptValue.h.py +++ /dev/null @@ -1,171 +0,0 @@ -# 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 diff --git a/utilities/gimp/SpatialForegroundRemover-python/extras/FilterSDK/VBitmap.h.py b/utilities/gimp/SpatialForegroundRemover-python/extras/FilterSDK/VBitmap.h.py deleted file mode 100644 index 0c5a127..0000000 --- a/utilities/gimp/SpatialForegroundRemover-python/extras/FilterSDK/VBitmap.h.py +++ /dev/null @@ -1,174 +0,0 @@ -# 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 - -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 diff --git a/utilities/gimp/SpatialForegroundRemover-python/include/vd2/OldFilterSDK/Filter.h.py b/utilities/gimp/SpatialForegroundRemover-python/include/vd2/OldFilterSDK/Filter.h.py deleted file mode 100644 index 39e67cb..0000000 --- a/utilities/gimp/SpatialForegroundRemover-python/include/vd2/OldFilterSDK/Filter.h.py +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef f_FILTER_H -#define f_FILTER_H - -#include -#include - -# 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 diff --git a/utilities/gimp/SpatialForegroundRemover-python/include/vd2/OldFilterSDK/ScriptError.h.py b/utilities/gimp/SpatialForegroundRemover-python/include/vd2/OldFilterSDK/ScriptError.h.py deleted file mode 100644 index 178a09d..0000000 --- a/utilities/gimp/SpatialForegroundRemover-python/include/vd2/OldFilterSDK/ScriptError.h.py +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef f_SYLIA_SCRIPTERROR_H -#define f_SYLIA_SCRIPTERROR_H - -#include - -typedef .VDXScriptError CScriptError - -#endif diff --git a/utilities/gimp/SpatialForegroundRemover-python/include/vd2/OldFilterSDK/ScriptInterpreter.h.py b/utilities/gimp/SpatialForegroundRemover-python/include/vd2/OldFilterSDK/ScriptInterpreter.h.py deleted file mode 100644 index 377a4ce..0000000 --- a/utilities/gimp/SpatialForegroundRemover-python/include/vd2/OldFilterSDK/ScriptInterpreter.h.py +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef f_SYLIA_SCRIPTINTERPRETER_H -#define f_SYLIA_SCRIPTINTERPRETER_H - -#include - -typedef .VDXScriptValue CScriptValue -typedef .VDXScriptError CScriptError -typedef .VDXScriptObject CScriptObject -typedef .IVDXScriptInterpreter IScriptInterpreter - -#endif diff --git a/utilities/gimp/SpatialForegroundRemover-python/include/vd2/OldFilterSDK/ScriptValue.h.py b/utilities/gimp/SpatialForegroundRemover-python/include/vd2/OldFilterSDK/ScriptValue.h.py deleted file mode 100644 index 1a58dde..0000000 --- a/utilities/gimp/SpatialForegroundRemover-python/include/vd2/OldFilterSDK/ScriptValue.h.py +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef f_SYLIA_SCRIPTVALUE_H -#define f_SYLIA_SCRIPTVALUE_H - -#include - -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 diff --git a/utilities/gimp/SpatialForegroundRemover-python/include/vd2/OldFilterSDK/VBitmap.h.py b/utilities/gimp/SpatialForegroundRemover-python/include/vd2/OldFilterSDK/VBitmap.h.py deleted file mode 100644 index b29fbb2..0000000 --- a/utilities/gimp/SpatialForegroundRemover-python/include/vd2/OldFilterSDK/VBitmap.h.py +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef f_VIRTUALDUB_VBITMAP_H -#define f_VIRTUALDUB_VBITMAP_H - -#include -#include - -typedef unsigned Pixel -typedef unsigned Pixel32 -typedef unsigned char Pixel8 -typedef int PixCoord -typedef int PixDim -typedef ptrdiff_t PixOffset - -typedef .VDXBitmap VBitmap - -#endif diff --git a/utilities/gimp/SpatialForegroundRemover-python/include/vd2/VDXFrame/Unknown.h.py b/utilities/gimp/SpatialForegroundRemover-python/include/vd2/VDXFrame/Unknown.h.py deleted file mode 100644 index 1b18c78..0000000 --- a/utilities/gimp/SpatialForegroundRemover-python/include/vd2/VDXFrame/Unknown.h.py +++ /dev/null @@ -1,110 +0,0 @@ -# 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 - -extern "C" long _InterlockedExchangeAdd(volatile long *p, v) -#pragma intrinsic(_InterlockedExchangeAdd) - -template class vdxunknown : public T -public: - vdxunknown() : mRefCount(0) { - vdxunknown( vdxunknown& src) : mRefCount(0) {} # do not copy the refcount - virtual ~vdxunknown() { - - vdxunknown& operator=( vdxunknown&) {} # 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(self) - - if iid == IVDXUnknown.kIID: - return static_cast(self) - - return NULL - - -protected: - volatile long mRefCount - - -template 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(self) - - if iid == T2.kIID: - return static_cast(self) - - if iid == IVDXUnknown.kIID: - return static_cast(static_cast(self)) - - return NULL - - -protected: - volatile long mRefCount - - -#endif diff --git a/utilities/gimp/SpatialForegroundRemover-python/include/vd2/VDXFrame/VideoFilter.h.py b/utilities/gimp/SpatialForegroundRemover-python/include/vd2/VDXFrame/VideoFilter.h.py deleted file mode 100644 index bad9d56..0000000 --- a/utilities/gimp/SpatialForegroundRemover-python/include/vd2/VDXFrame/VideoFilter.h.py +++ /dev/null @@ -1,220 +0,0 @@ -# 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 -#include -#include - -#include - -#####################################/ -#/ \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.AdaptFn, "Config", "0" args }, -#define VDXVF_DEFINE_SCRIPT_METHOD2(klass, method, args) { (VDXScriptFunctionPtr)VDXVideoFilterScriptAdapter.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 VDXVideoFilterScriptAdapter -public: - static void AdaptFn(IVDXScriptInterpreter *isi, *fa0, *argv, argc) - VDXFilterActivation *fa = (VDXFilterActivation *)fa0 - VDXVideoFilter *base = *(VDXVideoFilter **)fa.filter_data - (static_cast(base).*T_Method)(isi, argv, argc) - - - -template -class VDXVideoFilterScriptObjectAdapter -public: - static VDXScriptObject sScriptObject - - -template - VDXScriptObject VDXVideoFilterScriptObjectAdapter.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 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(&VDXVideoFilterScriptObjectAdapter.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(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(*reinterpret_cast(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(*reinterpret_cast(fa.filter_data))) - p.ff = ffnew - p.fa = fanew - *(VDXVideoFilter **)dst = p - - - -#endif diff --git a/utilities/gimp/SpatialForegroundRemover-python/include/vd2/VDXFrame/VideoFilterDialog.h.py b/utilities/gimp/SpatialForegroundRemover-python/include/vd2/VDXFrame/VideoFilterDialog.h.py deleted file mode 100644 index e21049f..0000000 --- a/utilities/gimp/SpatialForegroundRemover-python/include/vd2/VDXFrame/VideoFilterDialog.h.py +++ /dev/null @@ -1,46 +0,0 @@ -# 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 - -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 diff --git a/utilities/gimp/SpatialForegroundRemover-python/include/vd2/VDXFrame/VideoFilterEntry.h.py b/utilities/gimp/SpatialForegroundRemover-python/include/vd2/VDXFrame/VideoFilterEntry.h.py deleted file mode 100644 index ceaf5d9..0000000 --- a/utilities/gimp/SpatialForegroundRemover-python/include/vd2/VDXFrame/VideoFilterEntry.h.py +++ /dev/null @@ -1,83 +0,0 @@ -# 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 - -#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 diff --git a/utilities/gimp/SpatialForegroundRemover-python/include/vd2/plugin/vdaudiofilt.h.py b/utilities/gimp/SpatialForegroundRemover-python/include/vd2/plugin/vdaudiofilt.h.py deleted file mode 100644 index 34bcb43..0000000 --- a/utilities/gimp/SpatialForegroundRemover-python/include/vd2/plugin/vdaudiofilt.h.py +++ /dev/null @@ -1,148 +0,0 @@ -#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 diff --git a/utilities/gimp/SpatialForegroundRemover-python/include/vd2/plugin/vdinputdriver.h.py b/utilities/gimp/SpatialForegroundRemover-python/include/vd2/plugin/vdinputdriver.h.py deleted file mode 100644 index aedde5e..0000000 --- a/utilities/gimp/SpatialForegroundRemover-python/include/vd2/plugin/vdinputdriver.h.py +++ /dev/null @@ -1,284 +0,0 @@ -# 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 diff --git a/utilities/gimp/SpatialForegroundRemover-python/include/vd2/plugin/vdplugin.h.py b/utilities/gimp/SpatialForegroundRemover-python/include/vd2/plugin/vdplugin.h.py deleted file mode 100644 index 6adf688..0000000 --- a/utilities/gimp/SpatialForegroundRemover-python/include/vd2/plugin/vdplugin.h.py +++ /dev/null @@ -1,206 +0,0 @@ -# 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 - -# Copied from . 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 diff --git a/utilities/gimp/SpatialForegroundRemover-python/include/vd2/plugin/vdvideofilt.h.py b/utilities/gimp/SpatialForegroundRemover-python/include/vd2/plugin/vdvideofilt.h.py deleted file mode 100644 index 3a2aa17..0000000 --- a/utilities/gimp/SpatialForegroundRemover-python/include/vd2/plugin/vdvideofilt.h.py +++ /dev/null @@ -1,549 +0,0 @@ -# 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 - -#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 diff --git a/utilities/gimp/SpatialForegroundRemover-python/include/vd2/plugin/vdvideoutil.h.py b/utilities/gimp/SpatialForegroundRemover-python/include/vd2/plugin/vdvideoutil.h.py deleted file mode 100644 index 9da6c6a..0000000 --- a/utilities/gimp/SpatialForegroundRemover-python/include/vd2/plugin/vdvideoutil.h.py +++ /dev/null @@ -1,127 +0,0 @@ -#ifndef f_VD2_PLUGIN_VDVIDEOUTIL_H -#define f_VD2_PLUGIN_VDVIDEOUTIL_H - -template -T *vd_ptroffset(T *p, diff) - return (T *)((char *)p + diff) - - -template -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& operator+=(int y) - mp = vd_ptroffset(mp, * y) - return *self - - - vd_row_iter& operator-=(int y) - mp = vd_ptroffset(mp, -(mpitch * y)) - return *self - - - vd_row_iter& operator++() - mp = vd_ptroffset(mp, mpitch) - return *self - - - vd_row_iter operator++(int) - vd_row_iter temp(*self) - mp = vd_ptroffset(mp, mpitch) - return temp - - - vd_row_iter& operator--() - mp = vd_ptroffset(mp, -mpitch) - return *self - - - vd_row_iter operator--(int) - vd_row_iter temp(*self) - mp = vd_ptroffset(mp, -mpitch) - return temp - - -protected: - T *mp - ptrdiff_t mpitch - - -typedef vd_row_iter 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 diff --git a/utilities/gimp/SpatialForegroundRemover-python/references/yuv2ppm by Scott Scriven (fourcc.org yuv2ppm.c) accessed 2010-03-03.c.py b/utilities/gimp/SpatialForegroundRemover-python/references/yuv2ppm by Scott Scriven (fourcc.org yuv2ppm.c) accessed 2010-03-03.c.py deleted file mode 100644 index 5d28f79..0000000 --- a/utilities/gimp/SpatialForegroundRemover-python/references/yuv2ppm by Scott Scriven (fourcc.org yuv2ppm.c) accessed 2010-03-03.c.py +++ /dev/null @@ -1,144 +0,0 @@ -#include -#include -''' - 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 -##define WIN32_LEAN_AND_MEAN -#include - -namespace ProtoArmor -extern char c255 -float YCToRgb_fMaxY=-256.0f -float YCToRgb_fMaxU=-256.0f -float YCToRgb_fMaxV=-256.0f -float YCToRgb_fMinY=256.0f -float YCToRgb_fMinU=256.0f -float YCToRgb_fMinV=256.0f -float RgbToYC_fMaxY=-256.0f -float RgbToYC_fMaxU=-256.0f -float RgbToYC_fMaxV=-256.0f -float RgbToYC_fMinY=256.0f -float RgbToYC_fMinU=256.0f -float RgbToYC_fMinV=256.0f -float YCToRgb_byMaxR=-255 -float YCToRgb_byMaxG=-255 -float YCToRgb_byMaxB=-255 -float YCToRgb_byMinR=255 -float YCToRgb_byMinG=255 -float YCToRgb_byMinB=255 - -def GetCurrentOrPrevFrameFor(self, sAnyFrameFile, iFrameCurrent): - #NOTE: VirtualDub uses sint32 for current frame of source, dest, sequence - string sReturn=sAnyFrameFile - int iDesiredFrame=0 - int iSequenceDigits=0 - size_t stLastDot=sAnyFrameFile.find_last_of(".") - if stLastDot!=string.npos: - char* carrsAnyFrameFile=sAnyFrameFile.c_str() - if ((stLastDot-1)>=0) and IsDigit(carrsAnyFrameFile[stLastDot-1]) : - int iLastDigit=stLastDot-1 - int iFirstDigit=iLastDigit - int iChar=iFirstDigit - while (iChar>=0) - if ((iFirstDigit-1)>=0) and IsDigit(carrsAnyFrameFile[iFirstDigit-1]) : - iFirstDigit-- - - else: - break - - iChar-- - - #OK to continue processing number since found at least one digit: - iSequenceDigits=iLastDigit-iFirstDigit+1 - string sDotThenExt=sAnyFrameFile.substr(stLastDot) - string sFileBaseName=sAnyFrameFile.substr(0,iFirstDigit) - #cerr<<"looking for frame "<=0; iFrame--) - string sFileTheoretical=sFileBaseName+PString.SequenceDigits(iFrame,iSequenceDigits)+sDotThenExt - if File.Exists(sFileTheoretical) : - sReturn=sFileTheoretical - #cerr<<"GetCurrentOrPrevFrameFor: "<0: - unsigned int PixelsPerSourceSubsample=(int)((double)w/(double)source_Stride+.5); #+.5 to round since stride may be a little wide (e.g. extra 8 bytes can occurnot ) - #Console.Error.WriteLine("CopyPlaneToNonPlanar {PixelsPerSourceSubsample:"+Convert.ToString(PixelsPerSourceSubsample)+"; source_w: "+Convert.ToString(w)+"; source_Stride:"+Convert.ToString(source_Stride)+"; bSamplesOnSecondLineOfSource:"+Convert.ToString(bSamplesOnSecondLineOfSource)+";}");#debug only - unsigned int iBuildUp=0 - #double source_PixelOffset=(double)source_Stride/(double)w;#unsigned int source_BytesPP=source_Stride/w; #can be less than 1 if subsampled; 1 or less since planar - unsigned int dest_Stride=w*dest_BytesPP - for (unsigned int y=0; y=PixelsPerSourceSubsample: - lpSourceNow++ - iBuildUp=0 - - }#end for x - if (bSamplesOnSecondLineOfSource) lpSourceLineNow+=source_Stride - lpDestLineNow+=dest_Stride - - lpDestNow=lpDestLineNow - lpSourceNow=lpSourceLineNow - for (unsigned int x=0; x=PixelsPerSourceSubsample: - lpSourceNow++ - iBuildUp=0 - - }#end for x - lpSourceLineNow+=source_Stride - lpDestLineNow+=dest_Stride - }#end for y - - else cerr<<"CopyPlaneToNonPlanar Error: width 'w' was "<0: - unsigned int PixelsPerDestSubsample=w/dest_Stride - unsigned int iBuildUp=0 - #double source_PixelOffset=(double)source_Stride/(double)w;#unsigned int source_BytesPP=source_Stride/w; #can be less than 1 if subsampled; 1 or less since planar - unsigned int dest_BytesPP=dest_Stride/w; #normally 1 if planar - unsigned int source_Stride=w*source_BytesPP - unsigned int half_h=h/2 - for (unsigned int y=0; y=PixelsPerDestSubsample: - lpDestNow+=dest_BytesPP - iBuildUp=0 - - }#end for x - if (bSamplesOnSecondLineOfDest) lpDestLineNow+=dest_Stride - lpSourceLineNow+=source_Stride - - lpSourceNow=lpSourceLineNow - lpDestNow=lpDestLineNow - for (unsigned int x=0; x=PixelsPerDestSubsample: - lpDestNow+=dest_BytesPP - iBuildUp=0 - - }#end for x - lpDestLineNow+=dest_Stride - lpSourceLineNow+=source_Stride - }#end for y - - else cerr<<"CopyNonPlanarToPlane Error: width 'w' was "<=source_a: lpSourceNow++ - iBuildUp=0 - - }#end for xDest - lpDestLineNow+=dest_Stride - if (source_b>0) lpSourceLineNow+=source_chromaplane_stride; #assumes b is equal to a when b>0 - #else goes back to beginning of line and re-uses chroma line (starting at lpSourceNow=lpSourceLineNow below) - - lpDestNow=lpDestLineNow - lpSourceNow=lpSourceLineNow - for (int xDest=0; xDest=source_a: lpSourceNow++ - iBuildUp=0 - - }#end for xDest - lpDestLineNow+=dest_Stride - lpSourceLineNow+=source_chromaplane_stride - }#end for yDest - }#end for chroma_plane - }#end YUV4xxSubsampledToYUV444 -''' -void RgbToYC(unsigned char &Y, char &U, char &V, char R, char G, char B) #aka RGBToYUV - #UNSIGNED TO PREVENT CASTING TO NEGATIVE - - #float declarations avoid redundant typecasts - #--AND allow for writing back to exact same 3 bytes without interfering with U and V calculation - - - # accessed 2010-03-03 - #Y = Convert.ToByte( ( ( 66 * R + 129 * G + 25 * B + 128) >> 8) + 16 ) - #U = Convert.ToByte( ( ( -38 * R - 74 * G + 112 * B + 128) >> 8) + 128 ) - #V = Convert.ToByte( ( ( 112 * R - 94 * G - 18 * B + 128) >> 8) + 128 ) - #These formulas produce 8-bit results using coefficients that require no more than 8 bits of (unsigned) precision. Intermediate results require up to 16 bits of precision. - - #VirtualDub author's formula (see TransformRGB32 function in sample plugin code): - #r = R / 255.0f - #g = G / 255.0f - #b = B / 255.0f - #y = 0.299f*r + 0.587f*g + 0.114f*b - #u = 0.5f*(b - y) - #v = 0.5f*(r - y) - Y = Convert.ToByte( (0.299*R + 0.587*G + 0.114*B) * 219.0/255.0 + 16.0 ) - U = Convert.ToByte( (0.564*(B-Y)) * 224.0/255.0 + 128.0 );#Cb - V = Convert.ToByte( (0.713*(R-Y)) * 224.0/255.0 + 128.0 );#Cr - - # accessed 2010-03-03 - ''' - int r=R - int g=G - int b=B - ##coefs summed to 65536 ( 1 << 16 ), Y is always within [0, 255] - Y = Convert.ToByte( (19595*r + 38470*g + 7471*b ) >> 16) - U = Convert.ToByte( ( 36962*(b-Y) ) >> 16 );#Cb - V = Convert.ToByte( ( 46727*(r-Y) ) >> 16 );#Cr - ''' - - ''' - float fB=(float)b - float fG=(float)g - float fR=(float)r - float fY=.299f*fR + .587f*fG + .114f*fB - float fU=-.16874f*fR - .33126f*fG + .5f*fB - float fV=.5f*fR - .41869f*fG - .08131f*fB - Y = Convert.ToChar8( fY+.5 ); #+.5 for rounding - U = Convert.ToChar8( fU+.5 ); #+.5 for rounding - V = Convert.ToChar8( fV+.5 ); #+.5 for rounding - ''' -#ifdef CT_TESTLIMITS - if (fYRgbToYC_fMaxY) RgbToYC_fMaxY=fY - if (fU>RgbToYC_fMaxU) RgbToYC_fMaxU=fU - if (fV>RgbToYC_fMaxV) RgbToYC_fMaxV=fV -#endif -}#end RgbToYC -void YCToRgb(unsigned char &R, char &G, char &B, char Y, char U, char V) #aka YUVToRGB - #UNSIGNED TO PREVENT CASTING TO NEGATIVE - #-otherwise range becomes -128to127 (tested) - # if (YYCToRgb_fMaxY) YCToRgb_fMaxY=Y - # if (U>YCToRgb_fMaxU) YCToRgb_fMaxU=U - # if (V>YCToRgb_fMaxV) YCToRgb_fMaxV=V - - #float declarations avoid redundant typecasts - #--AND allow for writing back to exact same 3 bytes without interfering with g and b calculation - - # accessed 2010-03-03 - #C = (int)Y - 16 - #D = (int)U - 128 - #E = (int)V - 128 - #R = Convert.ToByte(( 298 * C + 409 * E + 128) >> 8) - #G = Convert.ToByte(( 298 * C - 100 * D - 208 * E + 128) >> 8) - #B = Convert.ToByte(( 298 * C + 516 * D + 128) >> 8) - #(Convert.ToByte acts as clip) - #Note All units range from 0 (zero) to 1.0 (one). In DirectDraw, range from 0 to 255. Overflow and underflow can (and does) occur, the results must be saturated. - - #VirtualDub author's formula (see TransformRGB32 function in sample plugin code): - float fY=(float)Y - float fU=(float)U - float fV=(float)V - #the resulting tga using these has no perceivable difference from virtualdub screenshot: - R = Convert.ToByte( 1.164*(fY-16.0f) + 1.596*(fV-128.0f) ) - G = Convert.ToByte( 1.164*(fY-16.0f) - 0.813*(fV-128.0f) - 0.391*(fU-128.0f) ) - B = Convert.ToByte( 1.164*(fY-16.0f) + 2.018*(fU-128.0f) ) - # if Convert.ToByte(R)YCToRgb_byMaxR) YCToRgb_byMaxR=Convert.ToByte(R: - # if Convert.ToByte(G)YCToRgb_byMaxG) YCToRgb_byMaxG=Convert.ToByte(G: - # if Convert.ToByte(B)YCToRgb_byMaxB) YCToRgb_byMaxB=Convert.ToByte(B: - #y = (float)Y/255.0f - #u = (float)U/255.0f - #v = (float)V/255.0f - #r = y + 1.402f*v - #g = y - 0.714f*v - 0.344f*u - #b = y + 1.772f*u - #ir = (int)(0.5f + r*255.0f) - #ig = (int)(0.5f + g*255.0f) - #ib = (int)(0.5f + b*255.0f) - #ir &= ~(ir >> 31) - #ir |= (255 - ir) >> 31 - #ig &= ~(ig >> 31) - #ig |= (255 - ig) >> 31 - #ib &= ~(ib >> 31) - #ib |= (255 - ib) >> 31 - #B = Convert.ToByte(ib) - #G = Convert.ToByte(ig) - #R = Convert.ToByte(ir) - #if (irYCToRgb_byMaxR) YCToRgb_byMaxR=ir - #if (igYCToRgb_byMaxG) YCToRgb_byMaxG=ig - #if (ibYCToRgb_byMaxB) YCToRgb_byMaxB=ib - - - - # accessed 2010-03-03 - ''' - y = ( int ) Y << 16; #same as multiply 65536 - int r=( y + (int)91881 * V ) >> 16 - int g=( y - (int)22544 * U - (int)46793 * V ) >> 16 - int b=( y + (int) 116129 * U ) >> 16 - R = Convert.ToByte( ( y + (int)91881 * V ) >> 16 ) - G = Convert.ToByte( ( y - (int)22544 * U - (int)46793 * V ) >> 16 ) - B = Convert.ToByte( ( y + (int) 116129 * U ) >> 16 ) - if ((float)YYCToRgb_fMaxY) YCToRgb_fMaxY=(float)Y - if ((float)UYCToRgb_fMaxU) YCToRgb_fMaxU=(float)U - if ((float)VYCToRgb_fMaxV) YCToRgb_fMaxV=(float)V - if (rYCToRgb_byMaxR) YCToRgb_byMaxR=r - if (gYCToRgb_byMaxG) YCToRgb_byMaxG=g - if (bYCToRgb_byMaxB) YCToRgb_byMaxB=b - ''' - - - ''' - float fY=(float)Y - float fU=(float)U - float fV=(float)V - r = Convert.ToChar8( fY + 1.402f*fV +.5); #+.5 for rounding - g = Convert.ToChar8( fY - 0.34414f*fU - .71414f*fV +.5); #+.5 for rounding - b = Convert.ToChar8( fY + 1.772f*fU +.5); #+.5 for rounding - - if (fYYCToRgb_fMaxY) YCToRgb_fMaxY=fY - if (fU>YCToRgb_fMaxU) YCToRgb_fMaxU=fU - if (fV>YCToRgb_fMaxV) YCToRgb_fMaxV=fV - if (rYCToRgb_byMaxR) YCToRgb_byMaxR=r - if (g>YCToRgb_byMaxG) YCToRgb_byMaxG=g - if (b>YCToRgb_byMaxB) YCToRgb_byMaxB=b - ''' -}#end YCToRgb - -void CopySurface_BitdepthSensitive(unsigned char* dest, int dest_BytesPP, int dest_Stride, char* source, int source_BytesPP, int source_Stride, int w, int h) #formerly ChanToChan - unsigned char* lpDestLoc - unsigned char* lpDestLineLoc=dest - unsigned char* lpSourceLoc - unsigned char* lpSourceLineLoc=source - unsigned int iSrcChan - - if source!=NULL: - if dest!=NULL: - for (unsigned int iLine=0; iLine1)?1:0;#if not grayscale set to next channel - int chanR=(dest_BytesPP>1)?2:0;#if not grayscale set to next channel - int chanA=(dest_BytesPP>=4)?3:0 - - int dest_VisibleChannels=dest_BytesPP - if (dest_VisibleChannels==4) dest_VisibleChannels=3 - int uiChan - - if dest0!=null: - #if dest_BytesPP<4: if mask0!=null: - byte* lpDestLine=dest0 - #if (mask_BytesPP==4) lpMaskLine+=3;#move to alpha if alpha exists - byte* lpDest - byte* lpMaskLine=&mask0[mask_Channel] - byte* lpMask - double rNear_X;#near pixel that is nonzero in mask - double rNear_Y;#near pixel that is nonzero in mask - unsigned int Near_X;#near pixel that is nonzero in mask - unsigned int Near_Y;#near pixel that is nonzero in mask - #double fxFar;#far pixel to use as heal source (diffusable) - #double fyFar;#far pixel to use as heal source (diffusable) - bool bUsable=True - int iHealed=0 - byte* lpSrcNow=dest0;#unsigned int dwSrc=0 - float fAlphaCooked - float fAlphaCookedInverse - for (unsigned int y=0; y0) #non-black pixel (to heal: - rNear_X=(double)x - rNear_Y=(double)y - if PImage.PushToNearest(rNear_X,rNear_Y,mask0,w,h,mask_BytesPP,mask_Stride,mask_Channel,1,False): - Near_X=(unsigned int)(rNear_X+.5f) - Near_Y=(unsigned int)(rNear_Y+.5f) - #if PReporting.getIsUltraDebug(): #cerr<<"healing:("< -#/Gets a certain number of nearby background pixels where number is (rReachMultiplier*8.0+.5)+1.0). -#/rRadialSampleSpacing is ignored (self checks all nearest pixels limited to number determined as per formula above). -#/rDiffusionMultiplier is pixel radius for diffusion, is multiplied by 3 -#/ -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): - int chanB=0 - int chanG=(dest_BytesPP>1)?1:0;#if not grayscale set to next channel - int chanR=(dest_BytesPP>1)?2:0;#if not grayscale set to next channel - int chanA=(dest_BytesPP>=4)?3:0 - int iHealedTotal=0 - - if PReporting.getIsMegaDebug) Console.Error.Write("Heal_WithAveraging_Permutations...": - try - unsigned int x - unsigned int y - PReporting.setParticiple("running heal") - PMath.ResizePixelInfoCache(w*h,False) - PMath.ResizeDistanceCache(w,h) - PMath.ResizePointInfoCache((w>h)?w:h, bHorizonalSearch, bVerticalSearch) - #PMath.ResizePointInfoCache((w>h)?w:h, bHorizonalSearch, bVerticalSearch);#ResizePointInfoCache(int iRadius) - # (cutoff of cache is determined manually below by quantity of background pixels found, - # so self program doesn't need a radius-based cutoff anywhere). - #PMath.ppxiCache_Used=0 - #pfDistCache[x][y] - #PMath.ppxiCache[PMath.ppxiCache_Used] - unsigned int uiMaskLine=mask_Channel - unsigned int uiMaskLoc - unsigned int uiDestLine=0 - unsigned int uiDestLoc - bool bLineOnly=( not bHorizonalSearch or not bVerticalSearch ) - unsigned int uiPixelsToGet=bLineOnly ? (4) : ( (unsigned int)( (rReachMultiplier*8.0+.5) + 1.0 ) ) - PReporting.setParticiple("finished setting uiPixelsToGet (for getting average background color) to "+Convert.ToString(uiPixelsToGet-1)+"(+1)") - unsigned int iPointInfoNow - POINTINFO* lppiNow=NULL - float rNearestBGDist=FLT_MAX - float rFarthestBGDist=0 - float fWeightNow - unsigned int uiChan - int iW=(int)w - int iH=(int)h - #uiMaskLoc=0 - #uiDestLoc=0 - float rCookedAlpha - float rInverseAlpha - float rDestTemp - unsigned int iMatchNow - float farrHeavyPixel[4] - float fTotalWeight;#needed since e.g. if ther are two background pixels, red channels are 255 are 255 ends up being 255+0 where 0 is farthest pixel (since multiplied by weight of 0 since farthest)--total weight would be 1.0, in 255/1, is 255 - PReporting.setParticiple("processing destination") - for (y=0; y0: - PMath.ppxiCache_Used=0 - iPointInfoNow=0;#ptcachebydistanceNow.Seek(0) - for (iPointInfoNow=0; iPointInfoNow=0 - and yPointTheoretical>=0 ) - int mask_indexTheoretical=yPointTheoretical*mask_Stride+xPointTheoretical*mask_BytesPP+mask_Channel - if (mask0[mask_indexTheoretical]==0) #IS background at theoretical location - int dest_indexTheoretical=yPointTheoretical*dest_Stride+xPointTheoretical*dest_BytesPP - memcpy(PMath.ppxiCache[PMath.ppxiCache_Used].data, &dest0[dest_indexTheoretical], dest_BytesPP); #for (int uiChan=0; uiChanrFarthestBGDist) rFarthestBGDist=PMath.ppxiCache[PMath.ppxiCache_Used].distance - if (PMath.ppxiCache[PMath.ppxiCache_Used].distance=uiPixelsToGet) break - - if (PMath.ppxiCache_Used>=uiPixelsToGet) break - - if (PMath.ppxiCache_Used>=uiPixelsToGet) break - }#end if lppiNow!=NULL - else: - Console.Error.WriteLine("Error: NULL pointinfo in cachenot ") - break - - }#end while there are permutatable points in ptcachebydistanceNow using the given range - if (PMath.ppxiCache_Used>=2) #both a min and max location are needed since weight of far pixel is zero! - float rSpreadBGDistance=rFarthestBGDist-rNearestBGDist - if rSpreadBGDistance>0: - fTotalWeight=0.0f;#needed since e.g. if ther are two background pixels, red channels are 255 are 255 ends up being 255+0 where 0 is farthest pixel (since multiplied by weight of 0 since farthest)--total weight would be 1.0, in 255/1, is 255 - for (uiChan=0; uiChan0) Diffuse(dest0, w, h, dest_BytesPP, dest_Stride, 0, 0, mask0, w, h, mask_BytesPP, mask_Stride, mask_Channel, iDiffusionRadius, bRandom: -}#end Heal_WithAveraging_Permutations -def Diffuse(self, char* dest0, int dest_w, int dest_h, int dest_BytesPP, int dest_Stride, to_Left, to_Top, char* brush0, int brush_w, int brush_h, int brush_BytesPP, int brush_Stride, int brush_Channel, iRadius, bRandom): - if PReporting.getIsMegaDebug(): - Console.Error.WriteLine("Starting diffuse...") - Console.Out.Flush() - - unsigned int uiDestLine - unsigned int uiDestLoc - unsigned int uiBrushLine - unsigned int uiBrushLoc - unsigned int xDest - unsigned int yDest=to_Top - double rPixelRadius=(double)iRadius - int xBrushStart - if (to_Left<0) xBrushStart=to_Left*-1 - else xBrushStart=0 - int yBrushStart - if (to_Top<0) yBrushStart=to_Top*-1 - else yBrushStart=0 - PReporting.setParticiple("diffusing using brush") - byte byarrColor[4] - #for (int i=0; i<4; i++) # byarrColor[i]=0 - # - int iFibboLimit=INT_MAX/2 - int iFibboTemp - int iFibboPrev=0 - int iFibbo=1 - int iFibboStart=377;#go past 360 to make angles seem more random after modulus 360 - int iFibboStartPrev=233 - #fibbonocci set begins with: 0,1,1,2,3,5,8,13,21,34,55,89,144,233,377 - iFibboStartPrev=iFibboStartPrev;#0 - iFibbo=iFibboStart;#1 - #while (iFibbo<240) { #go past 240 to make angles seem more random after modulus 360 - # iFibboTemp=iFibbo - # iFibbo=iFibbo+iFibboPrev - # if iFibbo=0 and yDest>=0 and yDest=0 and xDest>=0 and xDest0: - #subtracting PixelRadius makes probability sets like {0,1,2} into {-1,0,1 - if not bRandom: - rDistDiffused=(float)(iFibbo%iPixelsRadiusEx) - rAngleDiffused=(float)(iFibbo%360) - xDiffused=xDest+(int)(PMath.XOfRThetaDeg(rDistDiffused,rAngleDiffused)+.5f); #xDiffused=x+(iFibbo%iDiameterInclusive-iRadius) - yDiffused=yDest+(int)(PMath.YOfRThetaDeg(rDistDiffused,rAngleDiffused)+.5f); #yDiffused=y+(iFibboPrev%iDiameterInclusive-iRadius) - - else: - rDistDiffused=(float)(rand()%iPixelsRadiusEx) - rAngleDiffused=(float)(rand()%360) - xDiffused=xDest+(int)(PMath.XOfRThetaDeg(rDistDiffused,rAngleDiffused)+.5f); #xDiffused=x+(rand()%iDiameterInclusive-iRadius) - yDiffused=yDest+(int)(PMath.YOfRThetaDeg(rDistDiffused,rAngleDiffused)+.5f); #yDiffused=y+(rand()%iDiameterInclusive-iRadius) - - if (xDiffused<0) xDiffused=0 - elif (xDiffused>=dest_w) xDiffused=dest_w-1 - if (yDiffused<0) yDiffused=0 - elif (yDiffused>=dest_h) yDiffused=dest_h-1 - - #uiDiffusedDestLoc=yDiffused*w+xDiffused - lpDestNow=&dest0[yDiffused*dest_Stride+xDiffused*dest_BytesPP] - lpDestDiffusedBrushColor=&dest0[uiDestLoc] - #alpha is brush0[uiBrushLoc] - rCookedAlpha=(float)brush0[uiBrushLoc]/255.0f - rInverseAlpha=1.0f-rCookedAlpha - for (iChan=0; iChan1)?1:0;#if not grayscale set to next channel - int chanR=(dest_BytesPP>1)?2:0;#if not grayscale set to next channel - int chanA=(dest_BytesPP>=4)?3:0;#if - #NOTE: mask is always used as alpha so dest0 does NOT need to be dest_BytesPP==4 - if rRadialSampleSpacing<=0.0) rRadialSampleSpacing=1.0/360.0; #1/360.0=~0.00278 (repeating 7: - elif (rRadialSampleSpacing>360.0) rRadialSampleSpacing=360.0 - unsigned int uiRadialSamples=(unsigned int)(360.0/rRadialSampleSpacing) - if ((double)uiRadialSamples*rRadialSampleSpacing==360.0) uiRadialSamples--; #prevents 360 from repeating location of 0 degrees - if (uiRadialSamples<1) uiRadialSamples=1 - if (PReporting.getIsMegaDebug()) cerr<<"Heal...w:"<=0: - filtered_indexq[filtered_Used]=unfiltered_closest_index - if (PReporting.getIsMegaDebug()) cerr<<"closest:("< (formerly limits.h) or (formerly math.h) or (formerly float.h) - #double xOff - #double yOff - #double rAngleNow - int iDiffusionRad=(int)(rDiffusionMultiplier*filtered_rAvgDist+.5) - int iDiffusionSpread=iDiffusionRad*2+1; #+1 since if -1 to 1 then range is 3 (-1,0,1) which results in 0,1, after modulus by iDiffusionSpread - #subtract radius below since 1 needs to be subtracted from (0,1,2) to get (-1,0,1) - double DiffuseAllRadialSamples_X=(double)( PMath.Abs(rand())%iDiffusionSpread-iDiffusionRad ) - double DiffuseAllRadialSamples_Y=(double)( PMath.Abs(rand())%iDiffusionSpread-iDiffusionRad ) - for (unsigned int filtered_index=0; filtered_indexrMaxDist) rMaxDist=unfiltered_reached_distq[unfiltered_index] - - #NOTE: "(int)" typecast for uiLoc is ok since bFoundAnyZero - unsigned int uiLoc=(int)unfiltered_nonreached_pointq_rqY[unfiltered_index]*dest_Stride+(int)unfiltered_nonreached_pointq_rqX[unfiltered_index]*dest_BytesPP - unfiltered_byqB[unfiltered_index]=dest0[uiLoc+chanB] - unfiltered_byqG[unfiltered_index]=dest0[uiLoc+chanG] - unfiltered_byqR[unfiltered_index]=dest0[uiLoc+chanR] - if (dest_BytesPP>3) unfiltered_byqA[unfiltered_index]=dest0[uiLoc+chanA] - else unfiltered_byqA[unfiltered_index]=255 - #NOTE: weight is not needed yet, color is needed for weighted average below - - else: - Console.Error.WriteLine("Heal error: no background pixel (self should never happen)") - break - #PImage.PushToNearest(unfiltered_reached_pointq_rqX[unfiltered_index],unfiltered_reached_pointq_rqY[unfiltered_index],mask0,mask_w,mask_h,mask_BytesPP,mask_Stride,mask_Channel,1,False) - - }#end for filtered_index, reach and diffusion - #7. get spread (max-min) - double rSpread=0 - if (rMaxDist>=0) and (rMinDist1: - lpDest[chanG]=PMath.ByRound((lpDest[chanG]-colorWA_G)*rCookedAlpha+lpDest[chanG]) - lpDest[chanR]=PMath.ByRound((lpDest[chanR]-colorWA_R)*rCookedAlpha+lpDest[chanR]) - #NOTE: should always use "alpha on alpha" below so alpha gets healed if present - if dest_BytesPP>3) lpDest[chanA]=PMath.ByRound((lpDest[chanA]-colorWA_A)*rCookedAlpha+lpDest[chanA]: - - }#end if non-black pixel (to heal) - lpMask+=mask_BytesPP - lpDest+=dest_BytesPP - }#end for x - lpMaskLine+=mask_Stride - lpDestLine+=dest_Stride - }#end for y - - else Console.Error.WriteLine("Error in Heal: null mask") - #}#end if dest_BytesPP<4 - - else Console.Error.WriteLine("Error in Heal: null dest") - if unfiltered_angleq!=null) free(unfiltered_angleq: - if unfiltered_nonreached_distanceq!=null) free(unfiltered_nonreached_distanceq: - if unfiltered_reached_pointq_rqX!=null) free(unfiltered_reached_pointq_rqX: - if unfiltered_reached_pointq_rqY!=null) free(unfiltered_reached_pointq_rqY: - if unfiltered_nonreached_pointq_rqX!=null) free(unfiltered_nonreached_pointq_rqX: - if unfiltered_nonreached_pointq_rqY!=null) free(unfiltered_nonreached_pointq_rqY: - if unfiltered_reached_distq!=null) free(unfiltered_reached_distq: - if filtered_indexq!=null) free(filtered_indexq: - if unfiltered_byqB!=null) free(unfiltered_byqB: - if unfiltered_byqG!=null) free(unfiltered_byqG: - if unfiltered_byqR!=null) free(unfiltered_byqR: - if unfiltered_byqA!=null) free(unfiltered_byqA: -}#end Heal_WithAveraging_Sequential - -}#end namespace -#endif \ No newline at end of file diff --git a/utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/colorspacetransform.h.py b/utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/colorspacetransform.h.py deleted file mode 100644 index c851fee..0000000 --- a/utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/colorspacetransform.h.py +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef COLORSPACETRANSFORM_H -#define COLORSPACETRANSFORM_H - -#include -#include #rand etc -#include -#include -#include # - -##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 diff --git a/utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/etc/pconvert.cpp.py b/utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/etc/pconvert.cpp.py deleted file mode 100644 index dcb9731..0000000 --- a/utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/etc/pconvert.cpp.py +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef PMATH_CPP -#define PMATH_CPP - - -############/ UNUSED: see Convert in frameworkdummy.h and ByRound in pmath.h - - -#include "pconvert.h" -#include # - -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 \ No newline at end of file diff --git a/utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/etc/pconvert.h.py b/utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/etc/pconvert.h.py deleted file mode 100644 index f923a90..0000000 --- a/utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/etc/pconvert.h.py +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef PCONVERT_H -#define PCONVERT_H - -#include -#include # -#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 \ No newline at end of file diff --git a/utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/f_spatialforegroundremover.cpp.py b/utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/f_spatialforegroundremover.cpp.py deleted file mode 100644 index 7dc06ce..0000000 --- a/utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/f_spatialforegroundremover.cpp.py +++ /dev/null @@ -1,585 +0,0 @@ -##define WIN32_LEAN_AND_MEAN -#include -#include -#include -#include -#include -#include "../resource.h" -#include "f_spatialforegroundremover.h" -#include -#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 # - struct tm * timeinfo - time(&rawtime) - timeinfo=localtime(&rawtime) - cerr<<(timeinfo.tm_year+1900)<<"-"<<(timeinfo.tm_mon+1)<<"-"<<(timeinfo.tm_mday)<<" "<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; iDebug1.0) ? (360.0/((double)mConfig.mRadialSamples*360.0)) : 360.0 - cerr<<"{Reach:"<= 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"<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> 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"<("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.") diff --git a/utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/f_spatialforegroundremover.h.py b/utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/f_spatialforegroundremover.h.py deleted file mode 100644 index a5fb506..0000000 --- a/utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/f_spatialforegroundremover.h.py +++ /dev/null @@ -1,86 +0,0 @@ -#ifndef F_SPATIALFOREGROUNDREMOVER_H -#define F_SPATIALFOREGROUNDREMOVER_H - -#include -#include - -#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 \ No newline at end of file diff --git a/utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/main.cpp.py b/utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/main.cpp.py deleted file mode 100644 index 82d8653..0000000 --- a/utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/main.cpp.py +++ /dev/null @@ -1,7 +0,0 @@ -#include - -VDX_DECLARE_VIDEOFILTERS_BEGIN() -VDX_DECLARE_VIDEOFILTER(filterDef_SpatialForegroundRemover) -VDX_DECLARE_VIDEOFILTERS_END() - -VDX_DECLARE_VFMODULE() diff --git a/utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/pimage.cpp.py b/utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/pimage.cpp.py deleted file mode 100644 index 94297a5..0000000 --- a/utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/pimage.cpp.py +++ /dev/null @@ -1,274 +0,0 @@ -#ifndef PIMAGE_CPP -#define PIMAGE_CPP - -#include "pimage.h" -#include "pmath.h" - -namespace ProtoArmor -bool PImage.bPushToNearest_ShowMaskChannelError=True -bool PImage.bPushToNearestNondirectional_ShowMaskChannelError=True -#/ -#/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) -#/ -#/ -#/ -#/returns False if edge was found before a near pixel was found -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]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]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; ymask_Threshold) - : (mask[uiLoc] -#/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) -#/ -#/ -#/ -#/returns False if edge was found before a near pixel was found -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=0 and iyStartmask_Threshold) - :(mask[uiLoc] -#/Draws to src0 to dest0 at (xDestStart,yDestStart) using mask0 as alpha for source -#--alpha is neither modified on dest0 nor used from src0 -#/ -#/must be same size as source -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,...)..."<=0 and xDestStart=0 and yDestStart=0 and xSrc=0 and ySrc -#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 \ No newline at end of file diff --git a/utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/pstring.cpp.py b/utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/pstring.cpp.py deleted file mode 100644 index d72444c..0000000 --- a/utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/pstring.cpp.py +++ /dev/null @@ -1,39 +0,0 @@ -#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() -#include -#include -#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 \ No newline at end of file diff --git a/utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/targa--nondotnet/targa.cpp.py b/utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/targa--nondotnet/targa.cpp.py deleted file mode 100644 index 98a4c47..0000000 --- a/utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/targa--nondotnet/targa.cpp.py +++ /dev/null @@ -1,1256 +0,0 @@ -#ifndef TARGA_CPP -#define TARGA_CPP - -#include -#include -#include -#include -#include "targa.h" -#include #stringstream etc - -#NOTE: compression/decompression is NOT yet tested and probably doesn't work right. If your program locks up you'll need to fix it yourself or else use an uncompressed Targa file. - -using namespace std - -namespace ProtoArmor -##region static targa functions -def RLESizeUncompressed(self, arrbySrc, iStart, iSrcSize, iBytesPerChunk): - byte* arrbyNull=null - return RLEUncompress(arrbyNull, 0, arrbySrc, iSrcSize, iBytesPerChunk, 0, iStart, True) - -def Compare(self, arrbySrc1, iSrcLoc1, arrbySrc2, iSrcLoc2, iRun): - bool bMatch=False - int iMatch=0 - try - for (int iNow; iNow0) arrbyReturn=(byte*)malloc(iTotal: - else: - bGood=False - cerr<<"RLECompress Error: Compressed total of "<=128) #if high bit is True - bRunIsCompressed=True - iRun=((int)arrbySrc[iSrcAbs]-128)+1 - - else: - bRunIsCompressed=False - iRun=(int)arrbySrc[iSrcAbs]+1 - - #first advance past packet header byte: - iSrcRel++ - iSrcAbs++ - for (iChunkRelNow=0; iChunkRelNow=iDestSizeIrrelevantIfCountOnlyIsTrue: - cerr<<"RLEUncompress Error: Compressed data wanted destination bigger than "<0 and lpbyDataPointerToKeep!=null: - u32SizeofDump=u32Size - dump=lpbyDataPointerToKeep - #TODO: process the footer here - - else: - u32SizeofDump=0 - dump=null - - - catch (exception& exn) - cerr<<"TargaFooter.Init could not finish ("<iMax: - cerr<<"TargaFooter.Init(FILE*) Error: got more than "<0) - if iTotal>0: - self.dump=(byte*)malloc(iTotal) - for (size_t iByte=0; iByte -#/Returns negative or 0 if not all written -#/ -def WriteTo(self, byarrDest, iAtDest, iSizeOfDest): - int iWritten=0 - for (uint iNow=0; iNow=iSizeOfDest: - iWritten*=-1 - break - - byarrDest[iAtDest+iNow]=dump[iNow] - iWritten++ - - return iWritten -}#end WriteTo byter -def ByteCount(self): - return u32SizeofDump - -##endregion TargaFooter methods - -##region Targa methods -Targa.Targa() - InitNull() - -Targa.~Targa() - if arrbyData!=null: - free(arrbyData) - arrbyData=null - - -def BytesPP(self): - return iBytesPP - -def Stride(self): - return iStride - -def BytesAsUncompressed(self): - return iBytesAsUncompressed - -def BytesBuffer(self): - return iBytesBuffer - -def Init(self, iSetWidth, iSetHeight, iSetBytesPP, bReallocateBuffers): - bool bGood=True - if bReallocateBuffers: - if arrbyColorMap!=null: - free(arrbyColorMap) - arrbyColorMap=null - - iMapLength=0 - sID="" - if arrbyData!=null: - free(arrbyData) - arrbyData=null - - - iWidth=iSetWidth - iHeight=iSetHeight - iBitDepth=iSetBytesPP*8 - DeriveVars();#does get iBytesPP - #if (iSetBytesPP==4 or iSetBytesPP==3) TypeTarga=TypeUncompressedTrueColor - #elif (iSetBytesPP==1) TypeTarga=TypeUncompressedGrayscale - iBytesBuffer=iBytesAsUncompressed - if iBytesBuffer<=0: - cerr<<"Targa.Init Error: iBytesBuffer="<0) targaDest.arrbyData=(byte*)malloc(iBytesBuffer: - targaDest.MapType=MapType; #1 byte - targaDest.TypeTarga=TypeTarga; #1 byte - targaDest.iMapOrigin=iMapOrigin; #2 bytes - targaDest.iMapLength=iMapLength; #2 bytes - targaDest.iMapBitDepth=iMapBitDepth; #1 byte - targaDest.xImageLeft=xImageLeft; #2 bytes - targaDest.yImageBottom=yImageBottom; #2 bytes #TODO: don't flip if not zero - targaDest.iWidth=iWidth; #2 bytes - targaDest.iHeight=iHeight; #2 bytes - targaDest.iBitDepth=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) - targaDest.bitsDescriptor=bitsDescriptor; #1 byte #(default zero) - targaDest.sID=sID; #array of [iTagLength] bytes #[bySizeofID] -- custom non-terminated string - targaDest.iBytesPP=iBytesPP - targaDest.iStride=iStride - targaDest.iBytesAsUncompressed=iBytesAsUncompressed;#byte sizeof image data only - targaDest.iBytesBuffer=iBytesBuffer - int iNow - if iBytesBuffer>0: - for (iNow=0; iNow0: - targaDest.arrbyColorMap=(byte*)malloc(iMapLength); #array of [] bytes #[byMapBitDepth*wMapLength] -- the palette - for (iNow=0; iNow=128) #if high bit is True - bRunIsCompressed=True - iRun=((int)arrbyData[iSrcAbs]-128)+1 - - else: - bRunIsCompressed=False - iRun=(int)arrbyData[iSrcAbs]+1 - - #first advance past packet header byte: - iSrcRel++ - iSrcAbs++ - for (iChunkRelNow=0; iChunkRelNow=iDestSize: - cerr<<"DrawFast (same bit depth, uncompressing) Error: Compressed data wanted destination bigger than "<255) sID=sID.substr(0,255: - uint u32IDLenNow=('''sID==null or '''sID=="")?0:(uint)sID.length() - byNow=(byte)u32IDLenNow - fwrite((void*)&byNow, 1, 1, pfileOut) - byNow=(byte)MapType - fwrite((void*)&byNow, 1, 1, pfileOut) - byNow=(byte)TypeTarga - fwrite((void*)&byNow, 1, 1, pfileOut) - wNow=(ushort)iMapOrigin - fwrite((void*)&wNow, 2, 1, pfileOut) - wNow=(ushort)iMapLength - fwrite((void*)&wNow, 2, 1, pfileOut) - byNow=(byte)iMapBitDepth - fwrite((void*)&byNow, 1, 1, pfileOut) - wNow=(ushort)xImageLeft - fwrite((void*)&wNow, 2, 1, pfileOut) - wNow=(ushort)yImageBottom - fwrite((void*)&wNow, 2, 1, pfileOut) - wNow=(ushort)iWidth - fwrite((void*)&wNow, 2, 1, pfileOut) - wNow=(ushort)iHeight - fwrite((void*)&wNow, 2, 1, pfileOut) - byNow=(byte)iBitDepth - fwrite((void*)&byNow, 1, 1, pfileOut) - byNow=(byte)bitsDescriptor - fwrite((void*)&byNow, 1, 1, pfileOut) - if u32IDLenNow>0: - char* carrID=sID.c_str() - for (size_t iChar=0; iChar0: - for (int iNow=0; iNow0: - if arrbyData!=null: - for (int iNow=0; iNow0: - char* carrIn=(char*)malloc(u32IDLenNow+1) - iGot=fread((void*)&carrIn,1,u32IDLenNow,fileNow) - carrIn[u32IDLenNow]='\0'; #ok since size is u32IDLenNow+1 - sID=(string)carrIn - free(carrIn) - if (iGot!=u32IDLenNow) bGood=False - if bFirstRun: - cerr<<"id:"<0: - arrbyColorMap=(byte*)malloc(iMapLength) - - iGot=fread((void*)arrbyColorMap,1,iMapLength,fileNow) - #for (int iNow=0; iNow0: footer.Init(fileNow) - if (bFirstRun) cerr<0 and iHeight>0 and iBytesPP>0 and arrbyData!=null) - if not IsCompressed(): - if (iBytesBuffer!=(iWidth*iHeight*iBytesPP)) bGood=False - if (iBytesBuffer!=iBytesAsUncompressed) bGood=False - - return bGood - -def Flip(self): - bool bGood=True - if not IsOK(): - bGood=False - cerr<<"Targa.Flip Error: Targa is corrupt or did not load properly (IsOK() returned False)not " - - if bGoodandIsCompressed(): - bGood=False - cerr<<"Targa.Flip Error: Targa is still compressed and cannot be flipped before uncompressednot " - - if bGood: - try - byte* arrbyTemp=(byte*)malloc(iBytesBuffer) - int xSrc=0, ySrc=iHeight-1, xDest, yDest - for (yDest=0; yDest -#include -#include -#include -#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 diff --git a/utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/targa.cpp.py b/utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/targa.cpp.py deleted file mode 100644 index 3d4adf8..0000000 --- a/utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/targa.cpp.py +++ /dev/null @@ -1,1390 +0,0 @@ -#ifndef TARGA_CPP -#define TARGA_CPP - -#include -#include -#include -#include -#include "targa.h" -##include "E:\Projects-cpp\Base\targa.h" - -using namespace std - -namespace ProtoArmor -##region static targa functions -def RLESizeUncompressed(self, arrbySrc, iStart, iSrcSize, iBytesPerChunk): - byte* arrbyNull=null - return RLEUncompress(arrbyNull, 0, arrbySrc, iSrcSize, iBytesPerChunk, 0, iStart, True) - -def Compare(self, arrbySrc1, iSrcLoc1, arrbySrc2, iSrcLoc2, iRun): - bool bMatch=False - int iMatch=0 - try - for (int iNow; iNow0) arrbyReturn=(byte*)malloc(iTotal: - else: - bGood=False - PReporting.ShowErr("Compressed total of "+Convert.ToString(iTotal)+Convert.ToString(" wasn't calculated correctly"),"","RLECompress") - - - if bGood: - int iSrcAbs=iSrcStart - int iRun=0 - bool bRunIsCompressed=False - int iSrcRel=0 - #int iNow - bool bPartOfThisTypeOfRun - int iPacketByte=0 - while (iSrcRel=128) #if high bit is True - bRunIsCompressed=True - iRun=((int)arrbySrc[iSrcAbs]-128)+1 - - else: - bRunIsCompressed=False - iRun=(int)arrbySrc[iSrcAbs]+1 - - #first advance past packet header byte: - iSrcRel++ - iSrcAbs++ - for (iChunkRelNow=0; iChunkRelNow=iDestSizeIrrelevantIfCountOnlyIsTrue: - PReporting.ShowErr("Compressed data wanted destination bigger than "+Convert.ToString(iDestSizeIrrelevantIfCountOnlyIsTrue)+" bytes.","","RLEUncompress") - return 0 - - arrbyDest[iDestAbs]=arrbySrc[iSrcAbs+iChunkSubByte] - }#end if actually uncompressing - iDestAbs++ - iDestRel++ - - if not bRunIsCompressed: - #has to be incremented separately here in case pixel needed to be used multiple times in self outer loop - #It is important that we increment past the whole chunk now (self makes sure alignment will be right) instead of iBytesCopiedNow - iSrcRel+=iBytesPerChunk - iSrcAbs+=iBytesPerChunk - - }#end for iChunkRelNow of run - if bRunIsCompressed: - #has to be incremented separately here so that pixel could be used multiple times above - #It is important that we increment past the whole chunk now (self makes sure alignment will be right) instead of iBytesCopiedNow - iSrcRel+=iBytesPerChunk - iSrcAbs+=iBytesPerChunk - - }#end while still any data (iSrcAbs0) - - else: - PReporting.ShowErr("Unreadable BinaryReader was sent to TargaFooter Init","reading targa footer","") - bGood=False - - PMemory.Redim(dump,u32SizeTemp,dump_Length) - return bGood -}#end BinaryReader.Init(BinaryReader&) -def Init(self, arrbyDataSrcToCopyFrom, u32SrcStart, u32Count, u32ActualSourceBufferSize): - bool bGood=True - PMemory.SafeFree(dump) - try - dump_Length=u32Count - dump=(byte*)malloc(u32Count) - uint iSrc=u32SrcStart - for (uint iNow=0; iNow0 and lpbyDataPointerToKeep!=null: - dump_Length=u32Size - dump=lpbyDataPointerToKeep - #TODO: process the footer here - - else: - dump_Length=0 - dump=null - - - catch (exception& exn) - bGood=False - string sMsg="u32Size="+Convert.ToString(u32Size) - sMsg+="; lpbyDataPointerToKeep is" - sMsg+=((lpbyDataPointerToKeep==null)?"null.":"not null.") - PReporting.ShowExn(exn,"TargaFooter.Init"+sMsg) - - catch (...) - bGood=False - PReporting.ShowUnknownExn("","TargaFooter.Init") - - return bGood - -def Init(self): - return Init(null,0) - -def WriteTo(self, &streamOut): - bool bGood=True - for (uint iNow=0; iNow0) targaDest.arrbyData=(byte*)malloc(iBytesBuffer: - targaDest.MapType=MapType; #1 byte - targaDest.TypeTarga=TypeTarga; #1 byte - targaDest.iMapOrigin=iMapOrigin; #2 bytes - targaDest.iMapLength=iMapLength; #2 bytes - targaDest.iMapBitDepth=iMapBitDepth; #1 byte - targaDest.xImageLeft=xImageLeft; #2 bytes - targaDest.yImageBottom=yImageBottom; #2 bytes #TODO: don't flip if not zero - targaDest.iWidth=iWidth; #2 bytes - targaDest.iHeight=iHeight; #2 bytes - targaDest.iBitDepth=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) - targaDest.bitsDescriptor=bitsDescriptor; #1 byte #(default zero) - targaDest.sID=sID; #array of [iTagLength] bytes #[bySizeofID] -- custom non-terminated string - targaDest.iBytesPP=iBytesPP - targaDest.iStride=iStride - targaDest.iBytesAsUncompressed=iBytesAsUncompressed;#byte sizeof image data only - targaDest.iBytesBuffer=iBytesBuffer - int iNow - if iBytesBuffer>0: - for (iNow=0; iNow0: - targaDest.arrbyColorMap=(byte*)malloc(iMapLength); #array of [] bytes #[byMapBitDepth*wMapLength] -- the palette - for (iNow=0; iNow=128) #if high bit is True - bRunIsCompressed=True - iRun=((int)arrbyData[iSrcAbs]-128)+1 - - else: - bRunIsCompressed=False - iRun=(int)arrbyData[iSrcAbs]+1 - - #first advance past packet header byte: - iSrcRel++ - iSrcAbs++ - for (iChunkRelNow=0; iChunkRelNow=iDestSize: - PReporting.ShowErr("Compressed data wanted destination bigger than "+Convert.ToString(iDestSize)+" bytes.","","DrawFast (same bit depth, uncompressing)") - return 0 - - arrbyDest[iDestAbs]=arrbyData[iSrcAbs+iChunkSubByte] - iDestAbs++ - iDestRel++ - - if not bRunIsCompressed: - #has to be incremented separately here in case pixel needed to be used multiple times in self outer loop - #It is important that we increment past the whole chunk now (self makes sure alignment will be right) instead of iBytesCopiedNow - iSrcRel+=iBytesPP - iSrcAbs+=iBytesPP - - xSrcFake++ - if xSrcFake==iWidth: - xSrcFake=0 - iDestRel+=iDestLastXToFirstXOnNextLine - iDestAbs+=iDestLastXToFirstXOnNextLine - - }#end for iChunkRelNow of run - if bRunIsCompressed: - #has to be incremented separately here so that pixel could be used multiple times above - #It is important that we increment past the whole chunk now (self makes sure alignment will be right) instead of iBytesCopiedNow - iSrcRel+=iBytesPP - iSrcAbs+=iBytesPP - - }#end while still any data (iSrcAbs0) iFound+=iGot - - if iNow255) sID=sID.substr(0,255: - uint u32IDLenNow=('''sID==null or '''sID=="")?0:(uint)sID.length(); #NEEDED later! - byNow=Convert.ToByte(u32IDLenNow);# - streamOut.Write(byNow);#id length (see above) - if (streamOut.BaseStream_Position()-iPlacePrev != 1) bGood=False - #(byte)(int)MapType - iPlacePrev=streamOut.BaseStream_Position() - byNow=(byte)MapType; #type of palette - streamOut.Write(byNow); #MapType - if (streamOut.BaseStream_Position()-iPlacePrev != 1) bGood=False - #(byte)(int)TypeTarga - iPlacePrev=streamOut.BaseStream_Position() - byNow=(byte)TypeTarga - streamOut.Write(byNow); #TypeTarga - if (streamOut.BaseStream_Position()-iPlacePrev != 1) bGood=False - #(ushort)iMapOrigin - iPlacePrev=streamOut.BaseStream_Position() - wNow=(ushort)iMapOrigin - streamOut.Write(wNow); #iMapOrigin - if (streamOut.BaseStream_Position()-iPlacePrev != 2) bGood=False - #(ushort)iMapLength - iPlacePrev=streamOut.BaseStream_Position() - wNow=(ushort)iMapLength - streamOut.Write(wNow); #iMapLength (ushort) - if (streamOut.BaseStream_Position()-iPlacePrev != 2) bGood=False - #(byte)iMapBitDepth - iPlacePrev=streamOut.BaseStream_Position() - byNow=(byte)iMapBitDepth; #aka map width - streamOut.Write(byNow); #map bitdepth aka map width (byte) - if (streamOut.BaseStream_Position()-iPlacePrev != 1) bGood=False - #(ushort)xImageLeft - iPlacePrev=streamOut.BaseStream_Position() - wNow=(ushort)xImageLeft - streamOut.Write(wNow); #image left edge (orientation of raw data) - if (streamOut.BaseStream_Position()-iPlacePrev != 2) bGood=False - #(ushort)yImageBottom - iPlacePrev=streamOut.BaseStream_Position() - wNow=(uint)yImageBottom; #aka y origin - streamOut.Write(wNow); #image bottom (orientation of raw data) - if (streamOut.BaseStream_Position()-iPlacePrev != 2) bGood=False - #(ushort)iWidth - iPlacePrev=streamOut.BaseStream_Position() - wNow=(ushort)iWidth - streamOut.Write(wNow); #width - if (streamOut.BaseStream_Position()-iPlacePrev != 2) bGood=False - #(ushort)iHeight - iPlacePrev=streamOut.BaseStream_Position() - wNow=(ushort)iHeight - streamOut.Write(wNow); #height - if (streamOut.BaseStream_Position()-iPlacePrev != 2) bGood=False - #(byte)iBitDepth - iPlacePrev=streamOut.BaseStream_Position() - byNow=(byte)iBitDepth - streamOut.Write(byNow); #bitdepth - if (streamOut.BaseStream_Position()-iPlacePrev != 1) bGood=False - #(byte)bitsDescriptor - iPlacePrev=streamOut.BaseStream_Position() - byNow=(byte)bitsDescriptor - streamOut.Write(byNow); #bitsDescription - if (streamOut.BaseStream_Position()-iPlacePrev != 1) bGood=False - #(byte[length of id])sID - if u32IDLenNow>0) #NOTE: u32IDLenNow was written earlier (see far above: - iPlacePrev=streamOut.BaseStream_Position() - if sID.length()!=u32IDLenNow: - u32IDLenNow=sID.length() - PReporting.ShowErr("u32IDLenNow was not equal to length of sID","saving targa","") - - streamOut.Write(sID);#streamOut.WriteAscii(sID,u32IDLenNow) - if (streamOut.BaseStream_Position()-iPlacePrev != u32IDLenNow) bGood=False - - #(byte[iMapLength])(arrbyColorMap) - if iMapLength>0: - iPlacePrev=streamOut.BaseStream_Position() - streamOut.Write(arrbyColorMap,0,iMapLength) - #for (int iNow=0; iNow0: - if arrbyData!=null: - iPlacePrev=streamOut.BaseStream_Position() - int iLineOffset=0 - if IsSavedAsFlipped(): - iLineOffset=(iHeight-1)*self.iStride - for (int iLine=self.iHeight-1; iLine>=0; iLine--) - if iLineOffset+iStride<=iBytesBuffer) streamOut.Write(arrbyData,iLineOffset,iStride: - else PReporting.ShowErr("Data array was supposed to be "+Convert.ToString(iStride*iHeight)+"bytes for "+Convert.ToString(iWidth)+"x"+Convert.ToString(iHeight)+"x"+Convert.ToString(self.iBitDepth)+" but is "+Convert.ToString(self.iBytesBuffer)+"bytesnot ","saving targa","") - iLineOffset-=iStride - - - else: - for (int iLine=0; iLine0: - iPlacePrev=streamIn.BaseStream_Position() - sID=streamIn.ReadChars_octects(u32IDLenNow) - if (sID.length()!=u32IDLenNow) bGood=False;#if (not streamIn.ReadAscii(sID,u32IDLenNow,u32Test)) bGood=False - if bFirstRun) Console.Error.Write( "id:" + ( bGood ? (sID+"; ") : "missing; " ) : - if (u32Test!=u32IDLenNow) bGood=False - - else sID="" - - #MUST init with True option BEFORE loading map since True option deletes map - Init(iWidth,iHeight,iBytesPP,True); #DOES DeriveVars, buffer; True deletes map; DeriveVars() DOES set iBytesPP, iStride, iBytesAsUncompressed - - #(byte[iMapLength])(arrbyColorMap) - if bFirstRun) Console.Error.Write("map:": - if iMapLength>0: - arrbyColorMap=(byte*)malloc(iMapLength) - iPlacePrev=streamIn.BaseStream_Position() - for (int iNow=0; iNow0: - PMemory.Push(arrbyData,uiBufferSizeTemp,uiBufferSizeUsed,byNow) - iFound+=iGot - - - while (iGot>0) - PMemory.Redim(arrbyData,uiBufferSizeTemp,uiBufferSizeUsed);#frees if size<=0 - #arrbyData=(byte*)malloc(iBytesBuffer) - - - #int iPosPrev=streamIn.BaseStream_Position() - #for (int iNow=0; iNow0: footer.Init(streamIn) - if bFirstRun) Console.Error.Write(Convert.ToString(footer.ByteCount())+"; ": - # - if bFirstRun) Console.Error.Write("} ": - if bFirstRun) Console.Error.Write(bGood?"Targa.Load Success--dump":"Targa.Load Done with errors--dump": - if bFirstRun) Console.Error.Write(Dump(): - if not bGood: - Console.Error.WriteLine("FAILED (Targa.Load)") - - streamIn.Close() - - catch (exception& exn) - bGood=False - PReporting.ShowExn(exn,"","Targa.Load") - - catch (...) - bGood=False - PReporting.ShowUnknownExn("","Targa.Load") - - bFirstRun=False - return bGood -}#end Targa.Load - -def IsOK(self): - bool bGood=(iWidth>0 and iHeight>0 and iBytesPP>0 and arrbyData!=null) - if not IsCompressed(): - if iBytesBuffer!=(iWidth*iHeight*iBytesPP): - bGood=False - cerr<<"Targa.IsOK Error: buffer of uncompressed image is not expected length based on dimensions and color depth"<=iWidth) x=(iWidth-1)-(x-iWidth); #e.g. x=801 and width 800 results in 799-1; e.g. 800 results in 799 - while (x<0) x+=iWidth; #handled same in either case above - - if (y<0) y*=-1; #since reflecting instead of wrapping - elif y>=iHeight) y=(iHeight-1)-(x-iHeight: - while (y<0) y+=iHeight - -def Wrap(self, x, y): - while (x>=iWidth) x-=iWidth - while (x<0) x+=iWidth - while (y>=iHeight) y-=iHeight - while (y<0) y+=iHeight - -def getChannel_Fast(self, x, y, iChan): - if (iChan<=iBytesPP) iChan=iBytesPP-1 - int iAt=y*iStride+x*iBytesPP+iChan - if self.arrbyData!=null: - if (iAt=self.BytesAsUncompressed) : byte* lpData=&self.arrbyData[y*iStride+x*iBytesPP] - if self.iMapLength>0: - int iMapByteDepth=self.iMapBitDepth/8 - byte* lpInPalette=&self.arrbyColorMap[*lpData*iMapByteDepth] - B=*lpInPalette - lpInPalette++ - G=*lpInPalette - lpInPalette++ - R=*lpInPalette - - else #else no colormap - B=*lpData - if iBytesPP>1: - lpData++ - G=*lpData - lpData++ - R=*lpData - - else: - G=*lpData - R=*lpData - - }#end else does not have palette - #}#end if any image data -}#end getColorRgb_Fast -def getColorArgb_Fast(self, A, R, G, B, x, y): - #if (self.arrbyData!=null) and (self.BytesBuffer>=self.BytesAsUncompressed) : byte* lpData=&self.arrbyData[y*iStride+x*iBytesPP] - if self.iMapLength>0: - int iMapByteDepth=self.iMapBitDepth/8 - byte* lpInPalette=&self.arrbyColorMap[*lpData*iMapByteDepth] - B=*lpInPalette - lpInPalette++ - G=*lpInPalette - lpInPalette++ - R=*lpInPalette - if iMapByteDepth>3: - lpInPalette++ - A=*lpInPalette - - else A=255 - - else #else no colormap - B=*lpData - if iBytesPP>1: - lpData++ - G=*lpData - lpData++ - R=*lpData - if iBytesPP>3: - lpData++ - A=*lpData - - else A=255 - - else: - G=*lpData - R=*lpData - A=*lpData - - }#end else does not have palette - #}#end if any image data -}#end getColorArgb_Fast -}#end namespace - -#endif diff --git a/utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/targa.h.py b/utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/targa.h.py deleted file mode 100644 index 19e6a36..0000000 --- a/utilities/gimp/SpatialForegroundRemover-python/src/SpatialForegroundRemover/source/targa.h.py +++ /dev/null @@ -1,151 +0,0 @@ -#ifndef TARGA_H -#define TARGA_H - -#include -#include -#include -#include -#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) - - #/ - #/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 - #/ - 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 diff --git a/utilities/gimp/SpatialForegroundRemover-python/src/VDXFrame/include/stdafx.h.py b/utilities/gimp/SpatialForegroundRemover-python/src/VDXFrame/include/stdafx.h.py deleted file mode 100644 index d598060..0000000 --- a/utilities/gimp/SpatialForegroundRemover-python/src/VDXFrame/include/stdafx.h.py +++ /dev/null @@ -1,33 +0,0 @@ -# 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 -#include -#include -#include -#include - -#include diff --git a/utilities/gimp/SpatialForegroundRemover-python/src/VDXFrame/source/VideoFilter.cpp.py b/utilities/gimp/SpatialForegroundRemover-python/src/VDXFrame/source/VideoFilter.cpp.py deleted file mode 100644 index 8f61a32..0000000 --- a/utilities/gimp/SpatialForegroundRemover-python/src/VDXFrame/source/VideoFilter.cpp.py +++ /dev/null @@ -1,220 +0,0 @@ -# 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 - -#####################################/ - -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(fa.filter_data)).~VDXVideoFilter() - - -int __cdecl VDXVideoFilter.FilterRun ( VDXFilterActivation *fa, *ff) - VDXVideoFilter *pThis = *reinterpret_cast(fa.filter_data) - - pThis.fa = const_cast(fa) - - pThis.Run() - return 0 - - -long __cdecl VDXVideoFilter.FilterParam (VDXFilterActivation *fa, *ff) - VDXVideoFilter *pThis = *reinterpret_cast(fa.filter_data) - - pThis.fa = fa - - return pThis.GetParams() - - -int __cdecl VDXVideoFilter.FilterConfig (VDXFilterActivation *fa, *ff, hwnd) - VDXVideoFilter *pThis = *reinterpret_cast(fa.filter_data) - - pThis.fa = fa - - return not pThis.Configure(hwnd) - - -int __cdecl VDXVideoFilter.FilterStart (VDXFilterActivation *fa, *ff) - VDXVideoFilter *pThis = *reinterpret_cast(fa.filter_data) - - pThis.fa = fa - - pThis.Start() - return 0 - - -int __cdecl VDXVideoFilter.FilterEnd (VDXFilterActivation *fa, *ff) - VDXVideoFilter *pThis = *reinterpret_cast(fa.filter_data) - - pThis.fa = fa - - pThis.End() - return 0 - - -void __cdecl VDXVideoFilter.FilterString ( VDXFilterActivation *fa, *ff, *buf) - VDXVideoFilter *pThis = *reinterpret_cast(fa.filter_data) - - pThis.fa = const_cast(fa) - - pThis.GetScriptString(buf, 80) - - -bool __cdecl VDXVideoFilter.FilterScriptStr(VDXFilterActivation *fa, *ff, *buf, buflen) - VDXVideoFilter *pThis = *reinterpret_cast(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(fa.filter_data) - - pThis.fa = const_cast(fa) - - pThis.GetSettingString(buf, maxlen) - - -int __cdecl VDXVideoFilter.FilterSerialize (VDXFilterActivation *fa, *ff, *buf, maxbuf) - VDXVideoFilter *pThis = *reinterpret_cast(fa.filter_data) - - pThis.fa = fa - - return pThis.Serialize(buf, maxbuf) - - -void __cdecl VDXVideoFilter.FilterDeserialize (VDXFilterActivation *fa, *ff, *buf, maxbuf) - VDXVideoFilter *pThis = *reinterpret_cast(fa.filter_data) - - pThis.fa = fa - - pThis.Deserialize(buf, maxbuf) - - -sint64 __cdecl VDXVideoFilter.FilterPrefetch( VDXFilterActivation *fa, *ff, frame) - VDXVideoFilter *pThis = *reinterpret_cast(fa.filter_data) - - pThis.fa = const_cast(fa) - - return pThis.Prefetch(frame) - - -bool __cdecl VDXVideoFilter.FilterPrefetch2( VDXFilterActivation *fa, *ff, frame, *prefetcher) - VDXVideoFilter *pThis = *reinterpret_cast(fa.filter_data) - - pThis.fa = const_cast(fa) - - return pThis.Prefetch2(frame, prefetcher) - - -bool __cdecl VDXVideoFilter.FilterEvent( VDXFilterActivation *fa, *ff, event, *eventData) - VDXVideoFilter *pThis = *reinterpret_cast(fa.filter_data) - - pThis.fa = const_cast(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 diff --git a/utilities/gimp/SpatialForegroundRemover-python/src/VDXFrame/source/VideoFilterDialog.cpp.py b/utilities/gimp/SpatialForegroundRemover-python/src/VDXFrame/source/VideoFilterDialog.cpp.py deleted file mode 100644 index ce77c81..0000000 --- a/utilities/gimp/SpatialForegroundRemover-python/src/VDXFrame/source/VideoFilterDialog.cpp.py +++ /dev/null @@ -1,95 +0,0 @@ -# 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 -#include - -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 - diff --git a/utilities/gimp/SpatialForegroundRemover-python/src/VDXFrame/source/VideoFilterEntry.cpp.py b/utilities/gimp/SpatialForegroundRemover-python/src/VDXFrame/source/VideoFilterEntry.cpp.py deleted file mode 100644 index 6f30766..0000000 --- a/utilities/gimp/SpatialForegroundRemover-python/src/VDXFrame/source/VideoFilterEntry.cpp.py +++ /dev/null @@ -1,72 +0,0 @@ -# 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 - -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=0; --i) - VDXFilterDefinition *def = g_VDXRegisteredFilters[i] - - if def: - ff.removeFilter(def) - - - free(g_VDXRegisteredFilters) - g_VDXRegisteredFilters = NULL - - - -def VDXGetVideoFilterAPIVersion(self): - return g_VFVAPIVersion - diff --git a/utilities/gimp/SpatialForegroundRemover-python/src/VDXFrame/source/stdafx.cpp.py b/utilities/gimp/SpatialForegroundRemover-python/src/VDXFrame/source/stdafx.cpp.py deleted file mode 100644 index 19fdf9a..0000000 --- a/utilities/gimp/SpatialForegroundRemover-python/src/VDXFrame/source/stdafx.cpp.py +++ /dev/null @@ -1,25 +0,0 @@ -# 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"