Cleanup: remove redundant doxygen \file argument
[blender.git] / source / blender / blenkernel / tracking_private.h
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2011 Blender Foundation.
17  * All rights reserved.
18  */
19
20 /** \file \ingroup bke
21  *
22  * This file contains declarations of function which are used
23  * by multiple tracking files but which should not be public.
24  */
25
26 #ifndef __TRACKING_PRIVATE_H__
27 #define __TRACKING_PRIVATE_H__
28
29 #include "BLI_threads.h"
30
31 struct GHash;
32 struct MovieTracking;
33 struct MovieTrackingMarker;
34
35 struct libmv_CameraIntrinsicsOptions;
36
37 /*********************** Tracks map *************************/
38
39 typedef struct TracksMap {
40         char object_name[MAX_NAME];
41         bool is_camera;
42
43         int num_tracks;
44         int customdata_size;
45
46         char *customdata;
47         MovieTrackingTrack *tracks;
48
49         struct GHash *hash;
50
51         int ptr;
52
53         /* Spin lock is used to sync context during tracking. */
54         SpinLock spin_lock;
55 } TracksMap;
56
57 struct TracksMap *tracks_map_new(const char *object_name, bool is_camera, int num_tracks, int customdata_size);
58 int tracks_map_get_size(struct TracksMap *map);
59 void tracks_map_get_indexed_element(struct TracksMap *map, int index, struct MovieTrackingTrack **track, void **customdata);
60 void tracks_map_insert(struct TracksMap *map, struct MovieTrackingTrack *track, void *customdata);
61 void tracks_map_free(struct TracksMap *map, void (*customdata_free)(void *customdata));
62 void tracks_map_merge(struct TracksMap *map, struct MovieTracking *tracking);
63
64 /*********************** Space transformation functions *************************/
65
66 void tracking_get_search_origin_frame_pixel(int frame_width, int frame_height,
67                                             const struct MovieTrackingMarker *marker,
68                                             float frame_pixel[2]);
69
70 void tracking_get_marker_coords_for_tracking(int frame_width, int frame_height,
71                                              const struct MovieTrackingMarker *marker,
72                                              double search_pixel_x[5], double search_pixel_y[5]);
73
74 void tracking_set_marker_coords_from_tracking(int frame_width, int frame_height, struct MovieTrackingMarker *marker,
75                                               const double search_pixel_x[5], const double search_pixel_y[5]);
76
77 /*********************** General purpose utility functions *************************/
78
79 void tracking_marker_insert_disabled(struct MovieTrackingTrack *track, const struct MovieTrackingMarker *ref_marker,
80                                      bool before, bool overwrite);
81
82 void tracking_cameraIntrinscisOptionsFromTracking(struct MovieTracking *tracking,
83                                                   int calibration_width, int calibration_height,
84                                                   struct libmv_CameraIntrinsicsOptions *camera_intrinsics_options);
85
86 void tracking_trackingCameraFromIntrinscisOptions(struct MovieTracking *tracking,
87                                                   const struct libmv_CameraIntrinsicsOptions *camera_intrinsics_options);
88
89 struct libmv_TrackRegionOptions;
90
91 void tracking_configure_tracker(const MovieTrackingTrack *track, float *mask,
92                                 struct libmv_TrackRegionOptions *options);
93
94 struct MovieTrackingMarker *tracking_get_keyframed_marker(
95         struct MovieTrackingTrack *track,
96         int current_frame,
97         bool backwards);
98
99 /*********************** Masking *************************/
100
101 float *tracking_track_get_mask_for_region(int frame_width, int frame_height,
102                                           const float region_min[2],
103                                           const float region_max[2],
104                                           MovieTrackingTrack *track);
105
106 /*********************** Frame accessr *************************/
107
108 struct libmv_FrameAccessor;
109
110 #define MAX_ACCESSOR_CLIP 64
111 typedef struct TrackingImageAccessor {
112         struct MovieCache *cache;
113         struct MovieClip *clips[MAX_ACCESSOR_CLIP];
114         int num_clips;
115         struct MovieTrackingTrack **tracks;
116         int num_tracks;
117         int start_frame;
118         struct libmv_FrameAccessor *libmv_accessor;
119         SpinLock cache_lock;
120 } TrackingImageAccessor;
121
122 TrackingImageAccessor *tracking_image_accessor_new(MovieClip *clips[MAX_ACCESSOR_CLIP],
123                                                    int num_clips,
124                                                    MovieTrackingTrack **tracks,
125                                                    int num_tracks,
126                                                    int start_frame);
127 void tracking_image_accessor_destroy(TrackingImageAccessor *accessor);
128
129 #endif  /* __TRACKING_PRIVATE_H__ */