25#ifndef AVCODEC_MIPS_CABAC_H
26#define AVCODEC_MIPS_CABAC_H
33#if !HAVE_MIPS32R6 && !HAVE_MIPS64R6
34#define get_cabac_inline get_cabac_inline_mips
36 uint8_t *
const state){
40 "lbu %[bit], 0(%[state]) \n\t"
41 "and %[tmp0], %[c_range], 0xC0 \n\t"
42 PTR_SLL "%[tmp0], %[tmp0], 0x01 \n\t"
43 PTR_ADDU "%[tmp0], %[tmp0], %[tables] \n\t"
44 PTR_ADDU "%[tmp0], %[tmp0], %[bit] \n\t"
46 "lbu %[tmp1], %[lps_off](%[tmp0]) \n\t"
48 PTR_SUBU "%[c_range], %[c_range], %[tmp1] \n\t"
49 PTR_SLL "%[tmp0], %[c_range], 0x11 \n\t"
50 "slt %[tmp2], %[tmp0], %[c_low] \n\t"
51 "beqz %[tmp2], 1f \n\t"
52 "move %[c_range], %[tmp1] \n\t"
53 "not %[bit], %[bit] \n\t"
54 PTR_SUBU "%[c_low], %[c_low], %[tmp0] \n\t"
58 PTR_ADDU "%[tmp0], %[tables], %[bit] \n\t"
59 "lbu %[tmp1], %[mlps_off](%[tmp0]) \n\t"
61 PTR_ADDU "%[tmp0], %[tables], %[c_range] \n\t"
62 "lbu %[tmp2], %[norm_off](%[tmp0]) \n\t"
64 "sb %[tmp1], 0(%[state]) \n\t"
65 "and %[bit], %[bit], 0x01 \n\t"
66 PTR_SLL "%[c_range], %[c_range], %[tmp2] \n\t"
67 PTR_SLL "%[c_low], %[c_low], %[tmp2] \n\t"
69 "and %[tmp1], %[c_low], %[cabac_mask] \n\t"
70 "bnez %[tmp1], 1f \n\t"
72 "xor %[tmp0], %[c_low], %[tmp0] \n\t"
73 PTR_SRA "%[tmp0], %[tmp0], 0x0f \n\t"
74 PTR_ADDU "%[tmp0], %[tmp0], %[tables] \n\t"
76 "lbu %[tmp2], %[norm_off](%[tmp0]) \n\t"
78 "lhu %[tmp0], 0(%[c_bytestream]) \n\t"
80 "lhu %[tmp0], 0(%[c_bytestream]) \n\t"
81#if HAVE_MIPS32R2 || HAVE_MIPS64R2
82 "wsbh %[tmp0], %[tmp0] \n\t"
84 "and %[tmp1], %[tmp0], 0xff00ff00 \n\t"
85 "srl %[tmp1], %[tmp1], 8 \n\t"
86 "and %[tmp0], %[tmp0], 0x00ff00ff \n\t"
87 "sll %[tmp0], %[tmp0], 8 \n\t"
88 "or %[tmp0], %[tmp0], %[tmp1] \n\t"
91 PTR_SLL "%[tmp0], %[tmp0], 0x01 \n\t"
92 PTR_SUBU "%[tmp0], %[tmp0], %[cabac_mask] \n\t"
94 "li %[tmp1], 0x07 \n\t"
95 PTR_SUBU "%[tmp1], %[tmp1], %[tmp2] \n\t"
96 PTR_SLL "%[tmp0], %[tmp0], %[tmp1] \n\t"
97 PTR_ADDU "%[c_low], %[c_low], %[tmp0] \n\t"
99#if UNCHECKED_BITSTREAM_READER
100 PTR_ADDIU "%[c_bytestream], %[c_bytestream], 0x02 \n\t"
102 "slt %[tmp0], %[c_bytestream], %[c_bytestream_end] \n\t"
103 PTR_ADDIU "%[tmp2], %[c_bytestream], 0x02 \n\t"
104#if HAVE_MIPS32R2 || HAVE_MIPS64R2
105 "movn %[c_bytestream], %[tmp2], %[tmp0] \n\t"
107 "beqz %[tmp0], 2f \n\t"
109 "move %[c_bytestream], %[tmp2] \n\t"
114 : [
bit]
"=&r"(
bit), [tmp0]
"=&r"(tmp0), [tmp1]
"=&r"(tmp1), [tmp2]
"=&r"(tmp2),
115 [c_range]
"+&r"(
c->range), [c_low]
"+&r"(
c->low),
116 [c_bytestream]
"+&r"(
c->bytestream)
118#if !UNCHECKED_BITSTREAM_READER
119 [c_bytestream_end]
"r"(
c->bytestream_end),
131#define get_cabac_bypass get_cabac_bypass_mips
137 PTR_SLL "%[c_low], %[c_low], 0x01 \n\t"
138 "and %[tmp0], %[c_low], %[cabac_mask] \n\t"
139 "bnez %[tmp0], 1f \n\t"
141 "lhu %[tmp1], 0(%[c_bytestream]) \n\t"
143 "lhu %[tmp1], 0(%[c_bytestream]) \n\t"
144#if HAVE_MIPS32R2 || HAVE_MIPS64R2
145 "wsbh %[tmp1], %[tmp1] \n\t"
147 "and %[tmp0], %[tmp1], 0xff00ff00 \n\t"
148 "srl %[tmp0], %[tmp0], 8 \n\t"
149 "and %[tmp1], %[tmp1], 0x00ff00ff \n\t"
150 "sll %[tmp1], %[tmp1], 8 \n\t"
151 "or %[tmp1], %[tmp1], %[tmp0] \n\t"
154 PTR_SLL "%[tmp1], %[tmp1], 0x01 \n\t"
155 PTR_SUBU "%[tmp1], %[tmp1], %[cabac_mask] \n\t"
156 PTR_ADDU "%[c_low], %[c_low], %[tmp1] \n\t"
157#if UNCHECKED_BITSTREAM_READER
158 PTR_ADDIU "%[c_bytestream], %[c_bytestream], 0x02 \n\t"
160 "slt %[tmp0], %[c_bytestream], %[c_bytestream_end] \n\t"
161 PTR_ADDIU "%[tmp1], %[c_bytestream], 0x02 \n\t"
162#if HAVE_MIPS32R2 || HAVE_MIPS64R2
163 "movn %[c_bytestream], %[tmp1], %[tmp0] \n\t"
165 "beqz %[tmp0], 2f \n\t"
167 "move %[c_bytestream], %[tmp1] \n\t"
172 PTR_SLL "%[tmp1], %[c_range], 0x11 \n\t"
173 "slt %[tmp0], %[c_low], %[tmp1] \n\t"
174 PTR_SUBU "%[tmp1], %[c_low], %[tmp1] \n\t"
175#if HAVE_MIPS32R2 || HAVE_MIPS64R2
176 "movz %[res], %[one], %[tmp0] \n\t"
177 "movz %[c_low], %[tmp1], %[tmp0] \n\t"
179 "bnez %[tmp0], 2f \n\t"
181 "move %[res], %[one] \n\t"
182 "move %[c_low], %[tmp1] \n\t"
185 : [tmp0]
"=&r"(tmp0), [tmp1]
"=&r"(tmp1), [res]
"+&r"(res),
186 [c_range]
"+&r"(
c->range), [c_low]
"+&r"(
c->low),
187 [c_bytestream]
"+&r"(
c->bytestream)
189#if !UNCHECKED_BITSTREAM_READER
190 [c_bytestream_end]
"r"(
c->bytestream_end),
198#define get_cabac_bypass_sign get_cabac_bypass_sign_mips
204 PTR_SLL "%[c_low], %[c_low], 0x01 \n\t"
205 "and %[tmp0], %[c_low], %[cabac_mask] \n\t"
206 "bnez %[tmp0], 1f \n\t"
208 "lhu %[tmp1], 0(%[c_bytestream]) \n\t"
210 "lhu %[tmp1], 0(%[c_bytestream]) \n\t"
211#if HAVE_MIPS32R2 || HAVE_MIPS64R2
212 "wsbh %[tmp1], %[tmp1] \n\t"
214 "and %[tmp0], %[tmp1], 0xff00ff00 \n\t"
215 "srl %[tmp0], %[tmp0], 8 \n\t"
216 "and %[tmp1], %[tmp1], 0x00ff00ff \n\t"
217 "sll %[tmp1], %[tmp1], 8 \n\t"
218 "or %[tmp1], %[tmp1], %[tmp0] \n\t"
221 PTR_SLL "%[tmp1], %[tmp1], 0x01 \n\t"
222 PTR_SUBU "%[tmp1], %[tmp1], %[cabac_mask] \n\t"
223 PTR_ADDU "%[c_low], %[c_low], %[tmp1] \n\t"
224#if UNCHECKED_BITSTREAM_READER
225 PTR_ADDIU "%[c_bytestream], %[c_bytestream], 0x02 \n\t"
227 "slt %[tmp0], %[c_bytestream], %[c_bytestream_end] \n\t"
228 PTR_ADDIU "%[tmp1], %[c_bytestream], 0x02 \n\t"
229#if HAVE_MIPS32R2 || HAVE_MIPS64R2
230 "movn %[c_bytestream], %[tmp1], %[tmp0] \n\t"
232 "beqz %[tmp0], 2f \n\t"
234 "move %[c_bytestream], %[tmp1] \n\t"
239 PTR_SLL "%[tmp1], %[c_range], 0x11 \n\t"
240 "slt %[tmp0], %[c_low], %[tmp1] \n\t"
241 PTR_SUBU "%[tmp1], %[c_low], %[tmp1] \n\t"
242#if HAVE_MIPS32R2 || HAVE_MIPS64R2
243 "movz %[c_low], %[tmp1], %[tmp0] \n\t"
245 "bnez %[tmp0], 2f \n\t"
247 "move %[c_low], %[tmp1] \n\t"
250 PTR_SUBU "%[tmp1], %[zero], %[res] \n\t"
251#if HAVE_MIPS32R2 || HAVE_MIPS64R2
252 "movn %[res], %[tmp1], %[tmp0] \n\t"
254 "beqz %[tmp0], 3f \n\t"
256 "move %[res], %[tmp1] \n\t"
259 : [tmp0]
"=&r"(tmp0), [tmp1]
"=&r"(tmp1), [res]
"+&r"(res),
260 [c_range]
"+&r"(
c->range), [c_low]
"+&r"(
c->low),
261 [c_bytestream]
"+&r"(
c->bytestream)
263#if !UNCHECKED_BITSTREAM_READER
264 [c_bytestream_end]
"r"(
c->bytestream_end),
static double val(void *priv, double ch)
__asm__(".macro parse_r var r\n\t" "\\var = -1\n\t" _IFC_REG(0) _IFC_REG(1) _IFC_REG(2) _IFC_REG(3) _IFC_REG(4) _IFC_REG(5) _IFC_REG(6) _IFC_REG(7) _IFC_REG(8) _IFC_REG(9) _IFC_REG(10) _IFC_REG(11) _IFC_REG(12) _IFC_REG(13) _IFC_REG(14) _IFC_REG(15) _IFC_REG(16) _IFC_REG(17) _IFC_REG(18) _IFC_REG(19) _IFC_REG(20) _IFC_REG(21) _IFC_REG(22) _IFC_REG(23) _IFC_REG(24) _IFC_REG(25) _IFC_REG(26) _IFC_REG(27) _IFC_REG(28) _IFC_REG(29) _IFC_REG(30) _IFC_REG(31) ".iflt \\var\n\t" ".error \"Unable to parse register name \\r\"\n\t" ".endif\n\t" ".endm")
Context Adaptive Binary Arithmetic Coder.
#define H264_LPS_RANGE_OFFSET
#define H264_MLPS_STATE_OFFSET
#define H264_NORM_SHIFT_OFFSET
const uint8_t ff_h264_cabac_tables[512+4 *2 *64+4 *64+63]
#define bit(string, value)
static struct @346255127015250356166251341105367306144006377143 state
static int zero(InterplayACMContext *s, unsigned ind, unsigned col)
Macro definitions for various function/variable attributes.
static av_always_inline int get_cabac_bypass_mips(CABACContext *c)
static av_always_inline int get_cabac_inline_mips(CABACContext *c, uint8_t *const state)
static av_always_inline int get_cabac_bypass_sign_mips(CABACContext *c, int val)
static const uint8_t *const tables[]