diff --git a/FexTracker/FexTrackerRel.dll b/FexTracker/FexTrackerRel.dll deleted file mode 100644 index ec21dce6c..000000000 Binary files a/FexTracker/FexTrackerRel.dll and /dev/null differ diff --git a/FexTracker/FexTrackerRel.lib b/FexTracker/FexTrackerRel.lib deleted file mode 100644 index bbf65d7a6..000000000 Binary files a/FexTracker/FexTrackerRel.lib and /dev/null differ diff --git a/FexTracker/FexTrackerRel_Opti.dll b/FexTracker/FexTrackerRel_Opti.dll deleted file mode 100644 index e42e28823..000000000 Binary files a/FexTracker/FexTrackerRel_Opti.dll and /dev/null differ diff --git a/FexTracker/FexTrackerRel_Opti.lib b/FexTracker/FexTrackerRel_Opti.lib deleted file mode 100644 index a28790aca..000000000 Binary files a/FexTracker/FexTrackerRel_Opti.lib and /dev/null differ diff --git a/FexTrackerSource/FexGenericFilter.cpp b/FexTrackerSource/FexGenericFilter.cpp index 5ac8c8306..51c428838 100644 --- a/FexTrackerSource/FexGenericFilter.cpp +++ b/FexTrackerSource/FexGenericFilter.cpp @@ -72,7 +72,7 @@ FexFilter_GaussDerivation::FexFilter_GaussDerivation( double sigma ) { Sigma = sigma; TwoSigmaSq = 2*sigma*sigma; - Width = sqrt( TwoSigmaSq*log(10) ); + Width = 2.145966026 * sigma; Normalize = 1.0 / (0.7062351183 * pow( TwoSigmaSq, 1.5 )); } diff --git a/FexTrackerSource/FexGenericFilter_FexImage.cpp b/FexTrackerSource/FexGenericFilter_FexImage.cpp deleted file mode 100644 index ed36a7ea4..000000000 --- a/FexTrackerSource/FexGenericFilter_FexImage.cpp +++ /dev/null @@ -1,50 +0,0 @@ -// This file is part of FexGenericFilter and (C) 2006 by Hajo Krabbenhöft (tentacle) -// All rights reserved but the aegisub project is allowed to use it. - -#include "stdafx.h" -#include "FexSystem.h" -#include "ext\imdebug.h" - - -void FexImage_Filter( FexImage* in, FexFilter* filter, FexImage* out ) -{ -#define FilterWidth (filter->Width) -#define FilterWeight(t) (filter->Filter(t)) - -#include "FexGenericFilter_FexImageApply.h" - -#undef FilterWidth -#undef FilterWeight -} - - - - -#include -inline double sinc( double x ) -{ - x *= 3.1415; - if( x != 0 ) - return( sin(x) / x ); - return( 1.0 ); -} -inline double RescaleFilter( double t ) -{ - if( t < 0 ) - t = -t; - if( t < 3.0 ) - return( sinc(t) * sinc(t/3.0) ); - return( 0.0 ); -} - - -void FexImage_Rescale( FexImage* in, FexImage* out ) -{ -#define FilterWidth (3) -#define FilterWeight(t) (RescaleFilter(t)) - -#include "FexGenericFilter_FexImageApply.h" - -#undef FilterWidth -#undef FilterWeight -} diff --git a/FexTrackerSource/FexGenericFilter_FexImageApply.h b/FexTrackerSource/FexGenericFilter_FexImageApply.h deleted file mode 100644 index 721828ca5..000000000 --- a/FexTrackerSource/FexGenericFilter_FexImageApply.h +++ /dev/null @@ -1,49 +0,0 @@ -// This file is part of FexGenericFilter and (C) 2006 by Hajo Krabbenhöft (tentacle) -// All rights reserved but the aegisub project is allowed to use it. - -{ -#define PixelType BYTE -#define PixelMin 0 -#define PixelMax 255.9 -#define ImagePlanes 4 - - FexImage* tmp = new FexImage(out->sx,in->sy); - - //do filtering + scaling in x-dir -#define ImageInSX (in->sx) -#define ImageInSY (in->sy) -#define ImageIn(x,y,p) (in->data[ (y*in->sx+x)*4 + p ]) -#define ImageOutSX (tmp->sx) -#define ImageOut(x,y,p) (tmp->data[ (y*tmp->sx+x)*4 + p ]) - -#include "FexGenericFilter_FilteringCore.h" - -#undef ImageInSX -#undef ImageInSY -#undef ImageIn -#undef ImageOutSX -#undef ImageOut - - //do filtering + scaling in y-dir by using transposed image - -#define ImageInSX (tmp->sy) -#define ImageInSY (tmp->sx) -#define ImageIn(y,x,p) (tmp->data[ (y*tmp->sx+x)*4 + p ]) -#define ImageOutSX (out->sy) -#define ImageOut(y,x,p) (out->data[ (y*out->sx+x)*4 + p ]) - -#include "FexGenericFilter_FilteringCore.h" - -#undef ImageInSX -#undef ImageInSY -#undef ImageIn -#undef ImageOutSX -#undef ImageOut - - delete tmp; - -#undef PixelType -#undef PixelMin -#undef PixelMax -#undef ImagePlanes -} \ No newline at end of file diff --git a/FexTrackerSource/FexImgPyramid.cpp b/FexTrackerSource/FexImgPyramid.cpp index 7d2830a93..492a27151 100644 --- a/FexTrackerSource/FexImgPyramid.cpp +++ b/FexTrackerSource/FexImgPyramid.cpp @@ -7,7 +7,7 @@ #include "StdAfx.h" #include "FexImgPyramid.h" -#include "../FexGenericFilter/FexGenericFilter_Include.h" +#include "FexGenericFilter_Include.h" void BaseFloatImage_GaussEdgeDetect( float* Img, int sizx, int sizy, float sigma, float* GradX, float* GradY ); void BaseFloatImage_GaussSmooth( float* Img, int sizx, int sizy, float sigma, float* Out ); diff --git a/FexTrackerSource/FexMovement.cpp b/FexTrackerSource/FexMovement.cpp index fdcfba3a8..ec8f4a983 100644 --- a/FexTrackerSource/FexMovement.cpp +++ b/FexTrackerSource/FexMovement.cpp @@ -32,7 +32,7 @@ FEXTRACKER_API FexMovement* CreateMovement() return new FexMovement(); } -FEXTRACKER_API void LoadMovement( FexMovement* me, const unsigned short* Filename ) +FEXTRACKER_API void LoadMovement( FexMovement* me, const wchar_t* Filename ) { me->Frames.nVal = 0; @@ -58,7 +58,7 @@ FEXTRACKER_API void LoadMovement( FexMovement* me, const unsigned short* Filenam } fclose( fi ); } -FEXTRACKER_API void SaveMovement( FexMovement* me, const unsigned short* Filename ) +FEXTRACKER_API void SaveMovement( FexMovement* me, const wchar_t* Filename ) { FILE *fi = _wfopen( Filename, L"wt" ); if( !fi ) return; diff --git a/FexTrackerSource/FexMovement.h b/FexTrackerSource/FexMovement.h index a0a9c7221..e251f63b0 100644 --- a/FexTrackerSource/FexMovement.h +++ b/FexTrackerSource/FexMovement.h @@ -32,8 +32,8 @@ public: }; FEXTRACKER_API FexMovement* CreateMovement(); -FEXTRACKER_API void LoadMovement( FexMovement* me, const unsigned short* Filename ); -FEXTRACKER_API void SaveMovement( FexMovement* me, const unsigned short* Filename ); +FEXTRACKER_API void LoadMovement( FexMovement* me, const wchar_t* Filename ); +FEXTRACKER_API void SaveMovement( FexMovement* me, const wchar_t* Filename ); FEXTRACKER_API void DeleteMovement( FexMovement* delme ); #endif // !defined(AFX_FEXMOVEMENT_H__63D8ADD8_4EA1_4C56_8D6F_7B587A1A61A4__INCLUDED_) diff --git a/FexTrackerSource/FexTracker.cpp b/FexTrackerSource/FexTracker.cpp index b6b7857c7..4cf5739d9 100644 --- a/FexTrackerSource/FexTracker.cpp +++ b/FexTrackerSource/FexTracker.cpp @@ -221,7 +221,8 @@ void FexTracker::FindFeatures( int minFeatures ) for( int i=0;inLevels-1;l>=0;l-- ) + int l; + for( l=CurImg->nLevels-1;l>=0;l-- ) { op.x *= CurImg->Subsampling; op.y *= CurImg->Subsampling; diff --git a/FexTrackerSource/FexTracker.h b/FexTrackerSource/FexTracker.h index 943107334..91387da57 100644 --- a/FexTrackerSource/FexTracker.h +++ b/FexTrackerSource/FexTracker.h @@ -8,11 +8,15 @@ // that uses this DLL. This way any other project whose source files include this file see // FEXTRACKER_API functions as being imported from a DLL, wheras this DLL sees symbols // defined with this macro as being exported. +#ifndef AEGISUB #ifdef FEXTRACKER_EXPORTS #define FEXTRACKER_API __declspec(dllexport) #else #define FEXTRACKER_API __declspec(dllimport) #endif +#else +#define FEXTRACKER_API +#endif diff --git a/core/FexMovement.h b/core/FexMovement.h deleted file mode 100644 index a0a9c7221..000000000 --- a/core/FexMovement.h +++ /dev/null @@ -1,39 +0,0 @@ -// This file is part of FexTracker and (C) 2006 by Hajo Krabbenhöft (tentacle) -// All rights reserved but the aegisub project is allowed to use it. - -// FexMovement.h: interface for the FexMovement class. -// -////////////////////////////////////////////////////////////////////// - -#if !defined(AFX_FEXMOVEMENT_H__63D8ADD8_4EA1_4C56_8D6F_7B587A1A61A4__INCLUDED_) -#define AFX_FEXMOVEMENT_H__63D8ADD8_4EA1_4C56_8D6F_7B587A1A61A4__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -typedef struct -{ - vec2 Pos; - vec3 Rot; - vec2 Scale; -}FexMovementFrame; - -#include "tenlist.h" - -class FexMovement -{ -public: - FexMovement(); - ~FexMovement(); - WCHAR* FileName; - - tenlist Frames; -}; - -FEXTRACKER_API FexMovement* CreateMovement(); -FEXTRACKER_API void LoadMovement( FexMovement* me, const unsigned short* Filename ); -FEXTRACKER_API void SaveMovement( FexMovement* me, const unsigned short* Filename ); -FEXTRACKER_API void DeleteMovement( FexMovement* delme ); - -#endif // !defined(AFX_FEXMOVEMENT_H__63D8ADD8_4EA1_4C56_8D6F_7B587A1A61A4__INCLUDED_) diff --git a/core/FexTracker.h b/core/FexTracker.h deleted file mode 100644 index 943107334..000000000 --- a/core/FexTracker.h +++ /dev/null @@ -1,134 +0,0 @@ -// This file is part of FexTracker and (C) 2006 by Hajo Krabbenhöft (tentacle) -// All rights reserved but the aegisub project is allowed to use it. - - -// The following ifdef block is the standard way of creating macros which make exporting -// from a DLL simpler. All files within this DLL are compiled with the FEXTRACKER_EXPORTS -// symbol defined on the command line. this symbol should not be defined on any project -// that uses this DLL. This way any other project whose source files include this file see -// FEXTRACKER_API functions as being imported from a DLL, wheras this DLL sees symbols -// defined with this macro as being exported. -#ifdef FEXTRACKER_EXPORTS -#define FEXTRACKER_API __declspec(dllexport) -#else -#define FEXTRACKER_API __declspec(dllimport) -#endif - - - -class FEXTRACKER_API FexTrackerConfig -{ -public: - inline FexTrackerConfig() : - FeatureNumber(0), - EdgeDetectSigma(1.f), - WindowX(3), WindowY(3), - SearchRange(15), - MaxIterations(10), - MinDeterminant(0.01f), - MinDisplacement(0.1f), - MaxResidue(10.f), - IgnoreLightning(0), - DetectSmoothSigma(0.9f), - MinDistanceSquare(100.f) - {}; - - int FeatureNumber; - - int WindowX, WindowY; //static const int window_size = 7; - int SearchRange; - - float DetectSmoothSigma; //static const float pyramid_sigma_fact = 0.9f; - float EdgeDetectSigma; //static const float grad_sigma = 1.0f; - - int MaxIterations; //static const int max_iterations = 10; - float MinDeterminant; //static const float min_determinant = 0.01f; - float MinDisplacement; //static const float min_displacement = 0.1f; - float MaxResidue; //static const float max_residue = 10.0f; - - bool IgnoreLightning; //static const KLT_BOOL lighting_insensitive = FALSE; - - float MinDistanceSquare; //static const int mindist = 10; - - //static const int min_eigenvalue = 1; - //static const float smooth_sigma_fact = 0.1f; - //static const KLT_BOOL sequentialMode = FALSE; - ///* for affine mapping*/ - //static const int affineConsistencyCheck = -1; - //static const int affine_window_size = 15; - //static const int affine_max_iterations = 10; - //static const float affine_max_residue = 10.0; - //static const float affine_min_displacement = 0.02f; - //static const float affine_max_displacement_differ = 1.5f; -}; - -typedef struct{ - float x, y; -}vec2; - -typedef struct{ - float x, y, z; -}vec3; - -class FexImgPyramid; -class FexTrackingFeature; -class FexMovement; - -class FEXTRACKER_API FexTracker -{ -public: - FexTracker( int sx, int sy, int nFeatures ); - ~FexTracker(); -//config - FexTrackerConfig Cfg; -//work - void ProcessImage( float *Img, bool bFirst=0 ); //we assume grayscale image here - void ProcessingDone(); // call after last call to ProcessImage to clear temporary storage - -//point -> movement - void InfluenceFeatures( int Frame, float x, float y, float off ); - FexMovement* GetMovement(); - -//feature access - FexTrackingFeature* operator [] ( int i ); - inline int GetCount(){ return nFeatures; }; - inline int GetFrame(){ return CurFrame; }; - inline int GetSizeX(){ return SizX; }; - inline int GetSizeY(){ return SizY; }; - - bool bDebug; - int minFeatures; -private: - int SizX, SizY; - int PyramidSubsampling; - int PyramidMaxLevels; - FexImgPyramid* CurImg; - FexImgPyramid* NextImg; - - void FindFeatures( int minFeatures ); - void TrackFeatures(); - - bool TrackOneFeature( int lvl, vec2 op, vec2& np ); - int GetEigenvalueForPoint( int px, int py ); - void GetDiffForPointset( int lvl, vec2 op, vec2 np, float* diff ); - void GetGradForPointset( int lvl, vec2 op, vec2 np, float* gradx, float* grady ); - - void CountActiveFeatures(); - -//result - FexTrackingFeature* lFeatures; - int nFeatures; - int nActiveFeatures; - int mFeatures; - - int CurFrame; -}; - - - -FEXTRACKER_API void FexBaseResize( float* out, int newx, int newy, float* in, int sizx, int sizy ); -FEXTRACKER_API void GaussKernelWidths( float sigma, int *gauss_width, int *gaussderiv_width ); -FEXTRACKER_API void GaussEdgeDetect( float* Img, int sizx, int sizy, float sigma, float* GradX, float* GradY ); -FEXTRACKER_API void GaussSmooth( float* Img, int sizx, int sizy, float sigma, float* Out ); - - diff --git a/core/FexTrackingFeature.h b/core/FexTrackingFeature.h deleted file mode 100644 index fc48da729..000000000 --- a/core/FexTrackingFeature.h +++ /dev/null @@ -1,30 +0,0 @@ -// This file is part of FexTracker and (C) 2006 by Hajo Krabbenhöft (tentacle) -// All rights reserved but the aegisub project is allowed to use it. - -// FexTrackingFeature.h: interface for the FexTrackingFeature class. -// -////////////////////////////////////////////////////////////////////// - -#if !defined(AFX_FEXTRACKINGFEATURE_H__23B42013_9F11_467C_A0F6_F9E647D45CEB__INCLUDED_) -#define AFX_FEXTRACKINGFEATURE_H__23B42013_9F11_467C_A0F6_F9E647D45CEB__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#include "tenlist.h" -class FexTrackingFeature -{ -public: - FexTrackingFeature(); - ~FexTrackingFeature(); - - int Eigenvalue; - tenlist Pos; - - int StartTime; - - float Influence; -}; - -#endif // !defined(AFX_FEXTRACKINGFEATURE_H__23B42013_9F11_467C_A0F6_F9E647D45CEB__INCLUDED_) diff --git a/core/ass_dialogue.cpp b/core/ass_dialogue.cpp index 94c40fd78..7e46d2a39 100644 --- a/core/ass_dialogue.cpp +++ b/core/ass_dialogue.cpp @@ -198,7 +198,7 @@ bool AssDialogue::Parse(wxString rawData, bool IsSSA) { { if( Movement ) DeleteMovement( Movement ); Movement = CreateMovement(); - LoadMovement( Movement, (unsigned short*) Effect.AfterFirst(':').c_str() ); + LoadMovement( Movement, Effect.AfterFirst(':').c_str() ); } #endif diff --git a/core/fextracker_main_events.cpp b/core/fextracker_main_events.cpp index 16270b1f1..f70e98d66 100644 --- a/core/fextracker_main_events.cpp +++ b/core/fextracker_main_events.cpp @@ -236,7 +236,7 @@ void FrameMain::OnVideoTrackLinkFile(wxCommandEvent &event) { curline->UpdateData(); if( !curline->Effect.empty() && curline->Movement ) - SaveMovement( curline->Movement, (unsigned short*) curline->Effect.AfterFirst(':').c_str() ); + SaveMovement( curline->Movement, curline->Effect.AfterFirst(':').c_str() ); } diff --git a/core/tenlist.h b/core/tenlist.h deleted file mode 100644 index 8622c853e..000000000 --- a/core/tenlist.h +++ /dev/null @@ -1,68 +0,0 @@ -// This file is part of FexTracker and (C) 2006 by Hajo Krabbenhöft (tentacle) -// All rights reserved but the aegisub project is allowed to use it. - -#pragma once - -template< class type > - class tenlist { -public: - int nVal; - int mVal; - type* lVal; - - inline tenlist() - { - mVal = 0; - nVal = 0; - lVal = 0; - //zero everything since we well over-zero it anyway - } - inline ~tenlist() - { - free( lVal ); - } - - inline int size() - { - return nVal; - } - - inline void Add( type t ) - { - if( nVal+1 >= mVal ) - { - mVal += 8; - lVal = (type*)realloc( lVal, sizeof(type)*mVal ); - memset( lVal+nVal, 0x00, sizeof(type)*(mVal-nVal) ); //lVal+nVal, since it'll be multiplied by sizeof(type) due to lVal being a type* - } - lVal[nVal++] = t; - } - - inline void AddStr( type t ) - { - if( nVal+1 >= mVal ) - { - mVal += 8; - lVal = (type*)realloc( lVal, sizeof(type)*mVal ); - memset( lVal+nVal, 0x00, sizeof(type)*(mVal-nVal) ); //lVal+nVal, since it'll be multiplied by sizeof(type) due to lVal being a type* - } - strcpy( lVal[nVal++], t ); - } - - inline void Rem( int n ) - { - if( n>=nVal ) - { - nVal = 0; - return; - } - - for( int i=0;i