Go to the documentation of this file.
19 #ifndef AVCODEC_ARM_CABAC_H
20 #define AVCODEC_ARM_CABAC_H
23 #if HAVE_ARMV6T2_INLINE
29 #define get_cabac_inline get_cabac_inline_arm
34 void *reg_b, *reg_c, *
tmp;
37 "ldrb %[bit] , [%[state]] \n\t"
38 "add %[r_b] , %[tables] , %[lps_off] \n\t"
39 "mov %[tmp] , %[range] \n\t"
40 "and %[range] , %[range] , #0xC0 \n\t"
41 "add %[r_b] , %[r_b] , %[bit] \n\t"
42 "ldrb %[range] , [%[r_b], %[range], lsl #1] \n\t"
43 "add %[r_b] , %[tables] , %[norm_off] \n\t"
44 "sub %[r_c] , %[tmp] , %[range] \n\t"
45 "lsl %[tmp] , %[r_c] , #17 \n\t"
46 "cmp %[tmp] , %[low] \n\t"
48 "movgt %[range] , %[r_c] \n\t"
50 "mvncc %[bit] , %[bit] \n\t"
51 "subcc %[low] , %[low] , %[tmp] \n\t"
52 "add %[r_c] , %[tables] , %[mlps_off] \n\t"
53 "ldrb %[tmp] , [%[r_b], %[range]] \n\t"
54 "ldrb %[r_b] , [%[r_c], %[bit]] \n\t"
55 "lsl %[low] , %[low] , %[tmp] \n\t"
56 "lsl %[range] , %[range] , %[tmp] \n\t"
57 "uxth %[r_c] , %[low] \n\t"
58 "strb %[r_b] , [%[state]] \n\t"
59 "tst %[r_c] , %[r_c] \n\t"
61 "ldr %[r_c] , [%[c], %[byte]] \n\t"
62 #if UNCHECKED_BITSTREAM_READER
63 "ldrh %[tmp] , [%[r_c]] \n\t"
64 "add %[r_c] , %[r_c] , #2 \n\t"
65 "str %[r_c] , [%[c], %[byte]] \n\t"
67 "ldr %[r_b] , [%[c], %[end]] \n\t"
68 "ldrh %[tmp] , [%[r_c]] \n\t"
69 "cmp %[r_c] , %[r_b] \n\t"
71 "addlt %[r_c] , %[r_c] , #2 \n\t"
72 "strlt %[r_c] , [%[c], %[byte]] \n\t"
74 "sub %[r_c] , %[low] , #1 \n\t"
75 "add %[r_b] , %[tables] , %[norm_off] \n\t"
76 "eor %[r_c] , %[low] , %[r_c] \n\t"
77 "rev %[tmp] , %[tmp] \n\t"
78 "lsr %[r_c] , %[r_c] , #15 \n\t"
79 "lsr %[tmp] , %[tmp] , #15 \n\t"
80 "ldrb %[r_c] , [%[r_b], %[r_c]] \n\t"
81 "movw %[r_b] , #0xFFFF \n\t"
82 "sub %[tmp] , %[tmp] , %[r_b] \n\t"
83 "rsb %[r_c] , %[r_c] , #7 \n\t"
84 "lsl %[tmp] , %[tmp] , %[r_c] \n\t"
85 "add %[low] , %[low] , %[tmp] \n\t"
89 [range]
"+&r"(
c->range),
static av_cold int end(AVCodecContext *avctx)
#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
#define H264_MLPS_STATE_OFFSET