Mercurial > libavutil.hg
annotate timer.h @ 999:effd4ae1769d libavutil
Make ff_inverse stay with libavutil, and optional copy it to libavcodec.
The ff_inverse table is used by FASTDIV macro, defined in libavutil, but up
to now the table was defined only in libavcodec.
After this change, the main copy of ff_inverse is part of libavutil (just
like FASTDIV), but if CONFIG_SMALL is unset, then a different copy is made
available to libavcodec, to avoid the performance penalty of using an
external look up table.
Dynamic linking works, because the libraries are linked with -Bsymbolic, so
the local copy of the symbol has priority over the external; static linking
works because the table is on a standalone object file in both libraries,
so the linker is able to discard one of the two.
Tested on Linux/x86-64 and Mac OS X/x86-64.
author | flameeyes |
---|---|
date | Wed, 21 Jul 2010 12:37:37 +0000 |
parents | 0795a743bda1 |
children |
rev | line source |
---|---|
604 | 1 /** |
899
0795a743bda1
Remove explicit filename from Doxygen @file commands.
diego
parents:
719
diff
changeset
|
2 * @file |
604 | 3 * high precision timer, useful to profile code |
4 * | |
108
11be8e0d1344
Add official LGPL license headers to the files that were missing them.
diego
parents:
104
diff
changeset
|
5 * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> |
11be8e0d1344
Add official LGPL license headers to the files that were missing them.
diego
parents:
104
diff
changeset
|
6 * |
116
d76a36742464
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
113
diff
changeset
|
7 * This file is part of FFmpeg. |
d76a36742464
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
113
diff
changeset
|
8 * |
d76a36742464
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
113
diff
changeset
|
9 * FFmpeg is free software; you can redistribute it and/or |
108
11be8e0d1344
Add official LGPL license headers to the files that were missing them.
diego
parents:
104
diff
changeset
|
10 * modify it under the terms of the GNU Lesser General Public |
11be8e0d1344
Add official LGPL license headers to the files that were missing them.
diego
parents:
104
diff
changeset
|
11 * License as published by the Free Software Foundation; either |
116
d76a36742464
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
113
diff
changeset
|
12 * version 2.1 of the License, or (at your option) any later version. |
108
11be8e0d1344
Add official LGPL license headers to the files that were missing them.
diego
parents:
104
diff
changeset
|
13 * |
116
d76a36742464
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
113
diff
changeset
|
14 * FFmpeg is distributed in the hope that it will be useful, |
108
11be8e0d1344
Add official LGPL license headers to the files that were missing them.
diego
parents:
104
diff
changeset
|
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11be8e0d1344
Add official LGPL license headers to the files that were missing them.
diego
parents:
104
diff
changeset
|
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
11be8e0d1344
Add official LGPL license headers to the files that were missing them.
diego
parents:
104
diff
changeset
|
17 * Lesser General Public License for more details. |
11be8e0d1344
Add official LGPL license headers to the files that were missing them.
diego
parents:
104
diff
changeset
|
18 * |
11be8e0d1344
Add official LGPL license headers to the files that were missing them.
diego
parents:
104
diff
changeset
|
19 * You should have received a copy of the GNU Lesser General Public |
116
d76a36742464
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
113
diff
changeset
|
20 * License along with FFmpeg; if not, write to the Free Software |
108
11be8e0d1344
Add official LGPL license headers to the files that were missing them.
diego
parents:
104
diff
changeset
|
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
11be8e0d1344
Add official LGPL license headers to the files that were missing them.
diego
parents:
104
diff
changeset
|
22 */ |
11be8e0d1344
Add official LGPL license headers to the files that were missing them.
diego
parents:
104
diff
changeset
|
23 |
604 | 24 #ifndef AVUTIL_TIMER_H |
25 #define AVUTIL_TIMER_H | |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
26 |
604 | 27 #include <stdlib.h> |
28 #include <stdint.h> | |
29 #include "config.h" | |
129
ccae53673692
Fix ASF format parser's broken UTF-16 string handling
gpoirier
parents:
127
diff
changeset
|
30 |
719 | 31 #if ARCH_ARM |
32 # include "arm/timer.h" | |
33 #elif ARCH_BFIN | |
718 | 34 # include "bfin/timer.h" |
35 #elif ARCH_PPC | |
36 # include "ppc/timer.h" | |
37 #elif ARCH_X86 | |
38 # include "x86/timer.h" | |
39 #endif | |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
40 |
718 | 41 #if !defined(AV_READ_TIME) && HAVE_GETHRTIME |
42 # define AV_READ_TIME gethrtime | |
370
de3dc287f939
* Making [START|STOP]_TIMER work on architectures that support gethrtime()
romansh
parents:
342
diff
changeset
|
43 #endif |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
44 |
370
de3dc287f939
* Making [START|STOP]_TIMER work on architectures that support gethrtime()
romansh
parents:
342
diff
changeset
|
45 #ifdef AV_READ_TIME |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
46 #define START_TIMER \ |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
47 uint64_t tend;\ |
370
de3dc287f939
* Making [START|STOP]_TIMER work on architectures that support gethrtime()
romansh
parents:
342
diff
changeset
|
48 uint64_t tstart= AV_READ_TIME();\ |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
49 |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
50 #define STOP_TIMER(id) \ |
370
de3dc287f939
* Making [START|STOP]_TIMER work on architectures that support gethrtime()
romansh
parents:
342
diff
changeset
|
51 tend= AV_READ_TIME();\ |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
52 {\ |
452 | 53 static uint64_t tsum=0;\ |
54 static int tcount=0;\ | |
55 static int tskip_count=0;\ | |
604 | 56 if(tcount<2 || tend - tstart < 8*tsum/tcount || tend - tstart < 2000){\ |
452 | 57 tsum+= tend - tstart;\ |
58 tcount++;\ | |
59 }else\ | |
60 tskip_count++;\ | |
61 if(((tcount+tskip_count)&(tcount+tskip_count-1))==0){\ | |
516 | 62 av_log(NULL, AV_LOG_ERROR, "%"PRIu64" dezicycles in %s, %d runs, %d skips\n",\ |
452 | 63 tsum*10/tcount, id, tcount, tskip_count);\ |
64 }\ | |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
65 } |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
66 #else |
12 | 67 #define START_TIMER |
0
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
68 #define STOP_TIMER(id) {} |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
69 #endif |
ee8f44bb7c4d
libavutil: Utility code from libavcodec moved to a separate library.
al
parents:
diff
changeset
|
70 |
604 | 71 #endif /* AVUTIL_TIMER_H */ |