summaryrefslogtreecommitdiff
path: root/libavutil
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-07-01 22:12:38 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-07-01 22:43:09 +0200
commit5eb353e0cd62ad212634c14e4b863554c0bc6161 (patch)
tree0f53c933b7a61bf14553c3ab8abb8226bd9c23bb /libavutil
parent23eeffcd48a15e73fb2649b712870b6d101c5471 (diff)
parent3893feeccdf754057fc7c7ac711ae876733f2f33 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: opt/eval: Include mathematics.h for NAN/INFINITY mathematics: Don't use division by zero in NAN/INFINITY macros wma: Lower the maximum number of channels to 2 x86: cpu: clean up check for cpuid instruction support ARM: generate position independent code to access data symbols Conflicts: libavutil/opt.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/arm/asm.S73
-rw-r--r--libavutil/eval.c1
-rw-r--r--libavutil/mathematics.h5
-rw-r--r--libavutil/opt.c1
4 files changed, 77 insertions, 3 deletions
diff --git a/libavutil/arm/asm.S b/libavutil/arm/asm.S
index 28d52cfd53..ccb52316c7 100644
--- a/libavutil/arm/asm.S
+++ b/libavutil/arm/asm.S
@@ -62,7 +62,14 @@ ELF .eabi_attribute 25, \val
.endm
.macro function name, export=0
+ .set .Lpic_idx, 0
+ .set .Lpic_gp, 0
.macro endfunc
+ .if .Lpic_idx
+ .altmacro
+ put_pic %(.Lpic_idx - 1)
+ .noaltmacro
+ .endif
ELF .size \name, . - \name
.endfunc
.purgem endfunc
@@ -106,8 +113,44 @@ ELF .size \name, . - \name
#endif
.endm
+.macro put_pic num
+ put_pic_\num
+.endm
+
+.macro do_def_pic num, val, label
+ .macro put_pic_\num
+ .if \num
+ .altmacro
+ put_pic %(\num - 1)
+ .noaltmacro
+ .endif
+\label: .word \val
+ .purgem put_pic_\num
+ .endm
+.endm
+
+.macro def_pic val, label
+ .altmacro
+ do_def_pic %.Lpic_idx, \val, \label
+ .noaltmacro
+ .set .Lpic_idx, .Lpic_idx + 1
+.endm
+
+.macro ldpic rd, val, indir=0
+ ldr \rd, .Lpicoff\@
+.Lpic\@:
+ .if \indir
+ ldr \rd, [pc, \rd]
+ .else
+ add \rd, pc, \rd
+ .endif
+ def_pic \val - (.Lpic\@ + (8 >> CONFIG_THUMB)), .Lpicoff\@
+.endm
+
.macro movrel rd, val
-#if HAVE_ARMV6T2 && !CONFIG_PIC && !defined(__APPLE__)
+#if CONFIG_PIC
+ ldpic \rd, \val
+#elif HAVE_ARMV6T2 && !defined(__APPLE__)
movw \rd, #:lower16:\val
movt \rd, #:upper16:\val
#else
@@ -115,6 +158,34 @@ ELF .size \name, . - \name
#endif
.endm
+.macro movrelx rd, val, gp
+#if CONFIG_PIC && defined(__ELF__)
+ .ifnb \gp
+ .if .Lpic_gp
+ .unreq gp
+ .endif
+ gp .req \gp
+ ldpic gp, _GLOBAL_OFFSET_TABLE_
+ .elseif !.Lpic_gp
+ gp .req r12
+ ldpic gp, _GLOBAL_OFFSET_TABLE_
+ .endif
+ .set .Lpic_gp, 1
+ ldr \rd, .Lpicoff\@
+ ldr \rd, [gp, \rd]
+ def_pic \val(GOT), .Lpicoff\@
+#elif CONFIG_PIC && defined(__APPLE__)
+ ldpic \rd, .Lpic\@, indir=1
+ .non_lazy_symbol_pointer
+.Lpic\@:
+ .indirect_symbol \val
+ .word 0
+ .text
+#else
+ movrel \rd, \val
+#endif
+.endm
+
.macro ldr_pre rt, rn, rm:vararg
A ldr \rt, [\rn, \rm]!
T add \rn, \rn, \rm
diff --git a/libavutil/eval.c b/libavutil/eval.c
index ceae2edf6f..771f12d90a 100644
--- a/libavutil/eval.c
+++ b/libavutil/eval.c
@@ -30,6 +30,7 @@
#include "avutil.h"
#include "eval.h"
#include "log.h"
+#include "mathematics.h"
typedef struct Parser {
const AVClass *class;
diff --git a/libavutil/mathematics.h b/libavutil/mathematics.h
index 93314bae16..5458d2f850 100644
--- a/libavutil/mathematics.h
+++ b/libavutil/mathematics.h
@@ -25,6 +25,7 @@
#include <math.h>
#include "attributes.h"
#include "rational.h"
+#include "intfloat.h"
#ifndef M_E
#define M_E 2.7182818284590452354 /* e */
@@ -51,10 +52,10 @@
#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
#endif
#ifndef NAN
-#define NAN (0.0/0.0)
+#define NAN av_int2float(0x7fc00000)
#endif
#ifndef INFINITY
-#define INFINITY (1.0/0.0)
+#define INFINITY av_int2float(0x7f800000)
#endif
/**
diff --git a/libavutil/opt.c b/libavutil/opt.c
index ab81b1f11f..cdd52768da 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -33,6 +33,7 @@
#include "log.h"
#include "parseutils.h"
#include "pixdesc.h"
+#include "mathematics.h"
#if FF_API_FIND_OPT
//FIXME order them and do a bin search