aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/x86/cabac.h
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-04-21 02:09:27 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-04-21 02:09:27 +0200
commit98495152145ce29cbb5147a50648df4e3ac1b468 (patch)
tree63a5f42ac6894a5b06cd1b6f9dd7d106d20c430b /libavcodec/x86/cabac.h
parente9b1d5ae5e41b854a9d8d212e9e197a193ff1fa9 (diff)
downloadffmpeg-98495152145ce29cbb5147a50648df4e3ac1b468.tar.gz
Revert "h264: assembly version of get_cabac for x86_64 with PIC (v4)"
This broke compilation on darwin, revert until a better solution is found. This reverts commit a812b599b504b39a8021827da89d5e23fb361cc9.
Diffstat (limited to 'libavcodec/x86/cabac.h')
-rw-r--r--libavcodec/x86/cabac.h90
1 files changed, 8 insertions, 82 deletions
diff --git a/libavcodec/x86/cabac.h b/libavcodec/x86/cabac.h
index 5175daff70..0c4419b4f3 100644
--- a/libavcodec/x86/cabac.h
+++ b/libavcodec/x86/cabac.h
@@ -24,71 +24,8 @@
#include "libavcodec/cabac.h"
#include "libavutil/attributes.h"
#include "libavutil/x86_cpu.h"
-#include "libavutil/internal.h"
#include "config.h"
-#ifdef BROKEN_RELOCATIONS
-#define RIP_ARG , "r"(rip)
-
-#if HAVE_FAST_CMOV
-#define BRANCHLESS_GET_CABAC_UPDATE(ret, retq, low, range, tmp) \
- "cmp "low" , "tmp" \n\t"\
- "cmova %%ecx , "range" \n\t"\
- "sbb %%rcx , %%rcx \n\t"\
- "and %%ecx , "tmp" \n\t"\
- "xor %%rcx , "retq" \n\t"\
- "sub "tmp" , "low" \n\t"
-#else /* HAVE_FAST_CMOV */
-#define BRANCHLESS_GET_CABAC_UPDATE(ret, retq, low, range, tmp) \
-/* P4 Prescott has crappy cmov,sbb,64bit shift so avoid them */ \
- "sub "low" , "tmp" \n\t"\
- "sar $31 , "tmp" \n\t"\
- "sub %%ecx , "range" \n\t"\
- "and "tmp" , "range" \n\t"\
- "add %%ecx , "range" \n\t"\
- "shl $17 , %%ecx \n\t"\
- "and "tmp" , %%ecx \n\t"\
- "sub %%ecx , "low" \n\t"\
- "xor "tmp" , "ret" \n\t"\
- "movslq "ret" , "retq" \n\t"
-#endif /* HAVE_FAST_CMOV */
-
-#define BRANCHLESS_GET_CABAC(ret, retq, statep, low, lowword, range, rangeq, tmp, tmpbyte, byte, end, rip) \
- "movzbl "statep" , "ret" \n\t"\
- "mov "range" , "tmp" \n\t"\
- "and $0xC0 , "range" \n\t"\
- "lea ("ret", "range", 2), %%ecx \n\t"\
- "movzbl ff_h264_lps_range-1b("rip", %%rcx), "range" \n\t"\
- "sub "range" , "tmp" \n\t"\
- "mov "tmp" , %%ecx \n\t"\
- "shl $17 , "tmp" \n\t"\
- BRANCHLESS_GET_CABAC_UPDATE(ret, retq, low, range, tmp) \
- "movzbl ff_h264_norm_shift-1b("rip", "rangeq"), %%ecx \n\t"\
- "shl %%cl , "range" \n\t"\
- "movzbl ff_h264_mlps_state-1b+128("rip", "retq"), "tmp" \n\t"\
- "shl %%cl , "low" \n\t"\
- "mov "tmpbyte" , "statep" \n\t"\
- "test "lowword" , "lowword" \n\t"\
- " jnz 2f \n\t"\
- "mov "byte" , %%"REG_c" \n\t"\
- "add"OPSIZE" $2 , "byte" \n\t"\
- "movzwl (%%"REG_c") , "tmp" \n\t"\
- "lea -1("low") , %%ecx \n\t"\
- "xor "low" , %%ecx \n\t"\
- "shr $15 , %%ecx \n\t"\
- "bswap "tmp" \n\t"\
- "shr $15 , "tmp" \n\t"\
- "movzbl ff_h264_norm_shift-1b("rip", %%rcx), %%ecx \n\t"\
- "sub $0xFFFF , "tmp" \n\t"\
- "neg %%ecx \n\t"\
- "add $7 , %%ecx \n\t"\
- "shl %%cl , "tmp" \n\t"\
- "add "tmp" , "low" \n\t"\
- "2: \n\t"
-
-#else /* BROKEN_RELOCATIONS */
-#define RIP_ARG
-
#if HAVE_FAST_CMOV
#define BRANCHLESS_GET_CABAC_UPDATE(ret, statep, low, range, tmp)\
"mov "tmp" , %%ecx \n\t"\
@@ -114,7 +51,7 @@
"xor "tmp" , "ret" \n\t"
#endif /* HAVE_FAST_CMOV */
-#define BRANCHLESS_GET_CABAC(ret, retq, statep, low, lowword, range, rangeq, tmp, tmpbyte, byte, end, rip) \
+#define BRANCHLESS_GET_CABAC(ret, statep, low, lowword, range, tmp, tmpbyte, byte, end) \
"movzbl "statep" , "ret" \n\t"\
"mov "range" , "tmp" \n\t"\
"and $0xC0 , "range" \n\t"\
@@ -144,39 +81,28 @@
"add "tmp" , "low" \n\t"\
"2: \n\t"
-#endif /* BROKEN_RELOCATIONS */
-
-#if HAVE_7REGS && !(defined(__i386) && defined(__clang__) && (__clang_major__<2 || (__clang_major__==2 && __clang_minor__<10)))\
- && !(defined(__i386) && !defined(__clang__) && defined(__llvm__) && __GNUC__==4 && __GNUC_MINOR__==2 && __GNUC_PATCHLEVEL__<=1)
+#if HAVE_7REGS && !defined(BROKEN_RELOCATIONS) && !(defined(__i386) && defined(__clang__) && (__clang_major__<2 || (__clang_major__==2 && __clang_minor__<10)))\
+ && !(defined(__i386) && !defined(__clang__) && defined(__llvm__) && __GNUC__==4 && __GNUC_MINOR__==2 && __GNUC_PATCHLEVEL__<=1)
#define get_cabac_inline get_cabac_inline_x86
static av_always_inline int get_cabac_inline_x86(CABACContext *c,
uint8_t *const state)
{
int bit, tmp;
-#ifdef BROKEN_RELOCATIONS
- int *rip;
-
- __asm__ volatile(
- "1: \n\t"
- "lea 1b(%%rip), %0 \n\t"
- : "=&r"(rip)
- );
-#endif
__asm__ volatile(
- BRANCHLESS_GET_CABAC("%0", "%q0", "(%4)", "%1", "%w1",
- "%2", "%q2", "%3", "%b3",
- "%a6(%5)", "%a7(%5)", "%8")
+ BRANCHLESS_GET_CABAC("%0", "(%4)", "%1", "%w1",
+ "%2", "%3", "%b3",
+ "%a6(%5)", "%a7(%5)")
: "=&r"(bit), "+&r"(c->low), "+&r"(c->range), "=&q"(tmp)
: "r"(state), "r"(c),
"i"(offsetof(CABACContext, bytestream)),
- "i"(offsetof(CABACContext, bytestream_end)) RIP_ARG
+ "i"(offsetof(CABACContext, bytestream_end))
: "%"REG_c, "memory"
);
return bit & 1;
}
-#endif /* HAVE_7REGS */
+#endif /* HAVE_7REGS && !defined(BROKEN_RELOCATIONS) */
#define get_cabac_bypass_sign get_cabac_bypass_sign_x86
static av_always_inline int get_cabac_bypass_sign_x86(CABACContext *c, int val)