Go to the documentation of this file.
21 #ifndef AVCODEC_X86_CABAC_H
22 #define AVCODEC_X86_CABAC_H
30 #define BRANCHLESS_GET_CABAC_UPDATE(ret, statep, low, lowword, range, tmp)\
31 "mov "tmp" , %%ecx \n\t"\
32 "shl $17 , "tmp" \n\t"\
33 "cmp "low" , "tmp" \n\t"\
34 "cmova %%ecx , "range" \n\t"\
35 "sbb %%ecx , %%ecx \n\t"\
36 "and %%ecx , "tmp" \n\t"\
37 "xor %%ecx , "ret" \n\t"\
38 "sub "tmp" , "low" \n\t"
40 #define BRANCHLESS_GET_CABAC_UPDATE(ret, statep, low, lowword, range, tmp)\
41 "mov "tmp" , %%ecx \n\t"\
42 "shl $17 , "tmp" \n\t"\
43 "sub "low" , "tmp" \n\t"\
44 "sar $31 , "tmp" \n\t" \
45 "sub %%ecx , "range" \n\t" \
46 "and "tmp" , "range" \n\t" \
47 "add %%ecx , "range" \n\t" \
48 "shl $17 , %%ecx \n\t"\
49 "and "tmp" , %%ecx \n\t"\
50 "sub %%ecx , "low" \n\t"\
51 "xor "tmp" , "ret" \n\t"
54 #define BRANCHLESS_GET_CABAC(ret, statep, low, lowword, range, tmp, tmpbyte, byte) \
55 "movzbl "statep" , "ret" \n\t"\
56 "mov "range" , "tmp" \n\t"\
57 "and $0xC0 , "range" \n\t"\
58 "movzbl "MANGLE(ff_h264_lps_range)"("ret", "range", 2), "range" \n\t"\
59 "sub "range" , "tmp" \n\t"\
60 BRANCHLESS_GET_CABAC_UPDATE(ret, statep, low, lowword, range, tmp) \
61 "movzbl " MANGLE(ff_h264_norm_shift) "("range"), %%ecx \n\t"\
62 "shl %%cl , "range" \n\t"\
63 "movzbl "MANGLE(ff_h264_mlps_state)"+128("ret"), "tmp" \n\t"\
64 "shl %%cl , "low" \n\t"\
65 "mov "tmpbyte" , "statep" \n\t"\
66 "test "lowword" , "lowword" \n\t"\
68 "mov "byte" , %%"REG_c" \n\t"\
69 "add"OPSIZE" $2 , "byte" \n\t"\
70 "movzwl (%%"REG_c") , "tmp" \n\t"\
71 "lea -1("low") , %%ecx \n\t"\
72 "xor "low" , %%ecx \n\t"\
73 "shr $15 , %%ecx \n\t"\
75 "shr $15 , "tmp" \n\t"\
76 "movzbl " MANGLE(ff_h264_norm_shift) "(%%ecx), %%ecx \n\t"\
77 "sub $0xFFFF , "tmp" \n\t"\
79 "add $7 , %%ecx \n\t"\
80 "shl %%cl , "tmp" \n\t"\
81 "add "tmp" , "low" \n\t"\
84 #if HAVE_7REGS && !defined(BROKEN_RELOCATIONS)
85 #define get_cabac_inline get_cabac_inline_x86
94 :
"=&r"(bit),
"+&r"(c->
low),
"+&r"(c->
range),
"=&q"(tmp),
103 #define get_cabac_bypass_sign get_cabac_bypass_sign_x86
109 "movl %2, %%eax \n\t"
111 "add %%eax, %%eax \n\t"
112 "sub %k1, %%eax \n\t"
114 "and %%edx, %k1 \n\t"
115 "add %k1, %%eax \n\t"
116 "xor %%edx, %%ecx \n\t"
117 "sub %%edx, %%ecx \n\t"
118 "test %%ax, %%ax \n\t"
121 "subl $0xFFFF, %%eax \n\t"
122 "movzwl (%1), %%edx \n\t"
124 "shrl $15, %%edx \n\t"
126 "addl %%edx, %%eax \n\t"
129 "movl %%eax, %2 \n\t"