HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CL_TimeWarp.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: CL_TimeWarp.h ( Clip Library, C++)
7  *
8  * COMMENTS:
9  *
10  */
11 
12 #ifndef __CL_TimeWarp_h__
13 #define __CL_TimeWarp_h__
14 
15 #include "CL_API.h"
16 #include <UT/UT_Matrix3.h>
17 #include <UT/UT_SharedPtr.h>
18 #include <UT/UT_String.h>
19 #include <UT/UT_UniquePtr.h>
20 #include <UT/UT_ValArray.h>
21 #include <UT/UT_Vector3.h>
22 
23 class UT_OStream;
24 class CL_Clip;
25 class CL_Track;
26 
28 {
29 public:
30  CL_TimeWarp();
31  virtual ~CL_TimeWarp();
32 
33  fpreal linearWarp(fpreal sample, int warp_length);
34  void interpolateWarp();
35  fpreal warpSample(fpreal sample);
36  bool warpIsValid() { return myWarpIsValid; }
37  int warpLength() { return myWarpLength; }
38 
39  bool setNumChannels(int num_channels,
40  int src_channel_length,
41  int ref_channel_length);
42 
43  bool addChannel(const fpreal *input_src_channel,
44  const fpreal *input_ref_channel);
45 
46  bool addMotionChannels(const fpreal *src_tx_channel,
47  const fpreal *src_ty_channel,
48  const fpreal *src_tz_channel,
49  const fpreal *ref_tx_channel,
50  const fpreal *ref_ty_channel,
51  const fpreal *ref_tz_channel);
52 
53  void setRootTrnChannels(const fpreal *tx_channel,
54  const fpreal *ty_channel,
55  const fpreal *tz_channel,
56  bool set_src);
57 
58  void setRootRotChannels(const fpreal *rx_channel,
59  const fpreal *ry_channel,
60  const fpreal *rz_channel,
61  bool set_src);
62 
63  void processMotionChannels();
64 
66  { return mySrcChannels.get()+i*mySrcChannelLength; }
67  fpreal* refChannel(int i)
68  { return myRefChannels.get()+i*myRefChannelLength; }
69 
70 protected:
71  void getRootTrnVec(int i, UT_Vector3R &vec, bool get_src);
72  void getRootRotVec(int i, UT_Vector3R &vec, bool get_src);
73  void getRootRotMat(int i, UT_Matrix3R &mat,
74  UT_Matrix3R &inv_mat, bool get_src);
75 
76 private:
77  void resetChannels();
78 
79 protected:
82 
84 
86  UT_UniquePtr<fpreal[]> myRefRootTrnChannels[3];
87  UT_UniquePtr<fpreal[]> myRefRootRotChannels[3];
89 
91  UT_UniquePtr<fpreal[]> mySrcRootTrnChannels[3];
92  UT_UniquePtr<fpreal[]> mySrcRootRotChannels[3];
94 
98 };
99 
100 #endif
int myCurrentNumChannels
Definition: CL_TimeWarp.h:80
fpreal * refChannel(int i)
Definition: CL_TimeWarp.h:67
fpreal * srcChannel(int i)
Definition: CL_TimeWarp.h:65
int myWarpLength
Definition: CL_TimeWarp.h:96
UT_UniquePtr< fpreal[]> myRefChannels
Definition: CL_TimeWarp.h:85
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:33
#define CL_API
Definition: CL_API.h:10
int myNumChannels
Definition: CL_TimeWarp.h:81
bool myWarpIsValid
Definition: CL_TimeWarp.h:95
int warpLength()
Definition: CL_TimeWarp.h:37
int myRefChannelLength
Definition: CL_TimeWarp.h:88
UT_UniquePtr< fpreal[]> myWarpMap
Definition: CL_TimeWarp.h:97
UT_UniquePtr< fpreal[]> mySrcChannels
Definition: CL_TimeWarp.h:90
bool warpIsValid()
Definition: CL_TimeWarp.h:36
UT_Array< int > myTrnChannels
Definition: CL_TimeWarp.h:83
fpreal64 fpreal
Definition: SYS_Types.h:277
int mySrcChannelLength
Definition: CL_TimeWarp.h:93