Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Pavlov <ipavlov@users.sourceforge.net>2008-08-13 04:00:00 +0400
committerKornel LesiƄski <kornel@geekhood.net>2016-05-28 02:15:56 +0300
commit173c07e166fdf6fcd20f18ea73008f1b628945df (patch)
tree13ebea85cdc4c16ae93714ff0627ee9f91ad7e08 /CPP/7zip/Compress/PPMD/PPMDEncode.h
parent3901bf0ab88106a5b031cba7bc18d60cdebf7eef (diff)
4.59 beta
Diffstat (limited to 'CPP/7zip/Compress/PPMD/PPMDEncode.h')
-rwxr-xr-xCPP/7zip/Compress/PPMD/PPMDEncode.h60
1 files changed, 30 insertions, 30 deletions
diff --git a/CPP/7zip/Compress/PPMD/PPMDEncode.h b/CPP/7zip/Compress/PPMD/PPMDEncode.h
index 6a720cac..1e9d907c 100755
--- a/CPP/7zip/Compress/PPMD/PPMDEncode.h
+++ b/CPP/7zip/Compress/PPMD/PPMDEncode.h
@@ -14,9 +14,9 @@ struct CEncodeInfo: public CInfo
void EncodeBinSymbol(int symbol, NRangeCoder::CEncoder *rangeEncoder)
{
- PPM_CONTEXT::STATE& rs = MinContext->oneState();
+ PPM_CONTEXT::STATE& rs = MinContext->oneState();
UInt16 &bs = GetBinSumm(rs, GetContextNoCheck(MinContext->Suffix)->NumStats);
- if (rs.Symbol == symbol)
+ if (rs.Symbol == symbol)
{
FoundState = &rs;
rs.Freq = (Byte)(rs.Freq + (rs.Freq < 128 ? 1: 0));
@@ -24,15 +24,15 @@ struct CEncodeInfo: public CInfo
bs = (UInt16)(bs + INTERVAL - GET_MEAN(bs, PERIOD_BITS, 2));
PrevSuccess = 1;
RunLength++;
- }
- else
+ }
+ else
{
rangeEncoder->EncodeBit(bs, TOT_BITS, 1);
bs = (UInt16)(bs - GET_MEAN(bs, PERIOD_BITS, 2));
InitEsc = ExpEscape[bs >> 10];
- NumMasked = 1;
+ NumMasked = 1;
CharMask[rs.Symbol] = EscCount;
- PrevSuccess = 0;
+ PrevSuccess = 0;
FoundState = NULL;
}
}
@@ -40,27 +40,27 @@ struct CEncodeInfo: public CInfo
void EncodeSymbol1(int symbol, NRangeCoder::CEncoder *rangeEncoder)
{
PPM_CONTEXT::STATE* p = GetStateNoCheck(MinContext->Stats);
- if (p->Symbol == symbol)
+ if (p->Symbol == symbol)
{
PrevSuccess = (2 * (p->Freq) > MinContext->SummFreq);
RunLength += PrevSuccess;
rangeEncoder->Encode(0, p->Freq, MinContext->SummFreq);
- (FoundState = p)->Freq += 4;
+ (FoundState = p)->Freq += 4;
MinContext->SummFreq += 4;
- if (p->Freq > MAX_FREQ)
+ if (p->Freq > MAX_FREQ)
rescale();
return;
}
PrevSuccess = 0;
int LoCnt = p->Freq, i = MinContext->NumStats - 1;
- while ((++p)->Symbol != symbol)
+ while ((++p)->Symbol != symbol)
{
LoCnt += p->Freq;
- if (--i == 0)
+ if (--i == 0)
{
HiBitsFlag = HB2Flag[FoundState->Symbol];
CharMask[p->Symbol] = EscCount;
- i=(NumMasked = MinContext->NumStats)-1;
+ i=(NumMasked = MinContext->NumStats)-1;
FoundState = NULL;
do { CharMask[(--p)->Symbol] = EscCount; } while ( --i );
rangeEncoder->Encode(LoCnt, MinContext->SummFreq - LoCnt, MinContext->SummFreq);
@@ -76,16 +76,16 @@ struct CEncodeInfo: public CInfo
int hiCnt, i = MinContext->NumStats - NumMasked;
UInt32 scale;
SEE2_CONTEXT* psee2c = makeEscFreq2(i, scale);
- PPM_CONTEXT::STATE* p = GetStateNoCheck(MinContext->Stats) - 1;
+ PPM_CONTEXT::STATE* p = GetStateNoCheck(MinContext->Stats) - 1;
hiCnt = 0;
- do
+ do
{
do { p++; } while (CharMask[p->Symbol] == EscCount);
hiCnt += p->Freq;
- if (p->Symbol == symbol)
+ if (p->Symbol == symbol)
goto SYMBOL_FOUND;
CharMask[p->Symbol] = EscCount;
- }
+ }
while ( --i );
rangeEncoder->Encode(hiCnt, scale, hiCnt + scale);
@@ -98,40 +98,40 @@ SYMBOL_FOUND:
UInt32 highCount = hiCnt;
UInt32 lowCount = highCount - p->Freq;
- if ( --i )
+ if ( --i )
{
PPM_CONTEXT::STATE* p1 = p;
- do
+ do
{
do { p1++; } while (CharMask[p1->Symbol] == EscCount);
hiCnt += p1->Freq;
- }
+ }
while ( --i );
}
// SubRange.scale += hiCnt;
scale += hiCnt;
rangeEncoder->Encode(lowCount, highCount - lowCount, scale);
- psee2c->update();
+ psee2c->update();
update2(p);
}
void EncodeSymbol(int c, NRangeCoder::CEncoder *rangeEncoder)
{
- if (MinContext->NumStats != 1)
- EncodeSymbol1(c, rangeEncoder);
- else
- EncodeBinSymbol(c, rangeEncoder);
- while ( !FoundState )
+ if (MinContext->NumStats != 1)
+ EncodeSymbol1(c, rangeEncoder);
+ else
+ EncodeBinSymbol(c, rangeEncoder);
+ while ( !FoundState )
{
- do
+ do
{
- OrderFall++;
+ OrderFall++;
MinContext = GetContext(MinContext->Suffix);
- if (MinContext == 0)
+ if (MinContext == 0)
return; // S_OK;
- }
+ }
while (MinContext->NumStats == NumMasked);
- EncodeSymbol2(c, rangeEncoder);
+ EncodeSymbol2(c, rangeEncoder);
}
NextContext();
}