aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/x86/cabac.h
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-07-05 11:41:30 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-07-05 11:41:30 +0200
commitcced6f4d58168096f13a4d34555754717979429d (patch)
treec2febbecb61ae395f7281e7131735c1effc1c4ff /libavcodec/x86/cabac.h
parent0f85c96091e9e2c1ab0b939cd966c7c7220dadb0 (diff)
parente6d8acf6a8fba4743eb56eabe72a741d1bbee3cb (diff)
downloadffmpeg-cced6f4d58168096f13a4d34555754717979429d.tar.gz
Merge commit 'e6d8acf6a8fba4743eb56eabe72a741d1bbee3cb'
* commit 'e6d8acf6a8fba4743eb56eabe72a741d1bbee3cb': indeo: use a typedef for the mc function pointer cabac: x86 version of get_cabac_bypass aic: use chroma scan tables while decoding luma component in progressive mode Conflicts: libavcodec/aic.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/x86/cabac.h')
-rw-r--r--libavcodec/x86/cabac.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/libavcodec/x86/cabac.h b/libavcodec/x86/cabac.h
index 2c9f77e3ff..1b7bcee7e8 100644
--- a/libavcodec/x86/cabac.h
+++ b/libavcodec/x86/cabac.h
@@ -225,5 +225,45 @@ static av_always_inline int get_cabac_bypass_sign_x86(CABACContext *c, int val)
return val;
}
+#define get_cabac_bypass get_cabac_bypass_x86
+static av_always_inline int get_cabac_bypass_x86(CABACContext *c)
+{
+ x86_reg tmp;
+ int res;
+ __asm__ volatile(
+ "movl %c6(%2), %k1 \n\t"
+ "movl %c3(%2), %%eax \n\t"
+ "shl $17, %k1 \n\t"
+ "add %%eax, %%eax \n\t"
+ "sub %k1, %%eax \n\t"
+ "cltd \n\t"
+ "and %%edx, %k1 \n\t"
+ "add %k1, %%eax \n\t"
+ "inc %%edx \n\t"
+ "test %%ax, %%ax \n\t"
+ "jnz 1f \n\t"
+ "mov %c4(%2), %1 \n\t"
+ "subl $0xFFFF, %%eax \n\t"
+ "movzwl (%1), %%ecx \n\t"
+ "bswap %%ecx \n\t"
+ "shrl $15, %%ecx \n\t"
+ "addl %%ecx, %%eax \n\t"
+ "cmp %c5(%2), %1 \n\t"
+ "jge 1f \n\t"
+ "add"OPSIZE" $2, %c4(%2) \n\t"
+ "1: \n\t"
+ "movl %%eax, %c3(%2) \n\t"
+
+ : "=&d"(res), "=&r"(tmp)
+ : "r"(c),
+ "i"(offsetof(CABACContext, low)),
+ "i"(offsetof(CABACContext, bytestream)),
+ "i"(offsetof(CABACContext, bytestream_end)),
+ "i"(offsetof(CABACContext, range))
+ : "%eax", "%ecx", "memory"
+ );
+ return res;
+}
+
#endif /* HAVE_INLINE_ASM */
#endif /* AVCODEC_X86_CABAC_H */