Changeset View
Changeset View
Standalone View
Standalone View
libmv/autotrack/tracks.h
| Context not available. | |||||
| #ifndef LIBMV_AUTOTRACK_TRACKS_H_ | #ifndef LIBMV_AUTOTRACK_TRACKS_H_ | ||||
| #define LIBMV_AUTOTRACK_TRACKS_H_ | #define LIBMV_AUTOTRACK_TRACKS_H_ | ||||
| #include <map> | |||||
| #include <set> | |||||
| #include "libmv/base/vector.h" | #include "libmv/base/vector.h" | ||||
| #include "libmv/autotrack/marker.h" | #include "libmv/autotrack/marker.h" | ||||
| Context not available. | |||||
| using libmv::vector; | using libmv::vector; | ||||
| struct MarkerCompareFrameLess | |||||
| { | |||||
| bool operator() (const Marker & lhs, | |||||
| const Marker & rhs) const | |||||
| { | |||||
| return lhs.frame < rhs.frame; | |||||
| } | |||||
| }; | |||||
| // This is a set per track and per clip | |||||
| typedef std::set<Marker, MarkerCompareFrameLess> MarkerSet; | |||||
| typedef std::map<int, Marker> FrameMarkerMap; | |||||
| typedef std::map<int, FrameMarkerMap> ClipMarkersMap; | |||||
| typedef std::map<int, ClipMarkersMap> TrackMarkersMap; | |||||
| // The Tracks container stores correspondences between frames. | // The Tracks container stores correspondences between frames. | ||||
| class Tracks { | class Tracks { | ||||
| public: | public: | ||||
| Context not available. | |||||
| Tracks(const Tracks &other); | Tracks(const Tracks &other); | ||||
| // Create a tracks object with markers already initialized. Copies markers. | // Create a tracks object with markers already initialized. Copies markers. | ||||
| explicit Tracks(const vector<Marker>& markers); | explicit Tracks(const TrackMarkersMap& markers); | ||||
| // All getters append to the output argument vector. | // All getters append to the output argument vector. | ||||
| bool GetMarker(int clip, int frame, int track, Marker* marker) const; | bool GetMarker(int clip, int frame, int track, Marker* marker) const; | ||||
| Context not available. | |||||
| // Moves the contents of *markers over top of the existing markers. This | // Moves the contents of *markers over top of the existing markers. This | ||||
| // destroys *markers in the process (but avoids copies). | // destroys *markers in the process (but avoids copies). | ||||
| void SetMarkers(vector<Marker>* markers); | void SetMarkers(TrackMarkersMap* markers); | ||||
| bool RemoveMarker(int clip, int frame, int track); | bool RemoveMarker(int clip, int frame, int track); | ||||
| void RemoveMarkersForTrack(int track); | void RemoveMarkersForTrack(int track); | ||||
| Context not available. | |||||
| int MaxTrack() const; | int MaxTrack() const; | ||||
| int NumMarkers() const; | int NumMarkers() const; | ||||
| const vector<Marker>& markers() const { return markers_; } | const TrackMarkersMap& markers() const { return markers_; } | ||||
| private: | private: | ||||
| vector<Marker> markers_; | TrackMarkersMap markers_; | ||||
| // TODO(keir): Consider adding access-map data structures to avoid all the | // TODO(keir): Consider adding access-map data structures to avoid all the | ||||
| // linear lookup penalties for the accessors. | // linear lookup penalties for the accessors. | ||||
| Context not available. | |||||