Main Page
Related Pages
Modules
Data Structures
Files
Examples
File List
Globals
libavcodec
arm
mathops.h
Go to the documentation of this file.
1
/*
2
* simple math operations
3
* Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> et al
4
*
5
* This file is part of Libav.
6
*
7
* Libav is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU Lesser General Public
9
* License as published by the Free Software Foundation; either
10
* version 2.1 of the License, or (at your option) any later version.
11
*
12
* Libav is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
* Lesser General Public License for more details.
16
*
17
* You should have received a copy of the GNU Lesser General Public
18
* License along with Libav; if not, write to the Free Software
19
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
*/
21
22
#ifndef AVCODEC_ARM_MATHOPS_H
23
#define AVCODEC_ARM_MATHOPS_H
24
25
#include <stdint.h>
26
#include "config.h"
27
#include "
libavutil/common.h
"
28
29
#if HAVE_INLINE_ASM
30
31
#if HAVE_ARMV6
32
#define MULH MULH
33
static
inline
av_const
int
MULH
(
int
a
,
int
b
)
34
{
35
int
r
;
36
__asm__ (
"smmul %0, %1, %2"
:
"=r"
(r) :
"r"
(a),
"r"
(b));
37
return
r
;
38
}
39
#endif
40
41
#define MLS64(d, a, b) MAC64(d, -(a), b)
42
43
#if HAVE_ARMV5TE
44
45
/* signed 16x16 -> 32 multiply add accumulate */
46
# define MAC16(rt, ra, rb) \
47
__asm__ ("smlabb %0, %1, %2, %0" : "+r"(rt) : "r"(ra), "r"(rb));
48
49
/* signed 16x16 -> 32 multiply */
50
# define MUL16 MUL16
51
static
inline
av_const
int
MUL16
(
int
ra
,
int
rb)
52
{
53
int
rt;
54
__asm__ (
"smulbb %0, %1, %2"
:
"=r"
(rt) :
"r"
(ra),
"r"
(rb));
55
return
rt;
56
}
57
58
#endif
59
60
#define mid_pred mid_pred
61
static
inline
av_const
int
mid_pred
(
int
a,
int
b,
int
c)
62
{
63
int
m;
64
__asm__ (
65
"mov %0, %2 \n\t"
66
"cmp %1, %2 \n\t"
67
"itt gt \n\t"
68
"movgt %0, %1 \n\t"
69
"movgt %1, %2 \n\t"
70
"cmp %1, %3 \n\t"
71
"it le \n\t"
72
"movle %1, %3 \n\t"
73
"cmp %0, %1 \n\t"
74
"it gt \n\t"
75
"movgt %0, %1 \n\t"
76
:
"=&r"
(m),
"+r"
(a)
77
:
"r"
(b),
"r"
(c)
78
:
"cc"
);
79
return
m;
80
}
81
82
#endif
/* HAVE_INLINE_ASM */
83
84
#endif
/* AVCODEC_ARM_MATHOPS_H */
av_const
#define av_const
Definition:
attributes.h:63
b
#define b
Definition:
swscale.c:1335
MUL16
#define MUL16(a, b)
Definition:
mathops.h:38
ra
#define ra
Definition:
regdef.h:57
mid_pred
#define mid_pred
Definition:
mathops.h:88
r
#define r(n)
Definition:
regs.h:32
common.h
common internal and external API header
MULH
#define MULH(X, Y)
Definition:
mathops.h:27
a
a
Definition:
h264pred_template.c:425