HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CL_GuidedTimeWarp.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_GuidedTimeWarp.h ( Clip Library, C++)
7  *
8  * COMMENTS:
9  *
10  */
11 
12 #ifndef __CL_GuidedTimeWarp_h__
13 #define __CL_GuidedTimeWarp_h__
14 
15 #include "CL_API.h"
16 #include <UT/UT_String.h>
17 #include <UT/UT_UniquePtr.h>
18 #include <UT/UT_WorkBuffer.h>
19 
20 #include "CL_TimeWarp.h"
21 
22 class UT_OStream;
23 class CL_Clip;
24 class CL_Track;
25 
27 {
28 public:
29 
31  ~CL_GuidedTimeWarp() override;
32 
33  void warpClip(fpreal src_fps,
34  fpreal ref_fps,
35  int max_step,
36  int warp_length,
37  int knn,
38  fpreal path_length_weight,
39  bool use_warp_length,
40  UT_WorkBuffer &error_msg);
41 
42 private:
43 
44  void computeMotionVector(bool get_src,
45  int i, int j, int k,
46  fpreal *feature_vec);
47  void computeRefMotionVectors();
48 
49  void initSmallestK(fpreal *smallest, int k);
50  void updateSmallestK(fpreal *smallest, int k, fpreal candidate);
51  fpreal averageSmallestK(fpreal *smallest, int k);
52 
53  bool computeWeightFn();
54  fpreal computeRootWeight(fpreal *src_motion_vec, int f, int j);
55  void computeAverageWeight();
56 
57  bool computeShortestPaths();
58  void findShortestPathLength(fpreal path_len_weight);
59 
60  void computeWarpMap();
61 
62  fpreal *getRefMotionVector(int f);
63  fpreal &getWeightFn(int f0, int f1, int f2);
64 
65  class WarpPath
66  {
67  public:
68  fpreal weight;
69  int prev;
70  };
71  WarpPath &getShortPath(int warped_frame, int f0, int f1)
72  {
73  int index = warped_frame*myNumNodes
74  + f0*myMaxStep
75  + (f1-f0-1);
76  return myShortPaths[index];
77  }
78 
79 private:
80  fpreal myRefFPS;
81  fpreal mySrcFPS;
82 
83  fpreal64 myAverageWeight;
84 
85  int myMaxStep;
86  int myKNearestNeighbours;
87 
88  int myNumNodes;
89  int myNumEdges;
90  UT_UniquePtr<fpreal[]> myRefMotionVectors;
91  UT_UniquePtr<fpreal[]> myWeightFn;
92  UT_UniquePtr<WarpPath[]> myShortPaths;
93 };
94 
95 #endif
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:39
double fpreal64
Definition: SYS_Types.h:201
#define CL_API
Definition: CL_API.h:10
GLfloat f
Definition: glcorearb.h:1926
myNumNodes
Definition: UT_RTreeImpl.h:707
GLint j
Definition: glad.h:2733
fpreal64 fpreal
Definition: SYS_Types.h:277
GLuint index
Definition: glcorearb.h:786