MCPcopy Create free account
hub / github.com/LASzip/LASzip / decodeSymbol

Method decodeSymbol

unused/rangedecoder.cpp:118–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

116}
117
118U32 RangeDecoder::decodeSymbol(EntropyModel* model)
119{
120 RangeModel* m = (RangeModel*)model;
121 U32 sym;
122 U32 ltfreq;
123 U32 syfreq;
124 U32 tmp;
125 U32 lg_totf = m->lg_totf;
126
127 normalize();
128 help = this->range>>lg_totf;
129 ltfreq = low/help;
130#ifdef EXTRAFAST
131 ltfreq = ltfreq;
132#else
133 ltfreq = ((ltfreq>>lg_totf) ? (1<<lg_totf)-1 : ltfreq);
134#endif
135
136 sym = m->getsym(ltfreq);
137 m->getfreq(sym,&syfreq,&ltfreq);
138
139 tmp = help * ltfreq;
140 low -= tmp;
141#ifdef EXTRAFAST
142 this->range = help * syfreq;
143#else
144 if ((ltfreq + syfreq) < (1u<<lg_totf))
145 {
146 this->range = help * syfreq;
147 }
148 else
149 {
150 this->range -= tmp;
151 }
152#endif
153
154 m->update(sym);
155
156 return sym;
157}
158
159/* Decode a bit without modelling */
160U32 RangeDecoder::readBit()

Callers

nothing calls this directly

Calls 3

getsymMethod · 0.80
getfreqMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected