Lines Matching refs:rbsp
51 static inline void vl_rbsp_init(struct vl_rbsp *rbsp, struct vl_vlc *nal, unsigned num_bits) in vl_rbsp_init() argument
57 rbsp->nal = *nal; in vl_rbsp_init()
63 vl_vlc_limit(&rbsp->nal, bits_left - vl_vlc_bits_left(nal)); in vl_rbsp_init()
69 valid = vl_vlc_valid_bits(&rbsp->nal); in vl_rbsp_init()
72 if ((vl_vlc_peekbits(&rbsp->nal, i) & 0xffffff) == 0x3) { in vl_rbsp_init()
73 vl_vlc_removebits(&rbsp->nal, i - 8, 8); in vl_rbsp_init()
78 valid = vl_vlc_valid_bits(&rbsp->nal); in vl_rbsp_init()
80 rbsp->escaped = (valid >= 16) ? 16 : ((valid >= 8) ? 8 : 0); in vl_rbsp_init()
86 static inline void vl_rbsp_fillbits(struct vl_rbsp *rbsp) in vl_rbsp_fillbits() argument
88 unsigned valid = vl_vlc_valid_bits(&rbsp->nal); in vl_rbsp_fillbits()
95 vl_vlc_fillbits(&rbsp->nal); in vl_rbsp_fillbits()
98 if (vl_vlc_bits_left(&rbsp->nal) < 24) in vl_rbsp_fillbits()
102 assert(valid >= rbsp->escaped); in vl_rbsp_fillbits()
105 valid -= rbsp->escaped; in vl_rbsp_fillbits()
108 rbsp->escaped = 16; in vl_rbsp_fillbits()
109 bits = vl_vlc_valid_bits(&rbsp->nal); in vl_rbsp_fillbits()
111 if ((vl_vlc_peekbits(&rbsp->nal, i) & 0xffffff) == 0x3) { in vl_rbsp_fillbits()
112 vl_vlc_removebits(&rbsp->nal, i - 8, 8); in vl_rbsp_fillbits()
113 rbsp->escaped = bits - i; in vl_rbsp_fillbits()
123 static inline unsigned vl_rbsp_u(struct vl_rbsp *rbsp, unsigned n) in vl_rbsp_u() argument
128 vl_rbsp_fillbits(rbsp); in vl_rbsp_u()
129 return vl_vlc_get_uimsbf(&rbsp->nal, n); in vl_rbsp_u()
135 static inline unsigned vl_rbsp_ue(struct vl_rbsp *rbsp) in vl_rbsp_ue() argument
139 vl_rbsp_fillbits(rbsp); in vl_rbsp_ue()
140 while (!vl_vlc_get_uimsbf(&rbsp->nal, 1)) in vl_rbsp_ue()
143 return (1 << bits) - 1 + vl_rbsp_u(rbsp, bits); in vl_rbsp_ue()
149 static inline signed vl_rbsp_se(struct vl_rbsp *rbsp) in vl_rbsp_se() argument
151 signed codeNum = vl_rbsp_ue(rbsp); in vl_rbsp_se()
161 static inline bool vl_rbsp_more_data(struct vl_rbsp *rbsp) in vl_rbsp_more_data() argument
165 if (vl_vlc_bits_left(&rbsp->nal) > 8) in vl_rbsp_more_data()
168 bits = vl_vlc_valid_bits(&rbsp->nal); in vl_rbsp_more_data()
169 value = vl_vlc_peekbits(&rbsp->nal, bits); in vl_rbsp_more_data()