Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Garrett-Glaser <jason@x264.com>2013-07-01 23:06:22 +0400
committerLuca Barbato <lu_zero@gentoo.org>2013-07-04 18:06:10 +0400
commitd222f6e39e263c3455b9e1108cccda035889622d (patch)
tree8f60be0d4dfbd3c4895cdf2d5b7174ebc440034e /libavcodec/x86
parent410066986f443112ed88f501e987b6ca51ed7bd4 (diff)
cabac: x86 version of get_cabac_bypass
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'libavcodec/x86')
-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 a74cf0bf1f..fdb0a2975c 100644
--- a/libavcodec/x86/cabac.h
+++ b/libavcodec/x86/cabac.h
@@ -229,5 +229,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 */