| 598 | |
| 599 | |
| 600 | int ModelPPM::DecodeChar() |
| 601 | { |
| 602 | if ((byte*)MinContext <= SubAlloc.pText || (byte*)MinContext>SubAlloc.HeapEnd) |
| 603 | return(-1); |
| 604 | if (MinContext->NumStats != 1) |
| 605 | { |
| 606 | if ((byte*)MinContext->U.Stats <= SubAlloc.pText || (byte*)MinContext->U.Stats>SubAlloc.HeapEnd) |
| 607 | return(-1); |
| 608 | if (!MinContext->decodeSymbol1(this)) |
| 609 | return(-1); |
| 610 | } |
| 611 | else |
| 612 | MinContext->decodeBinSymbol(this); |
| 613 | Coder.Decode(); |
| 614 | while ( !FoundState ) |
| 615 | { |
| 616 | ARI_DEC_NORMALIZE(Coder.code,Coder.low,Coder.range,Coder.UnpackRead); |
| 617 | do |
| 618 | { |
| 619 | OrderFall++; |
| 620 | MinContext=MinContext->Suffix; |
| 621 | if ((byte*)MinContext <= SubAlloc.pText || (byte*)MinContext>SubAlloc.HeapEnd) |
| 622 | return(-1); |
| 623 | } while (MinContext->NumStats == NumMasked); |
| 624 | if (!MinContext->decodeSymbol2(this)) |
| 625 | return(-1); |
| 626 | Coder.Decode(); |
| 627 | } |
| 628 | int Symbol=FoundState->Symbol; |
| 629 | if (!OrderFall && (byte*) FoundState->Successor > SubAlloc.pText) |
| 630 | MinContext=MaxContext=FoundState->Successor; |
| 631 | else |
| 632 | { |
| 633 | UpdateModel(); |
| 634 | if (EscCount == 0) |
| 635 | ClearMask(); |
| 636 | } |
| 637 | ARI_DEC_NORMALIZE(Coder.code,Coder.low,Coder.range,Coder.UnpackRead); |
| 638 | return(Symbol); |
| 639 | } |
no test coverage detected