Imported Debian version 1.0~trusty
[deb_vid.stab.git] / src / serialize.h
1 /*
2 * serialize.h
3 *
4 * Copyright (C) Georg Martius - January 2013
5 * georg dot martius at web dot de
6 *
7 * This file is part of vid.stab video stabilization library
8 *
9 * vid.stab is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License,
11 * as published by the Free Software Foundation; either version 2, or
12 * (at your option) any later version.
13 *
14 * vid.stab is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with GNU Make; see the file COPYING. If not, write to
21 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
22 *
23 */
24
25 #ifndef __SERIALIZE_H
26 #define __SERIALIZE_H
27
28 #include "transformtype.h"
29 #include "motiondetect.h"
30 #include "transform.h"
31
32
33 /// Vector of LocalMotions
34 typedef VSVector VSManyLocalMotions;
35 /// helper macro to access a localmotions vector in the VSVector of all Frames
36 #define VSMLMGet(manylocalmotions,index) \
37 ((LocalMotions*)vs_vector_get(manylocalmotions,index))
38
39
40 /// stores local motions to file
41 int vsStoreLocalmotions(FILE* f, const LocalMotions* lms);
42
43 /// restores local motions from file
44 LocalMotions vsRestoreLocalmotions(FILE* f);
45
46
47 /// writes the header to the file that is to be holding the local motions
48 int vsPrepareFile(const VSMotionDetect* td, FILE* f);
49
50 /// appends the given localmotions to the file
51 int vsWriteToFile(const VSMotionDetect* td, FILE* f, const LocalMotions* lms);
52
53 /// reads the header of the file and return the version number (used by readLocalmotionsFile)
54 int vsReadFileVersion(FILE* f);
55
56 /*
57 * reads the next set of localmotions from the file, return VS_ERROR on error or
58 * if nothing is read (used by readLocalmotionsFile)
59 */
60 int vsReadFromFile(FILE* f, LocalMotions* lms);
61
62 /*
63 * reads the entire file of localmotions, return VS_ERROR on error or if nothing is read
64 *
65 * The format is as follows:
66 * The file must begin with 'VID.STAB version\n'
67 * Lines with # at the beginning are comments and will be ignored
68 * Data lines have the structure: Frame NUM (<LocalMotions>)
69 * where LocalMotions ::= List [(LM v.x v.y f.x f.y f.size contrast match),...]
70 */
71 int vsReadLocalMotionsFile(FILE* f, VSManyLocalMotions* lms);
72
73 // read the transformations from the given file (Deprecated format)
74 int vsReadOldTransforms(const VSTransformData* td, FILE* f , VSTransformations* trans);
75
76
77 #endif