1 /*******************************************************************************
2 matrix.c
3
4 libquicktime - A library for reading and writing quicktime/avi/mp4 files.
5 http://libquicktime.sourceforge.net
6
7 Copyright (C) 2002 Heroine Virtual Ltd.
8 Copyright (C) 2002-2011 Members of the libquicktime project.
9
10 This library is free software; you can redistribute it and/or modify it under
11 the terms of the GNU Lesser General Public License as published by the Free
12 Software Foundation; either version 2.1 of the License, or (at your option)
13 any later version.
14
15 This library is distributed in the hope that it will be useful, but WITHOUT
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
18 details.
19
20 You should have received a copy of the GNU Lesser General Public License along
21 with this library; if not, write to the Free Software Foundation, Inc., 51
22 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 *******************************************************************************/
24
25 #include "lqt_private.h"
26
quicktime_matrix_init(quicktime_matrix_t * matrix)27 void quicktime_matrix_init(quicktime_matrix_t *matrix)
28 {
29 int i;
30 for(i = 0; i < 9; i++) matrix->values[i] = 0;
31 matrix->values[0] = matrix->values[4] = 1;
32 matrix->values[8] = 16384;
33 }
34
quicktime_matrix_delete(quicktime_matrix_t * matrix)35 void quicktime_matrix_delete(quicktime_matrix_t *matrix)
36 {
37 }
38
quicktime_read_matrix(quicktime_t * file,quicktime_matrix_t * matrix)39 void quicktime_read_matrix(quicktime_t *file, quicktime_matrix_t *matrix)
40 {
41 int i = 0;
42 for(i = 0; i < 9; i++)
43 {
44 matrix->values[i] = quicktime_read_fixed32(file);
45 }
46 }
47
quicktime_matrix_dump(quicktime_matrix_t * matrix)48 void quicktime_matrix_dump(quicktime_matrix_t *matrix)
49 {
50 int i;
51 lqt_dump(" matrix");
52 for(i = 0; i < 9; i++) lqt_dump(" %f", matrix->values[i]);
53 lqt_dump("\n");
54 }
55
quicktime_write_matrix(quicktime_t * file,quicktime_matrix_t * matrix)56 void quicktime_write_matrix(quicktime_t *file, quicktime_matrix_t *matrix)
57 {
58 int i;
59 for(i = 0; i < 9; i++)
60 {
61 quicktime_write_fixed32(file, matrix->values[i]);
62 }
63 }
64