MCPcopy Create free account
hub / github.com/abbeycode/UnrarKit / decodeBinSymbol

Method decodeBinSymbol

Libraries/unrar/model.cpp:364–393  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

362
363
364inline void RARPPM_CONTEXT::decodeBinSymbol(ModelPPM *Model)
365{
366 RARPPM_STATE& rs=OneState;
367 Model->HiBitsFlag=Model->HB2Flag[Model->FoundState->Symbol];
368 ushort& bs=Model->BinSumm[rs.Freq-1][Model->PrevSuccess+
369 Model->NS2BSIndx[Suffix->NumStats-1]+
370 Model->HiBitsFlag+2*Model->HB2Flag[rs.Symbol]+
371 ((Model->RunLength >> 26) & 0x20)];
372 if (Model->Coder.GetCurrentShiftCount(TOT_BITS) < bs)
373 {
374 Model->FoundState=&rs;
375 rs.Freq += (rs.Freq < 128);
376 Model->Coder.SubRange.LowCount=0;
377 Model->Coder.SubRange.HighCount=bs;
378 bs = GET_SHORT16(bs+INTERVAL-GET_MEAN(bs,PERIOD_BITS,2));
379 Model->PrevSuccess=1;
380 Model->RunLength++;
381 }
382 else
383 {
384 Model->Coder.SubRange.LowCount=bs;
385 bs = GET_SHORT16(bs-GET_MEAN(bs,PERIOD_BITS,2));
386 Model->Coder.SubRange.HighCount=BIN_SCALE;
387 Model->InitEsc=ExpEscape[bs >> 10];
388 Model->NumMasked=1;
389 Model->CharMask[rs.Symbol]=Model->EscCount;
390 Model->PrevSuccess=0;
391 Model->FoundState=NULL;
392 }
393}
394
395
396inline void RARPPM_CONTEXT::update1(ModelPPM *Model,RARPPM_STATE* p)

Callers 1

DecodeCharMethod · 0.80

Calls 1

GetCurrentShiftCountMethod · 0.80

Tested by

no test coverage detected