forked from mia/Aegisub
fixed compilation problems
removed old files define AEGISUB Originally committed to SVN as r204.
This commit is contained in:
parent
212753e826
commit
2a87445078
18 changed files with 16 additions and 380 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -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 ));
|
||||
}
|
||||
|
||||
|
|
|
@ -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 <math.h>
|
||||
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
|
||||
}
|
|
@ -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
|
||||
}
|
|
@ -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 );
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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_)
|
||||
|
|
|
@ -221,7 +221,8 @@ void FexTracker::FindFeatures( int minFeatures )
|
|||
|
||||
for( int i=0;i<nli && nActiveFeatures<minFeatures;i++ )
|
||||
{
|
||||
for( int j=0;j<nFeatures;j++ )
|
||||
int j;
|
||||
for( j=0;j<nFeatures;j++ )
|
||||
{
|
||||
if( lFeatures[j].StartTime + lFeatures[j].Pos.size() < CurFrame ) continue; //feature was lost
|
||||
|
||||
|
@ -284,7 +285,8 @@ void FexTracker::TrackFeatures()
|
|||
vec2 np;
|
||||
np = op;
|
||||
|
||||
for( int l=CurImg->nLevels-1;l>=0;l-- )
|
||||
int l;
|
||||
for( l=CurImg->nLevels-1;l>=0;l-- )
|
||||
{
|
||||
op.x *= CurImg->Subsampling;
|
||||
op.y *= CurImg->Subsampling;
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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<FexMovementFrame> 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_)
|
|
@ -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 );
|
||||
|
||||
|
|
@ -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<vec2> Pos;
|
||||
|
||||
int StartTime;
|
||||
|
||||
float Influence;
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_FEXTRACKINGFEATURE_H__23B42013_9F11_467C_A0F6_F9E647D45CEB__INCLUDED_)
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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() );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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<nVal;i++ )
|
||||
{
|
||||
lVal[i] = lVal[i+n];
|
||||
}
|
||||
}
|
||||
|
||||
type& operator[]( int i ) const
|
||||
{ return lVal[i]; }
|
||||
};
|
Loading…
Reference in a new issue