Lines Matching refs:p
16 #define _IF_BIT_0 ttt = *prob; bound = (p->range >> kNumModelBits) * ttt; if (p->code < bound)
17 #define _UPDATE_0 p->range = bound; *prob = (CProb)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits));
18 #define _UPDATE_1 p->range -= bound; p->code -= bound; *prob = (CProb)(ttt - (ttt >> kNumMoveBits));
20 void Bcj2Dec_Init(CBcj2Dec *p) in Bcj2Dec_Init() argument
24 p->state = BCJ2_DEC_STATE_OK; in Bcj2Dec_Init()
25 p->ip = 0; in Bcj2Dec_Init()
26 p->temp[3] = 0; in Bcj2Dec_Init()
27 p->range = 0; in Bcj2Dec_Init()
28 p->code = 0; in Bcj2Dec_Init()
29 for (i = 0; i < sizeof(p->probs) / sizeof(p->probs[0]); i++) in Bcj2Dec_Init()
30 p->probs[i] = kBitModelTotal >> 1; in Bcj2Dec_Init()
33 SRes Bcj2Dec_Decode(CBcj2Dec *p) in Bcj2Dec_Decode() argument
35 if (p->range <= 5) in Bcj2Dec_Decode()
37 p->state = BCJ2_DEC_STATE_OK; in Bcj2Dec_Decode()
38 for (; p->range != 5; p->range++) in Bcj2Dec_Decode()
40 if (p->range == 1 && p->code != 0) in Bcj2Dec_Decode()
43 if (p->bufs[BCJ2_STREAM_RC] == p->lims[BCJ2_STREAM_RC]) in Bcj2Dec_Decode()
45 p->state = BCJ2_STREAM_RC; in Bcj2Dec_Decode()
49 p->code = (p->code << 8) | *(p->bufs[BCJ2_STREAM_RC])++; in Bcj2Dec_Decode()
52 if (p->code == 0xFFFFFFFF) in Bcj2Dec_Decode()
55 p->range = 0xFFFFFFFF; in Bcj2Dec_Decode()
57 else if (p->state >= BCJ2_DEC_STATE_ORIG_0) in Bcj2Dec_Decode()
59 while (p->state <= BCJ2_DEC_STATE_ORIG_3) in Bcj2Dec_Decode()
61 Byte *dest = p->dest; in Bcj2Dec_Decode()
62 if (dest == p->destLim) in Bcj2Dec_Decode()
64 *dest = p->temp[p->state++ - BCJ2_DEC_STATE_ORIG_0]; in Bcj2Dec_Decode()
65 p->dest = dest + 1; in Bcj2Dec_Decode()
106 if (BCJ2_IS_32BIT_STREAM(p->state)) in Bcj2Dec_Decode()
107 p->state = BCJ2_DEC_STATE_OK; in Bcj2Dec_Decode()
110 if (p->range < kTopValue) in Bcj2Dec_Decode()
112 if (p->bufs[BCJ2_STREAM_RC] == p->lims[BCJ2_STREAM_RC]) in Bcj2Dec_Decode()
114 p->state = BCJ2_STREAM_RC; in Bcj2Dec_Decode()
117 p->range <<= 8; in Bcj2Dec_Decode()
118 p->code = (p->code << 8) | *(p->bufs[BCJ2_STREAM_RC])++; in Bcj2Dec_Decode()
122 const Byte *src = p->bufs[BCJ2_STREAM_MAIN]; in Bcj2Dec_Decode()
125 SizeT num = p->lims[BCJ2_STREAM_MAIN] - src; in Bcj2Dec_Decode()
129 p->state = BCJ2_STREAM_MAIN; in Bcj2Dec_Decode()
133 dest = p->dest; in Bcj2Dec_Decode()
134 if (num > (SizeT)(p->destLim - dest)) in Bcj2Dec_Decode()
136 num = p->destLim - dest; in Bcj2Dec_Decode()
139 p->state = BCJ2_DEC_STATE_ORIG; in Bcj2Dec_Decode()
146 if (p->temp[3] == 0x0F && (src[0] & 0xF0) == 0x80) in Bcj2Dec_Decode()
170 num = src - p->bufs[BCJ2_STREAM_MAIN]; in Bcj2Dec_Decode()
174 p->temp[3] = src[-1]; in Bcj2Dec_Decode()
175 p->bufs[BCJ2_STREAM_MAIN] = src; in Bcj2Dec_Decode()
176 p->ip += (UInt32)num; in Bcj2Dec_Decode()
177 p->dest += num; in Bcj2Dec_Decode()
178 p->state = in Bcj2Dec_Decode()
179 p->bufs[BCJ2_STREAM_MAIN] == in Bcj2Dec_Decode()
180 p->lims[BCJ2_STREAM_MAIN] ? in Bcj2Dec_Decode()
190 Byte prev = (Byte)(num == 0 ? p->temp[3] : src[-1]); in Bcj2Dec_Decode()
192 p->temp[3] = b; in Bcj2Dec_Decode()
193 p->bufs[BCJ2_STREAM_MAIN] = src + 1; in Bcj2Dec_Decode()
195 p->ip += (UInt32)num; in Bcj2Dec_Decode()
196 p->dest += num; in Bcj2Dec_Decode()
198 prob = p->probs + (unsigned)(b == 0xE8 ? 2 + (unsigned)prev : (b == 0xE9 ? 1 : 0)); in Bcj2Dec_Decode()
213 unsigned cj = (p->temp[3] == 0xE8) ? BCJ2_STREAM_CALL : BCJ2_STREAM_JUMP; in Bcj2Dec_Decode()
214 const Byte *cur = p->bufs[cj]; in Bcj2Dec_Decode()
218 if (cur == p->lims[cj]) in Bcj2Dec_Decode()
220 p->state = cj; in Bcj2Dec_Decode()
225 p->bufs[cj] = cur + 4; in Bcj2Dec_Decode()
227 p->ip += 4; in Bcj2Dec_Decode()
228 val -= p->ip; in Bcj2Dec_Decode()
229 dest = p->dest; in Bcj2Dec_Decode()
230 rem = p->destLim - dest; in Bcj2Dec_Decode()
235 SetUi32(p->temp, val); in Bcj2Dec_Decode()
237 dest[i] = p->temp[i]; in Bcj2Dec_Decode()
238 p->dest = dest + rem; in Bcj2Dec_Decode()
239 p->state = BCJ2_DEC_STATE_ORIG_0 + (unsigned)rem; in Bcj2Dec_Decode()
244 p->temp[3] = (Byte)(val >> 24); in Bcj2Dec_Decode()
245 p->dest = dest + 4; in Bcj2Dec_Decode()
249 if (p->range < kTopValue && p->bufs[BCJ2_STREAM_RC] != p->lims[BCJ2_STREAM_RC]) in Bcj2Dec_Decode()
251 p->range <<= 8; in Bcj2Dec_Decode()
252 p->code = (p->code << 8) | *(p->bufs[BCJ2_STREAM_RC])++; in Bcj2Dec_Decode()