annotate arm/intmath.h @ 873:4d9ad0ed07d0 libavutil

Replace many includes of libavutil/common.h with what is actually needed This reduces the number of false dependencies on header files and speeds up compilation.
author mru
date Tue, 09 Mar 2010 17:39:19 +0000
parents d87093e4b925
children f08c66310125
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
816
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
1 /*
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
2 * Copyright (c) 2010 Mans Rullgard <mans@mansr.com>
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
3 *
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
4 * This file is part of FFmpeg.
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
5 *
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
6 * FFmpeg is free software; you can redistribute it and/or
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
7 * modify it under the terms of the GNU Lesser General Public
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
8 * License as published by the Free Software Foundation; either
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
9 * version 2.1 of the License, or (at your option) any later version.
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
10 *
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
11 * FFmpeg is distributed in the hope that it will be useful,
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
14 * Lesser General Public License for more details.
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
15 *
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
16 * You should have received a copy of the GNU Lesser General Public
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
17 * License along with FFmpeg; if not, write to the Free Software
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
19 */
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
20
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
21 #ifndef AVUTIL_ARM_INTMATH_H
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
22 #define AVUTIL_ARM_INTMATH_H
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
23
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
24 #include "config.h"
873
4d9ad0ed07d0 Replace many includes of libavutil/common.h with what is actually needed
mru
parents: 816
diff changeset
25 #include "libavutil/attributes.h"
816
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
26
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
27 #if HAVE_INLINE_ASM
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
28
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
29 #if HAVE_ARMV6
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
30 static inline av_const int FASTDIV(int a, int b)
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
31 {
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
32 int r, t;
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
33 __asm__ volatile("cmp %3, #2 \n\t"
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
34 "ldr %1, [%4, %3, lsl #2] \n\t"
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
35 "lsrle %0, %2, #1 \n\t"
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
36 "smmulgt %0, %1, %2 \n\t"
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
37 : "=&r"(r), "=&r"(t) : "r"(a), "r"(b), "r"(ff_inverse));
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
38 return r;
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
39 }
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
40 #else
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
41 static inline av_const int FASTDIV(int a, int b)
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
42 {
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
43 int r, t;
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
44 __asm__ volatile("umull %1, %0, %2, %3"
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
45 : "=&r"(r), "=&r"(t) : "r"(a), "r"(ff_inverse[b]));
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
46 return r;
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
47 }
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
48 #endif
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
49
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
50 #define FASTDIV FASTDIV
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
51
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
52 #endif /* HAVE_INLINE_ASM */
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
53
d87093e4b925 Move FASTDIV macro to intmath.h
mru
parents:
diff changeset
54 #endif /* AVUTIL_ARM_INTMATH_H */