5 |
* |
* |
6 |
* NB : not thread safe and only for debug purposes. |
* NB : not thread safe and only for debug purposes. |
7 |
* |
* |
8 |
* Copyright(C) 2002 Michael Militzer |
* Copyright(C) 2002 Michael Militzer <isibaar@xvid.org> |
9 |
* |
* |
10 |
* This program is an implementation of a part of one or more MPEG-4 |
* This file is part of XviD, a free MPEG-4 video encoder/decoder |
|
* Video tools as specified in ISO/IEC 14496-2 standard. Those intending |
|
|
* to use this software module in hardware or software products are |
|
|
* advised that its use may infringe existing patents or copyrights, and |
|
|
* any such use would be at such party's own risk. The original |
|
|
* developer of this software module and his/her company, and subsequent |
|
|
* editors and their companies, will have no liability for use of this |
|
|
* software or modifications or derivatives thereof. |
|
11 |
* |
* |
12 |
* This program is free software; you can redistribute it and/or modify |
* XviD is free software; you can redistribute it and/or modify it |
13 |
* it under the terms of the GNU General Public License as published by |
* under the terms of the GNU General Public License as published by |
14 |
* the Free Software Foundation; either version 2 of the License, or |
* the Free Software Foundation; either version 2 of the License, or |
15 |
* (at your option) any later version. |
* (at your option) any later version. |
16 |
* |
* |
23 |
* along with this program; if not, write to the Free Software |
* along with this program; if not, write to the Free Software |
24 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
25 |
* |
* |
26 |
|
* Under section 8 of the GNU General Public License, the copyright |
27 |
|
* holders of XVID explicitly forbid distribution in the following |
28 |
|
* countries: |
29 |
|
* |
30 |
|
* - Japan |
31 |
|
* - United States of America |
32 |
|
* |
33 |
|
* Linking XviD statically or dynamically with other modules is making a |
34 |
|
* combined work based on XviD. Thus, the terms and conditions of the |
35 |
|
* GNU General Public License cover the whole combination. |
36 |
|
* |
37 |
|
* As a special exception, the copyright holders of XviD give you |
38 |
|
* permission to link XviD with independent modules that communicate with |
39 |
|
* XviD solely through the VFW1.1 and DShow interfaces, regardless of the |
40 |
|
* license terms of these independent modules, and to copy and distribute |
41 |
|
* the resulting combined work under terms of your choice, provided that |
42 |
|
* every copy of the combined work is accompanied by a complete copy of |
43 |
|
* the source code of XviD (the version of XviD used to produce the |
44 |
|
* combined work), being distributed under the terms of the GNU General |
45 |
|
* Public License plus this exception. An independent module is a module |
46 |
|
* which is not derived from or based on XviD. |
47 |
|
* |
48 |
|
* Note that people who make modified versions of XviD are not obligated |
49 |
|
* to grant this special exception for their modified versions; it is |
50 |
|
* their choice whether to do so. The GNU General Public License gives |
51 |
|
* permission to release a modified version without this exception; this |
52 |
|
* exception also makes it possible to release a modified version which |
53 |
|
* carries forward this exception. |
54 |
|
* |
55 |
* $Id$ |
* $Id$ |
56 |
* |
* |
57 |
****************************************************************************/ |
****************************************************************************/ |
91 |
not very precise but sufficient |
not very precise but sufficient |
92 |
*/ |
*/ |
93 |
double |
double |
94 |
get_freq() |
get_freq(void) |
95 |
{ |
{ |
96 |
int64_t x, y; |
int64_t x, y; |
97 |
int32_t i; |
int32_t i; |
110 |
return (double) (y - x) / 1000.; |
return (double) (y - x) / 1000.; |
111 |
} |
} |
112 |
|
|
113 |
// set everything to zero // |
/* set everything to zero */ |
114 |
void |
void |
115 |
init_timer() |
init_timer(void) |
116 |
{ |
{ |
117 |
frequency = get_freq(); |
frequency = get_freq(); |
118 |
|
|
124 |
} |
} |
125 |
|
|
126 |
void |
void |
127 |
start_timer() |
start_timer(void) |
128 |
{ |
{ |
129 |
tim.current = read_counter(); |
tim.current = read_counter(); |
130 |
} |
} |
131 |
|
|
132 |
void |
void |
133 |
start_global_timer() |
start_global_timer(void) |
134 |
{ |
{ |
135 |
tim.global = read_counter(); |
tim.global = read_counter(); |
136 |
} |
} |
137 |
|
|
138 |
void |
void |
139 |
stop_dct_timer() |
stop_dct_timer(void) |
140 |
{ |
{ |
141 |
tim.dct += (read_counter() - tim.current); |
tim.dct += (read_counter() - tim.current); |
142 |
} |
} |
143 |
|
|
144 |
void |
void |
145 |
stop_idct_timer() |
stop_idct_timer(void) |
146 |
{ |
{ |
147 |
tim.idct += (read_counter() - tim.current); |
tim.idct += (read_counter() - tim.current); |
148 |
} |
} |
149 |
|
|
150 |
void |
void |
151 |
stop_quant_timer() |
stop_quant_timer(void) |
152 |
{ |
{ |
153 |
tim.quant += (read_counter() - tim.current); |
tim.quant += (read_counter() - tim.current); |
154 |
} |
} |
155 |
|
|
156 |
void |
void |
157 |
stop_iquant_timer() |
stop_iquant_timer(void) |
158 |
{ |
{ |
159 |
tim.iquant += (read_counter() - tim.current); |
tim.iquant += (read_counter() - tim.current); |
160 |
} |
} |
161 |
|
|
162 |
void |
void |
163 |
stop_motion_timer() |
stop_motion_timer(void) |
164 |
{ |
{ |
165 |
tim.motion += (read_counter() - tim.current); |
tim.motion += (read_counter() - tim.current); |
166 |
} |
} |
167 |
|
|
168 |
void |
void |
169 |
stop_comp_timer() |
stop_comp_timer(void) |
170 |
{ |
{ |
171 |
tim.comp += (read_counter() - tim.current); |
tim.comp += (read_counter() - tim.current); |
172 |
} |
} |
173 |
|
|
174 |
void |
void |
175 |
stop_edges_timer() |
stop_edges_timer(void) |
176 |
{ |
{ |
177 |
tim.edges += (read_counter() - tim.current); |
tim.edges += (read_counter() - tim.current); |
178 |
} |
} |
179 |
|
|
180 |
void |
void |
181 |
stop_inter_timer() |
stop_inter_timer(void) |
182 |
{ |
{ |
183 |
tim.inter += (read_counter() - tim.current); |
tim.inter += (read_counter() - tim.current); |
184 |
} |
} |
185 |
|
|
186 |
void |
void |
187 |
stop_conv_timer() |
stop_conv_timer(void) |
188 |
{ |
{ |
189 |
tim.conv += (read_counter() - tim.current); |
tim.conv += (read_counter() - tim.current); |
190 |
} |
} |
191 |
|
|
192 |
void |
void |
193 |
stop_transfer_timer() |
stop_transfer_timer(void) |
194 |
{ |
{ |
195 |
tim.trans += (read_counter() - tim.current); |
tim.trans += (read_counter() - tim.current); |
196 |
} |
} |
197 |
|
|
198 |
void |
void |
199 |
stop_prediction_timer() |
stop_prediction_timer(void) |
200 |
{ |
{ |
201 |
tim.prediction += (read_counter() - tim.current); |
tim.prediction += (read_counter() - tim.current); |
202 |
} |
} |
203 |
|
|
204 |
void |
void |
205 |
stop_coding_timer() |
stop_coding_timer(void) |
206 |
{ |
{ |
207 |
tim.coding += (read_counter() - tim.current); |
tim.coding += (read_counter() - tim.current); |
208 |
} |
} |
209 |
|
|
210 |
void |
void |
211 |
stop_interlacing_timer() |
stop_interlacing_timer(void) |
212 |
{ |
{ |
213 |
tim.interlacing += (read_counter() - tim.current); |
tim.interlacing += (read_counter() - tim.current); |
214 |
} |
} |
215 |
|
|
216 |
void |
void |
217 |
stop_global_timer() |
stop_global_timer(void) |
218 |
{ |
{ |
219 |
tim.overall += (read_counter() - tim.global); |
tim.overall += (read_counter() - tim.global); |
220 |
} |
} |
223 |
write log file with some timer information |
write log file with some timer information |
224 |
*/ |
*/ |
225 |
void |
void |
226 |
write_timer() |
write_timer(void) |
227 |
{ |
{ |
228 |
float dct_per, quant_per, idct_per, iquant_per, mot_per, comp_per, |
float dct_per, quant_per, idct_per, iquant_per, mot_per, comp_per, |
229 |
interlacing_per; |
interlacing_per; |
233 |
|
|
234 |
count_frames++; |
count_frames++; |
235 |
|
|
236 |
// only write log file every 50 processed frames // |
/* only write log file every 50 processed frames */ |
237 |
if (count_frames % 50) { |
if (count_frames % 50) { |
238 |
FILE *fp; |
FILE *fp; |
239 |
|
|