Go to the documentation of this file.
24 #ifndef AVCODEC_MIPS_CABAC_H
25 #define AVCODEC_MIPS_CABAC_H
31 #define get_cabac_inline get_cabac_inline_mips
37 "lbu %[bit], 0(%[state]) \n\t"
38 "and %[tmp0], %[c_range], 0xC0 \n\t"
39 PTR_ADDU "%[tmp0], %[tmp0], %[tmp0] \n\t"
40 PTR_ADDU "%[tmp0], %[tmp0], %[tables] \n\t"
41 PTR_ADDU "%[tmp0], %[tmp0], %[bit] \n\t"
43 "lbu %[tmp1], %[lps_off](%[tmp0]) \n\t"
45 PTR_SUBU "%[c_range], %[c_range], %[tmp1] \n\t"
46 PTR_SLL "%[tmp0], %[c_range], 0x11 \n\t"
47 PTR_SUBU "%[tmp0], %[tmp0], %[c_low] \n\t"
50 PTR_SRA "%[tmp2], %[tmp0], 0x1F \n\t"
53 "beqz %[tmp2], 1f \n\t"
54 PTR_SLL "%[tmp0], %[c_range], 0x11 \n\t"
55 PTR_SUBU "%[c_low], %[c_low], %[tmp0] \n\t"
56 PTR_SUBU "%[tmp0], %[tmp1], %[c_range] \n\t"
57 PTR_ADDU "%[c_range], %[c_range], %[tmp0] \n\t"
58 "xor %[bit], %[bit], %[tmp2] \n\t"
62 PTR_ADDU "%[tmp0], %[tables], %[bit] \n\t"
63 "lbu %[tmp1], %[mlps_off](%[tmp0]) \n\t"
65 PTR_ADDU "%[tmp0], %[tables], %[c_range] \n\t"
66 "lbu %[tmp2], %[norm_off](%[tmp0]) \n\t"
68 "sb %[tmp1], 0(%[state]) \n\t"
69 "and %[bit], %[bit], 0x01 \n\t"
70 PTR_SLL "%[c_range], %[c_range], %[tmp2] \n\t"
71 PTR_SLL "%[c_low], %[c_low], %[tmp2] \n\t"
73 "and %[tmp0], %[c_low], %[cabac_mask] \n\t"
74 "bnez %[tmp0], 1f \n\t"
76 "xor %[tmp0], %[c_low], %[tmp0] \n\t"
77 PTR_SRA "%[tmp0], %[tmp0], 0x0f \n\t"
78 PTR_ADDU "%[tmp0], %[tmp0], %[tables] \n\t"
79 "lbu %[tmp2], %[norm_off](%[tmp0]) \n\t"
81 "lbu %[tmp0], 0(%[c_bytestream]) \n\t"
82 "lbu %[tmp1], 1(%[c_bytestream]) \n\t"
83 PTR_SLL "%[tmp0], %[tmp0], 0x09 \n\t"
84 PTR_SLL "%[tmp1], %[tmp1], 0x01 \n\t"
85 PTR_ADDU "%[tmp0], %[tmp0], %[tmp1] \n\t"
87 "lbu %[tmp0], 0(%[c_bytestream]) \n\t"
88 PTR_SLL "%[tmp0], %[tmp0], 0x01 \n\t"
90 PTR_SUBU "%[tmp0], %[tmp0], %[cabac_mask] \n\t"
92 "li %[tmp1], 0x07 \n\t"
93 PTR_SUBU "%[tmp1], %[tmp1], %[tmp2] \n\t"
94 PTR_SLL "%[tmp0], %[tmp0], %[tmp1] \n\t"
95 PTR_ADDU "%[c_low], %[c_low], %[tmp0] \n\t"
97 #if !UNCHECKED_BITSTREAM_READER
98 "bge %[c_bytestream], %[c_bytestream_end], 1f \n\t"
100 PTR_ADDIU "%[c_bytestream], %[c_bytestream], 0X02 \n\t"
102 : [
bit]
"=&r"(
bit), [tmp0]
"=&r"(tmp0), [tmp1]
"=&r"(tmp1), [tmp2]
"=&r"(tmp2),
103 [c_range]
"+&r"(
c->range), [c_low]
"+&r"(
c->low),
104 [c_bytestream]
"+&r"(
c->bytestream)
107 [c_bytestream_end]
"r"(
c->bytestream_end),
#define bit(string, value)
Writing a table generator This documentation is preliminary Parts of the API are not good and should be changed Basic concepts A table generator consists of two *_tablegen c and *_tablegen h The h file will provide the variable declarations and initialization code for the tables
const uint8_t ff_h264_cabac_tables[512+4 *2 *64+4 *64+63]
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
#define H264_LPS_RANGE_OFFSET
#define H264_NORM_SHIFT_OFFSET
__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")
static av_always_inline int get_cabac_inline_mips(CABACContext *c, uint8_t *const state)
#define UNCHECKED_BITSTREAM_READER
#define H264_MLPS_STATE_OFFSET