mirror of
https://github.com/aaru-dps/Aaru.Compression.Native.git
synced 2026-07-08 18:06:12 +00:00
Refactor PPMd Variant G Code for Consistency and Readability
- Adjusted indentation and spacing in SubAllocatorVariantG.h for improved readability. - Reformatted function signatures in VariantG.c for consistent spacing. - Enhanced clarity in variable declarations and assignments throughout VariantG.c. - Updated comments and code structure in RestartModel and UpdateModel functions for better understanding. - Ensured consistent formatting in VariantG.h, including spacing and alignment of struct members. - Improved readability of the Decode functions by standardizing parameter spacing.
This commit is contained in:
@@ -23,181 +23,168 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define N1 4
|
||||
#define N2 4
|
||||
#define N3 4
|
||||
#define N4 ((128+3-1*N1-2*N2-3*N3)/4)
|
||||
#define N1 4
|
||||
#define N2 4
|
||||
#define N3 4
|
||||
#define N4 ((128 + 3 - 1 * N1 - 2 * N2 - 3 * N3) / 4)
|
||||
#define UNIT_SIZE 12
|
||||
#define N_INDEXES (N1+N2+N3+N4)
|
||||
#define N_INDEXES (N1 + N2 + N3 + N4)
|
||||
|
||||
static void InsertNode(PPMdSubAllocatorBrimstone *self,void *p,int index);
|
||||
static void *RemoveNode(PPMdSubAllocatorBrimstone *self,int index);
|
||||
static unsigned int I2B(PPMdSubAllocatorBrimstone *self,int index);
|
||||
static void SplitBlock(PPMdSubAllocatorBrimstone *self,void *pv,int oldindex,int newindex);
|
||||
//static uint32_t GetUsedMemory(PPMdSubAllocatorBrimstone *self);
|
||||
static void InsertNode(PPMdSubAllocatorBrimstone *self, void *p, int index);
|
||||
static void *RemoveNode(PPMdSubAllocatorBrimstone *self, int index);
|
||||
static unsigned int I2B(PPMdSubAllocatorBrimstone *self, int index);
|
||||
static void SplitBlock(PPMdSubAllocatorBrimstone *self, void *pv, int oldindex, int newindex);
|
||||
// static uint32_t GetUsedMemory(PPMdSubAllocatorBrimstone *self);
|
||||
|
||||
static void InitBrimstone(PPMdSubAllocatorBrimstone *self);
|
||||
static void InitBrimstone(PPMdSubAllocatorBrimstone *self);
|
||||
static uint32_t AllocContextBrimstone(PPMdSubAllocatorBrimstone *self);
|
||||
static uint32_t AllocUnitsBrimstone(PPMdSubAllocatorBrimstone *self,int num);
|
||||
static uint32_t ExpandUnitsBrimstone(PPMdSubAllocatorBrimstone *self,uint32_t oldoffs,int oldnum);
|
||||
static uint32_t ShrinkUnitsBrimstone(PPMdSubAllocatorBrimstone *self,uint32_t oldoffs,int oldnum,int newnum);
|
||||
static void FreeUnitsBrimstone(PPMdSubAllocatorBrimstone *self,uint32_t offs,int num);
|
||||
|
||||
|
||||
|
||||
static uint32_t AllocUnitsBrimstone(PPMdSubAllocatorBrimstone *self, int num);
|
||||
static uint32_t ExpandUnitsBrimstone(PPMdSubAllocatorBrimstone *self, uint32_t oldoffs, int oldnum);
|
||||
static uint32_t ShrinkUnitsBrimstone(PPMdSubAllocatorBrimstone *self, uint32_t oldoffs, int oldnum, int newnum);
|
||||
static void FreeUnitsBrimstone(PPMdSubAllocatorBrimstone *self, uint32_t offs, int num);
|
||||
|
||||
PPMdSubAllocatorBrimstone *CreateSubAllocatorBrimstone(int size)
|
||||
{
|
||||
PPMdSubAllocatorBrimstone *self=malloc(sizeof(PPMdSubAllocatorBrimstone)+size);
|
||||
if(!self) return NULL;
|
||||
PPMdSubAllocatorBrimstone *self = malloc(sizeof(PPMdSubAllocatorBrimstone) + size);
|
||||
if(!self) return NULL;
|
||||
|
||||
self->core.Init=(void *)InitBrimstone;
|
||||
self->core.AllocContext=(void *)AllocContextBrimstone;
|
||||
self->core.AllocUnits=(void *)AllocUnitsBrimstone;
|
||||
self->core.ExpandUnits=(void *)ExpandUnitsBrimstone;
|
||||
self->core.ShrinkUnits=(void *)ShrinkUnitsBrimstone;
|
||||
self->core.FreeUnits=(void *)FreeUnitsBrimstone;
|
||||
self->core.Init = (void *)InitBrimstone;
|
||||
self->core.AllocContext = (void *)AllocContextBrimstone;
|
||||
self->core.AllocUnits = (void *)AllocUnitsBrimstone;
|
||||
self->core.ExpandUnits = (void *)ExpandUnitsBrimstone;
|
||||
self->core.ShrinkUnits = (void *)ShrinkUnitsBrimstone;
|
||||
self->core.FreeUnits = (void *)FreeUnitsBrimstone;
|
||||
|
||||
self->SubAllocatorSize=size;
|
||||
self->SubAllocatorSize = size;
|
||||
|
||||
for(int i=0;i<N1;i++) self->Index2Units[i]=1+i;
|
||||
for(int i=0;i<N2;i++) self->Index2Units[N1+i]=2+N1+i*2;
|
||||
for(int i=0;i<N3;i++) self->Index2Units[N1+N2+i]=3+N1+2*N2+i*3;
|
||||
for(int i=0;i<N4;i++) self->Index2Units[N1+N2+N3+i]=4+N1+2*N2+3*N3+i*4;
|
||||
for(int i = 0; i < N1; i++) self->Index2Units[i] = 1 + i;
|
||||
for(int i = 0; i < N2; i++) self->Index2Units[N1 + i] = 2 + N1 + i * 2;
|
||||
for(int i = 0; i < N3; i++) self->Index2Units[N1 + N2 + i] = 3 + N1 + 2 * N2 + i * 3;
|
||||
for(int i = 0; i < N4; i++) self->Index2Units[N1 + N2 + N3 + i] = 4 + N1 + 2 * N2 + 3 * N3 + i * 4;
|
||||
|
||||
int i=0;
|
||||
for(int k=0;k<128;k++)
|
||||
{
|
||||
if(self->Index2Units[i]<k+1) i++;
|
||||
self->Units2Index[k]=i;
|
||||
int i = 0;
|
||||
for(int k = 0; k < 128; k++)
|
||||
{
|
||||
if(self->Index2Units[i] < k + 1) i++;
|
||||
self->Units2Index[k] = i;
|
||||
}
|
||||
|
||||
return self;
|
||||
return self;
|
||||
}
|
||||
|
||||
void FreeSubAllocatorBrimstone(PPMdSubAllocatorBrimstone *self)
|
||||
{
|
||||
free(self);
|
||||
}
|
||||
|
||||
|
||||
void FreeSubAllocatorBrimstone(PPMdSubAllocatorBrimstone *self) { free(self); }
|
||||
|
||||
static void InitBrimstone(PPMdSubAllocatorBrimstone *self)
|
||||
{
|
||||
memset(self->FreeList,0,sizeof(self->FreeList));
|
||||
memset(self->FreeList, 0, sizeof(self->FreeList));
|
||||
|
||||
self->LowUnit=self->HeapStart;
|
||||
self->HighUnit=self->HeapStart+UNIT_SIZE*(self->SubAllocatorSize/UNIT_SIZE);
|
||||
self->LowUnit = self->HeapStart;
|
||||
self->HighUnit = self->HeapStart + UNIT_SIZE * (self->SubAllocatorSize / UNIT_SIZE);
|
||||
}
|
||||
|
||||
static uint32_t AllocContextBrimstone(PPMdSubAllocatorBrimstone *self)
|
||||
{
|
||||
if(self->HighUnit>self->LowUnit)
|
||||
{
|
||||
self->HighUnit-=UNIT_SIZE;
|
||||
return PointerToOffset(self,self->HighUnit);
|
||||
}
|
||||
if(self->HighUnit > self->LowUnit)
|
||||
{
|
||||
self->HighUnit -= UNIT_SIZE;
|
||||
return PointerToOffset(self, self->HighUnit);
|
||||
}
|
||||
|
||||
return AllocUnitsBrimstone(self,1);
|
||||
return AllocUnitsBrimstone(self, 1);
|
||||
}
|
||||
|
||||
static uint32_t AllocUnitsBrimstone(PPMdSubAllocatorBrimstone *self,int num)
|
||||
static uint32_t AllocUnitsBrimstone(PPMdSubAllocatorBrimstone *self, int num)
|
||||
{
|
||||
int index=self->Units2Index[num-1];
|
||||
if(self->FreeList[index].next) return PointerToOffset(self,RemoveNode(self,index));
|
||||
int index = self->Units2Index[num - 1];
|
||||
if(self->FreeList[index].next) return PointerToOffset(self, RemoveNode(self, index));
|
||||
|
||||
void *units=self->LowUnit;
|
||||
self->LowUnit+=I2B(self,index);
|
||||
if(self->LowUnit<=self->HighUnit) return PointerToOffset(self,units);
|
||||
void *units = self->LowUnit;
|
||||
self->LowUnit += I2B(self, index);
|
||||
if(self->LowUnit <= self->HighUnit) return PointerToOffset(self, units);
|
||||
|
||||
self->LowUnit-=I2B(self,index);
|
||||
self->LowUnit -= I2B(self, index);
|
||||
|
||||
for(int i=index+1;i<N_INDEXES;i++)
|
||||
{
|
||||
if(self->FreeList[i].next)
|
||||
{
|
||||
void *units=RemoveNode(self,i);
|
||||
SplitBlock(self,units,i,index);
|
||||
return PointerToOffset(self,units);
|
||||
}
|
||||
}
|
||||
for(int i = index + 1; i < N_INDEXES; i++)
|
||||
{
|
||||
if(self->FreeList[i].next)
|
||||
{
|
||||
void *units = RemoveNode(self, i);
|
||||
SplitBlock(self, units, i, index);
|
||||
return PointerToOffset(self, units);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static uint32_t ExpandUnitsBrimstone(PPMdSubAllocatorBrimstone *self,uint32_t oldoffs,int oldnum)
|
||||
static uint32_t ExpandUnitsBrimstone(PPMdSubAllocatorBrimstone *self, uint32_t oldoffs, int oldnum)
|
||||
{
|
||||
void *oldptr=OffsetToPointer(self,oldoffs);
|
||||
int oldindex=self->Units2Index[oldnum-1];
|
||||
int newindex=self->Units2Index[oldnum];
|
||||
if(oldindex==newindex) return oldoffs;
|
||||
void *oldptr = OffsetToPointer(self, oldoffs);
|
||||
int oldindex = self->Units2Index[oldnum - 1];
|
||||
int newindex = self->Units2Index[oldnum];
|
||||
if(oldindex == newindex) return oldoffs;
|
||||
|
||||
uint32_t offs=AllocUnitsBrimstone(self,oldnum+1);
|
||||
if(offs)
|
||||
{
|
||||
// TODO: could copy less data
|
||||
memcpy(OffsetToPointer(self,offs),oldptr,I2B(self,oldindex));
|
||||
InsertNode(self,oldptr,oldindex);
|
||||
}
|
||||
return offs;
|
||||
uint32_t offs = AllocUnitsBrimstone(self, oldnum + 1);
|
||||
if(offs)
|
||||
{
|
||||
// TODO: could copy less data
|
||||
memcpy(OffsetToPointer(self, offs), oldptr, I2B(self, oldindex));
|
||||
InsertNode(self, oldptr, oldindex);
|
||||
}
|
||||
return offs;
|
||||
}
|
||||
|
||||
static uint32_t ShrinkUnitsBrimstone(PPMdSubAllocatorBrimstone *self,uint32_t oldoffs,int oldnum,int newnum)
|
||||
static uint32_t ShrinkUnitsBrimstone(PPMdSubAllocatorBrimstone *self, uint32_t oldoffs, int oldnum, int newnum)
|
||||
{
|
||||
void *oldptr=OffsetToPointer(self,oldoffs);
|
||||
int oldindex=self->Units2Index[oldnum-1];
|
||||
int newindex=self->Units2Index[newnum-1];
|
||||
if(oldindex==newindex) return oldoffs;
|
||||
void *oldptr = OffsetToPointer(self, oldoffs);
|
||||
int oldindex = self->Units2Index[oldnum - 1];
|
||||
int newindex = self->Units2Index[newnum - 1];
|
||||
if(oldindex == newindex) return oldoffs;
|
||||
|
||||
if(self->FreeList[newindex].next)
|
||||
{
|
||||
void *ptr=RemoveNode(self,newindex);
|
||||
memcpy(ptr,oldptr,I2B(self,newindex));
|
||||
InsertNode(self,oldptr,oldindex);
|
||||
return PointerToOffset(self,ptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
SplitBlock(self,oldptr,oldindex,newindex);
|
||||
return oldoffs;
|
||||
if(self->FreeList[newindex].next)
|
||||
{
|
||||
void *ptr = RemoveNode(self, newindex);
|
||||
memcpy(ptr, oldptr, I2B(self, newindex));
|
||||
InsertNode(self, oldptr, oldindex);
|
||||
return PointerToOffset(self, ptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
SplitBlock(self, oldptr, oldindex, newindex);
|
||||
return oldoffs;
|
||||
}
|
||||
}
|
||||
|
||||
static void FreeUnitsBrimstone(PPMdSubAllocatorBrimstone *self,uint32_t offs,int num)
|
||||
static void FreeUnitsBrimstone(PPMdSubAllocatorBrimstone *self, uint32_t offs, int num)
|
||||
{ InsertNode(self, OffsetToPointer(self, offs), self->Units2Index[num - 1]); }
|
||||
|
||||
static void InsertNode(PPMdSubAllocatorBrimstone *self, void *p, int index)
|
||||
{
|
||||
InsertNode(self,OffsetToPointer(self,offs),self->Units2Index[num-1]);
|
||||
((struct PPMAllocatorNodeBrimstone *)p)->next = self->FreeList[index].next;
|
||||
self->FreeList[index].next = p;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void InsertNode(PPMdSubAllocatorBrimstone *self,void *p,int index)
|
||||
static void *RemoveNode(PPMdSubAllocatorBrimstone *self, int index)
|
||||
{
|
||||
((struct PPMAllocatorNodeBrimstone *)p)->next=self->FreeList[index].next;
|
||||
self->FreeList[index].next=p;
|
||||
struct PPMAllocatorNodeBrimstone *node = self->FreeList[index].next;
|
||||
self->FreeList[index].next = node->next;
|
||||
return node;
|
||||
}
|
||||
|
||||
static void *RemoveNode(PPMdSubAllocatorBrimstone *self,int index)
|
||||
static unsigned int I2B(PPMdSubAllocatorBrimstone *self, int index) { return UNIT_SIZE * self->Index2Units[index]; }
|
||||
|
||||
static void SplitBlock(PPMdSubAllocatorBrimstone *self, void *pv, int oldindex, int newindex)
|
||||
{
|
||||
struct PPMAllocatorNodeBrimstone *node=self->FreeList[index].next;
|
||||
self->FreeList[index].next=node->next;
|
||||
return node;
|
||||
}
|
||||
uint8_t *p = ((uint8_t *)pv) + I2B(self, newindex);
|
||||
|
||||
static unsigned int I2B(PPMdSubAllocatorBrimstone *self,int index) { return UNIT_SIZE*self->Index2Units[index]; }
|
||||
|
||||
static void SplitBlock(PPMdSubAllocatorBrimstone *self,void *pv,int oldindex,int newindex)
|
||||
{
|
||||
uint8_t *p=((uint8_t *)pv)+I2B(self,newindex);
|
||||
|
||||
int diff=self->Index2Units[oldindex]-self->Index2Units[newindex];
|
||||
int i=self->Units2Index[diff-1];
|
||||
if(self->Index2Units[i]!=diff)
|
||||
{
|
||||
InsertNode(self,p,i-1);
|
||||
p+=I2B(self,i-1);
|
||||
diff-=self->Index2Units[i-1];
|
||||
int diff = self->Index2Units[oldindex] - self->Index2Units[newindex];
|
||||
int i = self->Units2Index[diff - 1];
|
||||
if(self->Index2Units[i] != diff)
|
||||
{
|
||||
InsertNode(self, p, i - 1);
|
||||
p += I2B(self, i - 1);
|
||||
diff -= self->Index2Units[i - 1];
|
||||
}
|
||||
|
||||
InsertNode(self,p,self->Units2Index[diff-1]);
|
||||
InsertNode(self, p, self->Units2Index[diff - 1]);
|
||||
}
|
||||
|
||||
@@ -25,16 +25,21 @@
|
||||
|
||||
typedef struct PPMdSubAllocatorBrimstone
|
||||
{
|
||||
PPMdSubAllocator core;
|
||||
PPMdSubAllocator core;
|
||||
|
||||
uint32_t SubAllocatorSize;
|
||||
uint8_t Index2Units[38],Units2Index[128];
|
||||
uint8_t *LowUnit,*HighUnit;
|
||||
struct PPMAllocatorNodeBrimstone { struct PPMAllocatorNodeBrimstone *next; } FreeList[38];
|
||||
uint8_t HeapStart[0];
|
||||
uint32_t SubAllocatorSize;
|
||||
uint8_t Index2Units[38], Units2Index[128];
|
||||
uint8_t *LowUnit, *HighUnit;
|
||||
|
||||
struct PPMAllocatorNodeBrimstone
|
||||
{
|
||||
struct PPMAllocatorNodeBrimstone *next;
|
||||
} FreeList[38];
|
||||
|
||||
uint8_t HeapStart[0];
|
||||
} PPMdSubAllocatorBrimstone;
|
||||
|
||||
PPMdSubAllocatorBrimstone *CreateSubAllocatorBrimstone(int size);
|
||||
void FreeSubAllocatorBrimstone(PPMdSubAllocatorBrimstone *self);
|
||||
void FreeSubAllocatorBrimstone(PPMdSubAllocatorBrimstone *self);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -23,193 +23,180 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define N1 4
|
||||
#define N2 4
|
||||
#define N3 4
|
||||
#define N4 ((128+3-1*N1-2*N2-3*N3)/4)
|
||||
#define N1 4
|
||||
#define N2 4
|
||||
#define N3 4
|
||||
#define N4 ((128 + 3 - 1 * N1 - 2 * N2 - 3 * N3) / 4)
|
||||
#define UNIT_SIZE 12
|
||||
#define N_INDEXES (N1+N2+N3+N4)
|
||||
#define N_INDEXES (N1 + N2 + N3 + N4)
|
||||
|
||||
static void InsertNode(PPMdSubAllocatorVariantG *self,void *p,int index);
|
||||
static void *RemoveNode(PPMdSubAllocatorVariantG *self,int index);
|
||||
static unsigned int I2B(PPMdSubAllocatorVariantG *self,int index);
|
||||
static void SplitBlock(PPMdSubAllocatorVariantG *self,void *pv,int oldindex,int newindex);
|
||||
//static uint32_t GetUsedMemory(PPMdSubAllocatorVariantG *self);
|
||||
static void InsertNode(PPMdSubAllocatorVariantG *self, void *p, int index);
|
||||
static void *RemoveNode(PPMdSubAllocatorVariantG *self, int index);
|
||||
static unsigned int I2B(PPMdSubAllocatorVariantG *self, int index);
|
||||
static void SplitBlock(PPMdSubAllocatorVariantG *self, void *pv, int oldindex, int newindex);
|
||||
// static uint32_t GetUsedMemory(PPMdSubAllocatorVariantG *self);
|
||||
|
||||
static void InitVariantG(PPMdSubAllocatorVariantG *self);
|
||||
static void InitVariantG(PPMdSubAllocatorVariantG *self);
|
||||
static uint32_t AllocContextVariantG(PPMdSubAllocatorVariantG *self);
|
||||
static uint32_t AllocUnitsVariantG(PPMdSubAllocatorVariantG *self,int num);
|
||||
static uint32_t ExpandUnitsVariantG(PPMdSubAllocatorVariantG *self,uint32_t oldoffs,int oldnum);
|
||||
static uint32_t ShrinkUnitsVariantG(PPMdSubAllocatorVariantG *self,uint32_t oldoffs,int oldnum,int newnum);
|
||||
static void FreeUnitsVariantG(PPMdSubAllocatorVariantG *self,uint32_t offs,int num);
|
||||
|
||||
|
||||
|
||||
static uint32_t AllocUnitsVariantG(PPMdSubAllocatorVariantG *self, int num);
|
||||
static uint32_t ExpandUnitsVariantG(PPMdSubAllocatorVariantG *self, uint32_t oldoffs, int oldnum);
|
||||
static uint32_t ShrinkUnitsVariantG(PPMdSubAllocatorVariantG *self, uint32_t oldoffs, int oldnum, int newnum);
|
||||
static void FreeUnitsVariantG(PPMdSubAllocatorVariantG *self, uint32_t offs, int num);
|
||||
|
||||
PPMdSubAllocatorVariantG *CreateSubAllocatorVariantG(int size)
|
||||
{
|
||||
PPMdSubAllocatorVariantG *self=malloc(sizeof(PPMdSubAllocatorVariantG)+size);
|
||||
if(!self) return NULL;
|
||||
PPMdSubAllocatorVariantG *self = malloc(sizeof(PPMdSubAllocatorVariantG) + size);
|
||||
if(!self) return NULL;
|
||||
|
||||
self->core.Init=(void *)InitVariantG;
|
||||
self->core.AllocContext=(void *)AllocContextVariantG;
|
||||
self->core.AllocUnits=(void *)AllocUnitsVariantG;
|
||||
self->core.ExpandUnits=(void *)ExpandUnitsVariantG;
|
||||
self->core.ShrinkUnits=(void *)ShrinkUnitsVariantG;
|
||||
self->core.FreeUnits=(void *)FreeUnitsVariantG;
|
||||
self->core.Init = (void *)InitVariantG;
|
||||
self->core.AllocContext = (void *)AllocContextVariantG;
|
||||
self->core.AllocUnits = (void *)AllocUnitsVariantG;
|
||||
self->core.ExpandUnits = (void *)ExpandUnitsVariantG;
|
||||
self->core.ShrinkUnits = (void *)ShrinkUnitsVariantG;
|
||||
self->core.FreeUnits = (void *)FreeUnitsVariantG;
|
||||
|
||||
self->SubAllocatorSize=size;
|
||||
self->SubAllocatorSize = size;
|
||||
|
||||
return self;
|
||||
return self;
|
||||
}
|
||||
|
||||
void FreeSubAllocatorVariantG(PPMdSubAllocatorVariantG *self)
|
||||
{
|
||||
free(self);
|
||||
}
|
||||
|
||||
|
||||
void FreeSubAllocatorVariantG(PPMdSubAllocatorVariantG *self) { free(self); }
|
||||
|
||||
static void InitVariantG(PPMdSubAllocatorVariantG *self)
|
||||
{
|
||||
memset(self->FreeList,0,sizeof(self->FreeList));
|
||||
memset(self->FreeList, 0, sizeof(self->FreeList));
|
||||
|
||||
self->LowUnit=self->HeapStart;
|
||||
self->HighUnit=self->HeapStart+UNIT_SIZE*(self->SubAllocatorSize/UNIT_SIZE);
|
||||
self->LastBreath=self->LowUnit;
|
||||
self->LowUnit+=128*128*UNIT_SIZE;
|
||||
self->LowUnit = self->HeapStart;
|
||||
self->HighUnit = self->HeapStart + UNIT_SIZE * (self->SubAllocatorSize / UNIT_SIZE);
|
||||
self->LastBreath = self->LowUnit;
|
||||
self->LowUnit += 128 * 128 * UNIT_SIZE;
|
||||
|
||||
for(int i=0;i<N1;i++) self->Index2Units[i]=1+i;
|
||||
for(int i=0;i<N2;i++) self->Index2Units[N1+i]=2+N1+i*2;
|
||||
for(int i=0;i<N3;i++) self->Index2Units[N1+N2+i]=3+N1+2*N2+i*3;
|
||||
for(int i=0;i<N4;i++) self->Index2Units[N1+N2+N3+i]=4+N1+2*N2+3*N3+i*4;
|
||||
for(int i = 0; i < N1; i++) self->Index2Units[i] = 1 + i;
|
||||
for(int i = 0; i < N2; i++) self->Index2Units[N1 + i] = 2 + N1 + i * 2;
|
||||
for(int i = 0; i < N3; i++) self->Index2Units[N1 + N2 + i] = 3 + N1 + 2 * N2 + i * 3;
|
||||
for(int i = 0; i < N4; i++) self->Index2Units[N1 + N2 + N3 + i] = 4 + N1 + 2 * N2 + 3 * N3 + i * 4;
|
||||
|
||||
int i=0;
|
||||
for(int k=0;k<128;k++)
|
||||
{
|
||||
if(self->Index2Units[i]<k+1) i++;
|
||||
self->Units2Index[k]=i;
|
||||
int i = 0;
|
||||
for(int k = 0; k < 128; k++)
|
||||
{
|
||||
if(self->Index2Units[i] < k + 1) i++;
|
||||
self->Units2Index[k] = i;
|
||||
}
|
||||
}
|
||||
|
||||
static uint32_t AllocContextVariantG(PPMdSubAllocatorVariantG *self)
|
||||
{
|
||||
if(self->HighUnit!=self->LowUnit)
|
||||
{
|
||||
self->HighUnit-=UNIT_SIZE;
|
||||
return PointerToOffset(self,self->HighUnit);
|
||||
}
|
||||
if(self->HighUnit != self->LowUnit)
|
||||
{
|
||||
self->HighUnit -= UNIT_SIZE;
|
||||
return PointerToOffset(self, self->HighUnit);
|
||||
}
|
||||
|
||||
return AllocUnitsVariantG(self,1);
|
||||
return AllocUnitsVariantG(self, 1);
|
||||
}
|
||||
|
||||
static uint32_t AllocUnitsVariantG(PPMdSubAllocatorVariantG *self,int num)
|
||||
static uint32_t AllocUnitsVariantG(PPMdSubAllocatorVariantG *self, int num)
|
||||
{
|
||||
int index=self->Units2Index[num-1];
|
||||
if(self->FreeList[index].next) return PointerToOffset(self,RemoveNode(self,index));
|
||||
int index = self->Units2Index[num - 1];
|
||||
if(self->FreeList[index].next) return PointerToOffset(self, RemoveNode(self, index));
|
||||
|
||||
void *units=self->LowUnit;
|
||||
self->LowUnit+=I2B(self,index);
|
||||
if(self->LowUnit<=self->HighUnit) return PointerToOffset(self,units);
|
||||
void *units = self->LowUnit;
|
||||
self->LowUnit += I2B(self, index);
|
||||
if(self->LowUnit <= self->HighUnit) return PointerToOffset(self, units);
|
||||
|
||||
if(self->LastBreath)
|
||||
{
|
||||
uint8_t *ptr=self->LastBreath;
|
||||
for(int i=0;i<128;i++)
|
||||
{
|
||||
InsertNode(self,ptr,N_INDEXES-1);
|
||||
ptr+=128*UNIT_SIZE;
|
||||
}
|
||||
self->LastBreath=NULL;
|
||||
}
|
||||
if(self->LastBreath)
|
||||
{
|
||||
uint8_t *ptr = self->LastBreath;
|
||||
for(int i = 0; i < 128; i++)
|
||||
{
|
||||
InsertNode(self, ptr, N_INDEXES - 1);
|
||||
ptr += 128 * UNIT_SIZE;
|
||||
}
|
||||
self->LastBreath = NULL;
|
||||
}
|
||||
|
||||
self->LowUnit-=I2B(self,index);
|
||||
self->LowUnit -= I2B(self, index);
|
||||
|
||||
for(int i=index+1;i<N_INDEXES;i++)
|
||||
{
|
||||
if(self->FreeList[i].next)
|
||||
{
|
||||
void *units=RemoveNode(self,i);
|
||||
SplitBlock(self,units,i,index);
|
||||
return PointerToOffset(self,units);
|
||||
}
|
||||
}
|
||||
for(int i = index + 1; i < N_INDEXES; i++)
|
||||
{
|
||||
if(self->FreeList[i].next)
|
||||
{
|
||||
void *units = RemoveNode(self, i);
|
||||
SplitBlock(self, units, i, index);
|
||||
return PointerToOffset(self, units);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static uint32_t ExpandUnitsVariantG(PPMdSubAllocatorVariantG *self,uint32_t oldoffs,int oldnum)
|
||||
static uint32_t ExpandUnitsVariantG(PPMdSubAllocatorVariantG *self, uint32_t oldoffs, int oldnum)
|
||||
{
|
||||
void *oldptr=OffsetToPointer(self,oldoffs);
|
||||
int oldindex=self->Units2Index[oldnum-1];
|
||||
int newindex=self->Units2Index[oldnum];
|
||||
if(oldindex==newindex) return oldoffs;
|
||||
void *oldptr = OffsetToPointer(self, oldoffs);
|
||||
int oldindex = self->Units2Index[oldnum - 1];
|
||||
int newindex = self->Units2Index[oldnum];
|
||||
if(oldindex == newindex) return oldoffs;
|
||||
|
||||
uint32_t offs=AllocUnitsVariantG(self,oldnum+1);
|
||||
if(offs)
|
||||
{
|
||||
memcpy(OffsetToPointer(self,offs),oldptr,I2B(self,oldindex));
|
||||
InsertNode(self,oldptr,oldindex);
|
||||
}
|
||||
return offs;
|
||||
uint32_t offs = AllocUnitsVariantG(self, oldnum + 1);
|
||||
if(offs)
|
||||
{
|
||||
memcpy(OffsetToPointer(self, offs), oldptr, I2B(self, oldindex));
|
||||
InsertNode(self, oldptr, oldindex);
|
||||
}
|
||||
return offs;
|
||||
}
|
||||
|
||||
static uint32_t ShrinkUnitsVariantG(PPMdSubAllocatorVariantG *self,uint32_t oldoffs,int oldnum,int newnum)
|
||||
static uint32_t ShrinkUnitsVariantG(PPMdSubAllocatorVariantG *self, uint32_t oldoffs, int oldnum, int newnum)
|
||||
{
|
||||
void *oldptr=OffsetToPointer(self,oldoffs);
|
||||
int oldindex=self->Units2Index[oldnum-1];
|
||||
int newindex=self->Units2Index[newnum-1];
|
||||
if(oldindex==newindex) return oldoffs;
|
||||
void *oldptr = OffsetToPointer(self, oldoffs);
|
||||
int oldindex = self->Units2Index[oldnum - 1];
|
||||
int newindex = self->Units2Index[newnum - 1];
|
||||
if(oldindex == newindex) return oldoffs;
|
||||
|
||||
if(self->FreeList[newindex].next)
|
||||
{
|
||||
void *ptr=RemoveNode(self,newindex);
|
||||
memcpy(ptr,oldptr,I2B(self,newindex));
|
||||
InsertNode(self,oldptr,oldindex);
|
||||
return PointerToOffset(self,ptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
SplitBlock(self,oldptr,oldindex,newindex);
|
||||
return oldoffs;
|
||||
if(self->FreeList[newindex].next)
|
||||
{
|
||||
void *ptr = RemoveNode(self, newindex);
|
||||
memcpy(ptr, oldptr, I2B(self, newindex));
|
||||
InsertNode(self, oldptr, oldindex);
|
||||
return PointerToOffset(self, ptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
SplitBlock(self, oldptr, oldindex, newindex);
|
||||
return oldoffs;
|
||||
}
|
||||
}
|
||||
|
||||
static void FreeUnitsVariantG(PPMdSubAllocatorVariantG *self,uint32_t offs,int num)
|
||||
static void FreeUnitsVariantG(PPMdSubAllocatorVariantG *self, uint32_t offs, int num)
|
||||
{ InsertNode(self, OffsetToPointer(self, offs), self->Units2Index[num - 1]); }
|
||||
|
||||
static void InsertNode(PPMdSubAllocatorVariantG *self, void *p, int index)
|
||||
{
|
||||
InsertNode(self,OffsetToPointer(self,offs),self->Units2Index[num-1]);
|
||||
((struct PPMAllocatorNodeVariantG *)p)->next = self->FreeList[index].next;
|
||||
self->FreeList[index].next = p;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void InsertNode(PPMdSubAllocatorVariantG *self,void *p,int index)
|
||||
static void *RemoveNode(PPMdSubAllocatorVariantG *self, int index)
|
||||
{
|
||||
((struct PPMAllocatorNodeVariantG *)p)->next=self->FreeList[index].next;
|
||||
self->FreeList[index].next=p;
|
||||
struct PPMAllocatorNodeVariantG *node = self->FreeList[index].next;
|
||||
self->FreeList[index].next = node->next;
|
||||
return node;
|
||||
}
|
||||
|
||||
static void *RemoveNode(PPMdSubAllocatorVariantG *self,int index)
|
||||
static unsigned int I2B(PPMdSubAllocatorVariantG *self, int index) { return UNIT_SIZE * self->Index2Units[index]; }
|
||||
|
||||
static void SplitBlock(PPMdSubAllocatorVariantG *self, void *pv, int oldindex, int newindex)
|
||||
{
|
||||
struct PPMAllocatorNodeVariantG *node=self->FreeList[index].next;
|
||||
self->FreeList[index].next=node->next;
|
||||
return node;
|
||||
}
|
||||
uint8_t *p = ((uint8_t *)pv) + I2B(self, newindex);
|
||||
|
||||
static unsigned int I2B(PPMdSubAllocatorVariantG *self,int index) { return UNIT_SIZE*self->Index2Units[index]; }
|
||||
|
||||
static void SplitBlock(PPMdSubAllocatorVariantG *self,void *pv,int oldindex,int newindex)
|
||||
{
|
||||
uint8_t *p=((uint8_t *)pv)+I2B(self,newindex);
|
||||
|
||||
int diff=self->Index2Units[oldindex]-self->Index2Units[newindex];
|
||||
int i=self->Units2Index[diff-1];
|
||||
if(self->Index2Units[i]!=diff)
|
||||
{
|
||||
InsertNode(self,p,i-1);
|
||||
p+=I2B(self,i-1);
|
||||
diff-=self->Index2Units[i-1];
|
||||
int diff = self->Index2Units[oldindex] - self->Index2Units[newindex];
|
||||
int i = self->Units2Index[diff - 1];
|
||||
if(self->Index2Units[i] != diff)
|
||||
{
|
||||
InsertNode(self, p, i - 1);
|
||||
p += I2B(self, i - 1);
|
||||
diff -= self->Index2Units[i - 1];
|
||||
}
|
||||
|
||||
InsertNode(self,p,self->Units2Index[diff-1]);
|
||||
InsertNode(self, p, self->Units2Index[diff - 1]);
|
||||
}
|
||||
|
||||
@@ -25,16 +25,21 @@
|
||||
|
||||
typedef struct PPMdSubAllocatorVariantG
|
||||
{
|
||||
PPMdSubAllocator core;
|
||||
PPMdSubAllocator core;
|
||||
|
||||
uint32_t SubAllocatorSize;
|
||||
uint8_t Index2Units[38],Units2Index[128];
|
||||
uint8_t *LowUnit,*HighUnit,*LastBreath;
|
||||
struct PPMAllocatorNodeVariantG { struct PPMAllocatorNodeVariantG *next; } FreeList[38];
|
||||
uint8_t HeapStart[0];
|
||||
uint32_t SubAllocatorSize;
|
||||
uint8_t Index2Units[38], Units2Index[128];
|
||||
uint8_t *LowUnit, *HighUnit, *LastBreath;
|
||||
|
||||
struct PPMAllocatorNodeVariantG
|
||||
{
|
||||
struct PPMAllocatorNodeVariantG *next;
|
||||
} FreeList[38];
|
||||
|
||||
uint8_t HeapStart[0];
|
||||
} PPMdSubAllocatorVariantG;
|
||||
|
||||
PPMdSubAllocatorVariantG *CreateSubAllocatorVariantG(int size);
|
||||
void FreeSubAllocatorVariantG(PPMdSubAllocatorVariantG *self);
|
||||
void FreeSubAllocatorVariantG(PPMdSubAllocatorVariantG *self);
|
||||
|
||||
#endif
|
||||
|
||||
655
ppmd/VariantG.c
655
ppmd/VariantG.c
@@ -25,402 +25,417 @@
|
||||
static bool RestartModel(PPMdModelVariantG *self);
|
||||
|
||||
static void UpdateModel(PPMdModelVariantG *self);
|
||||
static bool MakeRoot(PPMdModelVariantG *self,unsigned int SkipCount,PPMdState *state);
|
||||
static bool MakeRoot(PPMdModelVariantG *self, unsigned int SkipCount, PPMdState *state);
|
||||
|
||||
static void DecodeBinSymbolVariantG(PPMdContext *self,PPMdModelVariantG *model);
|
||||
static void DecodeSymbol1VariantG(PPMdContext *self,PPMdModelVariantG *model);
|
||||
static void DecodeSymbol2VariantG(PPMdContext *self,PPMdModelVariantG *model);
|
||||
static void DecodeBinSymbolVariantG(PPMdContext *self, PPMdModelVariantG *model);
|
||||
static void DecodeSymbol1VariantG(PPMdContext *self, PPMdModelVariantG *model);
|
||||
static void DecodeSymbol2VariantG(PPMdContext *self, PPMdModelVariantG *model);
|
||||
|
||||
static int NumberOfStates(PPMdContext *self) { return self->Flags?0:self->LastStateIndex+1; }
|
||||
static int NumberOfStates(PPMdContext *self) { return self->Flags ? 0 : self->LastStateIndex + 1; }
|
||||
|
||||
bool StartPPMdModelVariantG(PPMdModelVariantG *self,
|
||||
PPMdReadFunction *readfunc,void *inputcontext,
|
||||
PPMdSubAllocator *alloc,int maxorder,bool brimstone)
|
||||
bool StartPPMdModelVariantG(PPMdModelVariantG *self, PPMdReadFunction *readfunc, void *inputcontext,
|
||||
PPMdSubAllocator *alloc, int maxorder, bool brimstone)
|
||||
{
|
||||
if(brimstone) InitializePPMdRangeCoder(&self->core.coder,readfunc,inputcontext,true,0x10000);
|
||||
else InitializePPMdRangeCoder(&self->core.coder,readfunc,inputcontext,true,0x8000);
|
||||
if(brimstone)
|
||||
InitializePPMdRangeCoder(&self->core.coder, readfunc, inputcontext, true, 0x10000);
|
||||
else
|
||||
InitializePPMdRangeCoder(&self->core.coder, readfunc, inputcontext, true, 0x8000);
|
||||
|
||||
self->core.alloc=alloc;
|
||||
self->core.alloc = alloc;
|
||||
|
||||
self->core.RescalePPMdContext=RescalePPMdContext;
|
||||
self->core.RescalePPMdContext = RescalePPMdContext;
|
||||
|
||||
self->MaxOrder=maxorder;
|
||||
self->Brimstone=brimstone;
|
||||
self->core.EscCount=1;
|
||||
self->MaxOrder = maxorder;
|
||||
self->Brimstone = brimstone;
|
||||
self->core.EscCount = 1;
|
||||
|
||||
for(int i=0;i<6;i++) self->NS2BSIndx[i]=2*i;
|
||||
for(int i=6;i<50;i++) self->NS2BSIndx[i]=12;
|
||||
for(int i=50;i<256;i++) self->NS2BSIndx[i]=14;
|
||||
for(int i = 0; i < 6; i++) self->NS2BSIndx[i] = 2 * i;
|
||||
for(int i = 6; i < 50; i++) self->NS2BSIndx[i] = 12;
|
||||
for(int i = 50; i < 256; i++) self->NS2BSIndx[i] = 14;
|
||||
|
||||
for(int i=0;i<4;i++) self->NS2Indx[i]=i;
|
||||
for(int i=4;i<4+8;i++) self->NS2Indx[i]=4+((i-4)>>1);
|
||||
for(int i=4+8;i<4+8+32;i++) self->NS2Indx[i]=4+4+((i-4-8)>>2);
|
||||
for(int i=4+8+32;i<256;i++) self->NS2Indx[i]=4+4+8+((i-4-8-32)>>3);
|
||||
for(int i = 0; i < 4; i++) self->NS2Indx[i] = i;
|
||||
for(int i = 4; i < 4 + 8; i++) self->NS2Indx[i] = 4 + ((i - 4) >> 1);
|
||||
for(int i = 4 + 8; i < 4 + 8 + 32; i++) self->NS2Indx[i] = 4 + 4 + ((i - 4 - 8) >> 2);
|
||||
for(int i = 4 + 8 + 32; i < 256; i++) self->NS2Indx[i] = 4 + 4 + 8 + ((i - 4 - 8 - 32) >> 3);
|
||||
|
||||
self->DummySEE2Cont.Shift=PERIOD_BITS;
|
||||
self->DummySEE2Cont.Shift = PERIOD_BITS;
|
||||
|
||||
return RestartModel(self);
|
||||
return RestartModel(self);
|
||||
}
|
||||
|
||||
static bool RestartModel(PPMdModelVariantG *self)
|
||||
{
|
||||
InitSubAllocator(self->core.alloc);
|
||||
InitSubAllocator(self->core.alloc);
|
||||
|
||||
memset(self->core.CharMask,0,sizeof(self->core.CharMask));
|
||||
memset(self->core.CharMask, 0, sizeof(self->core.CharMask));
|
||||
|
||||
self->core.PrevSuccess=0;
|
||||
self->core.OrderFall=1;
|
||||
self->core.PrevSuccess = 0;
|
||||
self->core.OrderFall = 1;
|
||||
|
||||
self->MaxContext=NewPPMdContext(&self->core);
|
||||
if(!self->MaxContext) return false;
|
||||
self->MaxContext->LastStateIndex=255;
|
||||
if(self->Brimstone) self->MaxContext->SummFreq=385;
|
||||
else self->MaxContext->SummFreq=257;
|
||||
self->MaxContext->States=AllocUnits(self->core.alloc,256/2);
|
||||
if(!self->MaxContext->States) return false;
|
||||
self->MaxContext = NewPPMdContext(&self->core);
|
||||
if(!self->MaxContext) return false;
|
||||
self->MaxContext->LastStateIndex = 255;
|
||||
if(self->Brimstone)
|
||||
self->MaxContext->SummFreq = 385;
|
||||
else
|
||||
self->MaxContext->SummFreq = 257;
|
||||
self->MaxContext->States = AllocUnits(self->core.alloc, 256 / 2);
|
||||
if(!self->MaxContext->States) return false;
|
||||
|
||||
PPMdState *maxstates=PPMdContextStates(self->MaxContext,&self->core);
|
||||
for(int i=0;i<256;i++)
|
||||
{
|
||||
maxstates[i].Symbol=i;
|
||||
if(self->Brimstone&&i<0x80) maxstates[i].Freq=2;
|
||||
else maxstates[i].Freq=1;
|
||||
maxstates[i].Successor=0;
|
||||
}
|
||||
PPMdState *maxstates = PPMdContextStates(self->MaxContext, &self->core);
|
||||
for(int i = 0; i < 256; i++)
|
||||
{
|
||||
maxstates[i].Symbol = i;
|
||||
if(self->Brimstone && i < 0x80)
|
||||
maxstates[i].Freq = 2;
|
||||
else
|
||||
maxstates[i].Freq = 1;
|
||||
maxstates[i].Successor = 0;
|
||||
}
|
||||
|
||||
PPMdState *state=maxstates;
|
||||
for(int i=1;/*i<self->MaxOrder*/;i++)
|
||||
{
|
||||
//PPMdState firststate={0,1};
|
||||
self->MaxContext=NewPPMdContextAsChildOf(&self->core,self->MaxContext,state,/*&firststate*/NULL);
|
||||
if(!self->MaxContext) return false;
|
||||
if(i==self->MaxOrder) break;
|
||||
state=PPMdContextOneState(self->MaxContext);
|
||||
state->Symbol=0;
|
||||
state->Freq=1;
|
||||
}
|
||||
PPMdState *state = maxstates;
|
||||
for(int i = 1; /*i<self->MaxOrder*/; i++)
|
||||
{
|
||||
// PPMdState firststate={0,1};
|
||||
self->MaxContext = NewPPMdContextAsChildOf(&self->core, self->MaxContext, state, /*&firststate*/ NULL);
|
||||
if(!self->MaxContext) return false;
|
||||
if(i == self->MaxOrder) break;
|
||||
state = PPMdContextOneState(self->MaxContext);
|
||||
state->Symbol = 0;
|
||||
state->Freq = 1;
|
||||
}
|
||||
|
||||
self->MaxContext->Flags=1;
|
||||
// self->MaxContext=NewPPMdContextAsChildOf(&self->core,self->MaxContext,state,NULL);
|
||||
// PPMdContextOneState(self->MaxContext)->Freq=0;
|
||||
self->MaxContext->Flags = 1;
|
||||
// self->MaxContext=NewPPMdContextAsChildOf(&self->core,self->MaxContext,state,NULL);
|
||||
// PPMdContextOneState(self->MaxContext)->Freq=0;
|
||||
|
||||
self->MedContext=self->MinContext=PPMdContextSuffix(self->MaxContext,&self->core);
|
||||
self->MedContext = self->MinContext = PPMdContextSuffix(self->MaxContext, &self->core);
|
||||
|
||||
static const uint16_t InitBinEsc[16]=
|
||||
{
|
||||
0x3CDD,0x1F3F,0x59BF,0x48F3,0x5FFB,0x5545,0x63D1,0x5D9D,
|
||||
0x64A1,0x5ABC,0x6632,0x6051,0x68F6,0x549B,0x6BCA,0x3AB0,
|
||||
};
|
||||
static const uint16_t InitBinEsc[16] = {
|
||||
0x3CDD, 0x1F3F, 0x59BF, 0x48F3, 0x5FFB, 0x5545, 0x63D1, 0x5D9D,
|
||||
0x64A1, 0x5ABC, 0x6632, 0x6051, 0x68F6, 0x549B, 0x6BCA, 0x3AB0,
|
||||
};
|
||||
|
||||
for(int i=0;i<128;i++)
|
||||
for(int k=0;k<16;k++)
|
||||
self->BinSumm[i][k]=BIN_SCALE-InitBinEsc[k]/(i+2);
|
||||
for(int i = 0; i < 128; i++)
|
||||
for(int k = 0; k < 16; k++) self->BinSumm[i][k] = BIN_SCALE - InitBinEsc[k] / (i + 2);
|
||||
|
||||
for(int i=0;i<43;i++)
|
||||
for(int k=0;k<8;k++)
|
||||
self->SEE2Cont[i][k]=MakeSEE2(4*i+10,3);
|
||||
for(int i = 0; i < 43; i++)
|
||||
for(int k = 0; k < 8; k++) self->SEE2Cont[i][k] = MakeSEE2(4 * i + 10, 3);
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int NextPPMdVariantGByte(PPMdModelVariantG *self)
|
||||
{
|
||||
if(!self->MinContext) return -1;
|
||||
if(setjmp(self->errorjmp)) return -2;
|
||||
if(!self->MinContext) return -1;
|
||||
if(setjmp(self->errorjmp)) return -2;
|
||||
|
||||
if(NumberOfStates(self->MinContext)!=1) DecodeSymbol1VariantG(self->MinContext,self);
|
||||
else DecodeBinSymbolVariantG(self->MinContext,self);
|
||||
if(NumberOfStates(self->MinContext) != 1)
|
||||
DecodeSymbol1VariantG(self->MinContext, self);
|
||||
else
|
||||
DecodeBinSymbolVariantG(self->MinContext, self);
|
||||
|
||||
while(!self->core.FoundState)
|
||||
{
|
||||
do
|
||||
{
|
||||
self->core.OrderFall++;
|
||||
self->MinContext=PPMdContextSuffix(self->MinContext,&self->core);
|
||||
if(!self->MinContext) return -1;
|
||||
}
|
||||
while(self->MinContext->LastStateIndex==self->core.LastMaskIndex);
|
||||
while(!self->core.FoundState)
|
||||
{
|
||||
do
|
||||
{
|
||||
self->core.OrderFall++;
|
||||
self->MinContext = PPMdContextSuffix(self->MinContext, &self->core);
|
||||
if(!self->MinContext) return -1;
|
||||
} while(self->MinContext->LastStateIndex == self->core.LastMaskIndex);
|
||||
|
||||
DecodeSymbol2VariantG(self->MinContext,self);
|
||||
}
|
||||
DecodeSymbol2VariantG(self->MinContext, self);
|
||||
}
|
||||
|
||||
uint8_t byte=self->core.FoundState->Symbol;
|
||||
uint8_t byte = self->core.FoundState->Symbol;
|
||||
|
||||
if(self->core.OrderFall==0&&PPMdStateSuccessor(self->core.FoundState,&self->core)->Flags==0)
|
||||
{
|
||||
self->MinContext=self->MedContext=PPMdStateSuccessor(self->core.FoundState,&self->core);
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateModel(self);
|
||||
if(self->core.EscCount==0) ClearPPMdModelMask(&self->core);
|
||||
}
|
||||
if(self->core.OrderFall == 0 && PPMdStateSuccessor(self->core.FoundState, &self->core)->Flags == 0)
|
||||
{
|
||||
self->MinContext = self->MedContext = PPMdStateSuccessor(self->core.FoundState, &self->core);
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateModel(self);
|
||||
if(self->core.EscCount == 0) ClearPPMdModelMask(&self->core);
|
||||
}
|
||||
|
||||
return byte;
|
||||
return byte;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void UpdateModel(PPMdModelVariantG *self)
|
||||
{
|
||||
PPMdState fs=*self->core.FoundState;
|
||||
PPMdState *state=NULL;
|
||||
PPMdState fs = *self->core.FoundState;
|
||||
PPMdState *state = NULL;
|
||||
|
||||
if(fs.Freq<MAX_FREQ/4&&self->MinContext->Suffix)
|
||||
{
|
||||
PPMdContext *context=PPMdContextSuffix(self->MinContext,&self->core);
|
||||
if(NumberOfStates(context)!=1)
|
||||
{
|
||||
state=PPMdContextStates(context,&self->core);
|
||||
if(fs.Freq < MAX_FREQ / 4 && self->MinContext->Suffix)
|
||||
{
|
||||
PPMdContext *context = PPMdContextSuffix(self->MinContext, &self->core);
|
||||
if(NumberOfStates(context) != 1)
|
||||
{
|
||||
state = PPMdContextStates(context, &self->core);
|
||||
|
||||
if(state->Symbol!=fs.Symbol)
|
||||
{
|
||||
do state++;
|
||||
while(state->Symbol!=fs.Symbol);
|
||||
if(state->Symbol != fs.Symbol)
|
||||
{
|
||||
do state++;
|
||||
while(state->Symbol != fs.Symbol);
|
||||
|
||||
if(state[0].Freq>=state[-1].Freq)
|
||||
{
|
||||
SWAP(state[0],state[-1]);
|
||||
state--;
|
||||
}
|
||||
}
|
||||
if(state[0].Freq >= state[-1].Freq)
|
||||
{
|
||||
SWAP(state[0], state[-1]);
|
||||
state--;
|
||||
}
|
||||
}
|
||||
|
||||
if(state->Freq<7*MAX_FREQ/8)
|
||||
{
|
||||
state->Freq+=2;
|
||||
context->SummFreq+=2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
state=PPMdContextOneState(context);
|
||||
if(state->Freq<32) state->Freq++;
|
||||
}
|
||||
}
|
||||
if(state->Freq < 7 * MAX_FREQ / 8)
|
||||
{
|
||||
state->Freq += 2;
|
||||
context->SummFreq += 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
state = PPMdContextOneState(context);
|
||||
if(state->Freq < 32) state->Freq++;
|
||||
}
|
||||
}
|
||||
|
||||
PPMdContext *Successor;
|
||||
int SkipCount=0;
|
||||
if(self->core.OrderFall==0)
|
||||
{
|
||||
if(!MakeRoot(self,2,NULL)) goto RESTART_MODEL;
|
||||
self->MinContext=self->MedContext=PPMdStateSuccessor(&fs,&self->core);
|
||||
return;
|
||||
}
|
||||
else if(--self->core.OrderFall==0)
|
||||
{
|
||||
Successor=PPMdStateSuccessor(&fs,&self->core);
|
||||
SkipCount=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
Successor=NewPPMdContext(&self->core);
|
||||
if(!Successor) goto RESTART_MODEL;
|
||||
Successor->Flags=1;
|
||||
}
|
||||
PPMdContext *Successor;
|
||||
int SkipCount = 0;
|
||||
if(self->core.OrderFall == 0)
|
||||
{
|
||||
if(!MakeRoot(self, 2, NULL)) goto RESTART_MODEL;
|
||||
self->MinContext = self->MedContext = PPMdStateSuccessor(&fs, &self->core);
|
||||
return;
|
||||
}
|
||||
else if(--self->core.OrderFall == 0)
|
||||
{
|
||||
Successor = PPMdStateSuccessor(&fs, &self->core);
|
||||
SkipCount = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
Successor = NewPPMdContext(&self->core);
|
||||
if(!Successor) goto RESTART_MODEL;
|
||||
Successor->Flags = 1;
|
||||
}
|
||||
|
||||
if(self->MaxContext->Flags==1)
|
||||
{
|
||||
PPMdContextOneState(self->MaxContext)->Symbol=fs.Symbol;
|
||||
SetPPMdStateSuccessorPointer(PPMdContextOneState(self->MaxContext),Successor,&self->core);
|
||||
}
|
||||
if(self->MaxContext->Flags == 1)
|
||||
{
|
||||
PPMdContextOneState(self->MaxContext)->Symbol = fs.Symbol;
|
||||
SetPPMdStateSuccessorPointer(PPMdContextOneState(self->MaxContext), Successor, &self->core);
|
||||
}
|
||||
|
||||
int minnum=NumberOfStates(self->MinContext);
|
||||
int s0=self->MinContext->SummFreq-minnum-(fs.Freq-1);
|
||||
int minnum = NumberOfStates(self->MinContext);
|
||||
int s0 = self->MinContext->SummFreq - minnum - (fs.Freq - 1);
|
||||
|
||||
for(PPMdContext *currcontext=self->MedContext;currcontext!=self->MinContext;currcontext=PPMdContextSuffix(currcontext,&self->core))
|
||||
{
|
||||
int currnum=NumberOfStates(currcontext);
|
||||
if(currnum!=1)
|
||||
{
|
||||
if((currnum&1)==0)
|
||||
{
|
||||
currcontext->States=ExpandUnits(self->core.alloc,currcontext->States,currnum>>1);
|
||||
if(!currcontext->States) goto RESTART_MODEL;
|
||||
}
|
||||
if(4*currnum<=minnum&&currcontext->SummFreq<=8*currnum) currcontext->SummFreq+=2;
|
||||
if(2*currnum<minnum) currcontext->SummFreq++;
|
||||
}
|
||||
else
|
||||
{
|
||||
PPMdState *states=OffsetToPointer(self->core.alloc,AllocUnits(self->core.alloc,1));
|
||||
if(!states) goto RESTART_MODEL;
|
||||
states[0]=*(PPMdContextOneState(currcontext));
|
||||
SetPPMdContextStatesPointer(currcontext,states,&self->core);
|
||||
for(PPMdContext *currcontext = self->MedContext; currcontext != self->MinContext;
|
||||
currcontext = PPMdContextSuffix(currcontext, &self->core))
|
||||
{
|
||||
int currnum = NumberOfStates(currcontext);
|
||||
if(currnum != 1)
|
||||
{
|
||||
if((currnum & 1) == 0)
|
||||
{
|
||||
currcontext->States = ExpandUnits(self->core.alloc, currcontext->States, currnum >> 1);
|
||||
if(!currcontext->States) goto RESTART_MODEL;
|
||||
}
|
||||
if(4 * currnum <= minnum && currcontext->SummFreq <= 8 * currnum) currcontext->SummFreq += 2;
|
||||
if(2 * currnum < minnum) currcontext->SummFreq++;
|
||||
}
|
||||
else
|
||||
{
|
||||
PPMdState *states = OffsetToPointer(self->core.alloc, AllocUnits(self->core.alloc, 1));
|
||||
if(!states) goto RESTART_MODEL;
|
||||
states[0] = *(PPMdContextOneState(currcontext));
|
||||
SetPPMdContextStatesPointer(currcontext, states, &self->core);
|
||||
|
||||
if(states[0].Freq<MAX_FREQ/4-1) states[0].Freq*=2;
|
||||
else states[0].Freq=MAX_FREQ-4;
|
||||
if(states[0].Freq < MAX_FREQ / 4 - 1)
|
||||
states[0].Freq *= 2;
|
||||
else
|
||||
states[0].Freq = MAX_FREQ - 4;
|
||||
|
||||
currcontext->SummFreq=states[0].Freq+self->core.InitEsc+(minnum>3?1:0);
|
||||
}
|
||||
currcontext->SummFreq = states[0].Freq + self->core.InitEsc + (minnum > 3 ? 1 : 0);
|
||||
}
|
||||
|
||||
unsigned int cf=2*fs.Freq*(currcontext->SummFreq+6);
|
||||
unsigned int sf=s0+currcontext->SummFreq;
|
||||
unsigned int freq;
|
||||
unsigned int cf = 2 * fs.Freq * (currcontext->SummFreq + 6);
|
||||
unsigned int sf = s0 + currcontext->SummFreq;
|
||||
unsigned int freq;
|
||||
|
||||
if(cf<6*sf)
|
||||
{
|
||||
if(cf>=4*sf) freq=3;
|
||||
else if(cf>sf) freq=2;
|
||||
else freq=1;
|
||||
currcontext->SummFreq+=3;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(cf>=15*sf) freq=7;
|
||||
else if(cf>=12*sf) freq=6;
|
||||
else if(cf>=9*sf) freq=5;
|
||||
else freq=4;
|
||||
currcontext->SummFreq+=freq;
|
||||
}
|
||||
if(cf < 6 * sf)
|
||||
{
|
||||
if(cf >= 4 * sf)
|
||||
freq = 3;
|
||||
else if(cf > sf)
|
||||
freq = 2;
|
||||
else
|
||||
freq = 1;
|
||||
currcontext->SummFreq += 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(cf >= 15 * sf)
|
||||
freq = 7;
|
||||
else if(cf >= 12 * sf)
|
||||
freq = 6;
|
||||
else if(cf >= 9 * sf)
|
||||
freq = 5;
|
||||
else
|
||||
freq = 4;
|
||||
currcontext->SummFreq += freq;
|
||||
}
|
||||
|
||||
PPMdState *currstates=PPMdContextStates(currcontext,&self->core);
|
||||
PPMdState *new=&currstates[currnum];
|
||||
SetPPMdStateSuccessorPointer(new,Successor,&self->core);
|
||||
new->Symbol=fs.Symbol;
|
||||
new->Freq=freq;
|
||||
currcontext->LastStateIndex=currnum;
|
||||
}
|
||||
PPMdState *currstates = PPMdContextStates(currcontext, &self->core);
|
||||
PPMdState *new = &currstates[currnum];
|
||||
SetPPMdStateSuccessorPointer(new, Successor, &self->core);
|
||||
new->Symbol = fs.Symbol;
|
||||
new->Freq = freq;
|
||||
currcontext->LastStateIndex = currnum;
|
||||
}
|
||||
|
||||
if(fs.Successor)
|
||||
{
|
||||
if(PPMdStateSuccessor(&fs,&self->core)->Flags==1)
|
||||
{
|
||||
if(!MakeRoot(self,SkipCount,state)) goto RESTART_MODEL;
|
||||
}
|
||||
self->MinContext=PPMdStateSuccessor(self->core.FoundState,&self->core);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetPPMdStateSuccessorPointer(self->core.FoundState,Successor,&self->core);
|
||||
self->core.OrderFall++;
|
||||
}
|
||||
if(fs.Successor)
|
||||
{
|
||||
if(PPMdStateSuccessor(&fs, &self->core)->Flags == 1)
|
||||
{
|
||||
if(!MakeRoot(self, SkipCount, state)) goto RESTART_MODEL;
|
||||
}
|
||||
self->MinContext = PPMdStateSuccessor(self->core.FoundState, &self->core);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetPPMdStateSuccessorPointer(self->core.FoundState, Successor, &self->core);
|
||||
self->core.OrderFall++;
|
||||
}
|
||||
|
||||
self->MedContext=self->MinContext;
|
||||
if(!Successor) longjmp(self->errorjmp,1);
|
||||
self->MaxContext=Successor;
|
||||
return;
|
||||
self->MedContext = self->MinContext;
|
||||
if(!Successor) longjmp(self->errorjmp, 1);
|
||||
self->MaxContext = Successor;
|
||||
return;
|
||||
|
||||
RESTART_MODEL:
|
||||
RestartModel(self);
|
||||
self->core.EscCount=0;
|
||||
RESTART_MODEL:
|
||||
RestartModel(self);
|
||||
self->core.EscCount = 0;
|
||||
}
|
||||
|
||||
static bool MakeRoot(PPMdModelVariantG *self,unsigned int SkipCount,PPMdState *state)
|
||||
static bool MakeRoot(PPMdModelVariantG *self, unsigned int SkipCount, PPMdState *state)
|
||||
{
|
||||
PPMdContext *context=self->MinContext,*upbranch=PPMdStateSuccessor(self->core.FoundState,&self->core);
|
||||
PPMdState *statelist[MAX_O];
|
||||
int n=0;
|
||||
PPMdContext *context = self->MinContext, *upbranch = PPMdStateSuccessor(self->core.FoundState, &self->core);
|
||||
PPMdState *statelist[MAX_O];
|
||||
int n = 0;
|
||||
|
||||
if(SkipCount==0)
|
||||
{
|
||||
statelist[n++]=self->core.FoundState;
|
||||
if(!context->Suffix) goto skip;
|
||||
}
|
||||
else if(SkipCount==2) context=PPMdContextSuffix(context,&self->core);
|
||||
if(SkipCount == 0)
|
||||
{
|
||||
statelist[n++] = self->core.FoundState;
|
||||
if(!context->Suffix) goto skip;
|
||||
}
|
||||
else if(SkipCount == 2)
|
||||
context = PPMdContextSuffix(context, &self->core);
|
||||
|
||||
if(state)
|
||||
{
|
||||
context=PPMdContextSuffix(context,&self->core);
|
||||
if(PPMdStateSuccessor(state,&self->core)!=upbranch)
|
||||
{
|
||||
context=PPMdStateSuccessor(state,&self->core);
|
||||
goto skip;
|
||||
}
|
||||
statelist[n++]=state;
|
||||
if(!context->Suffix) goto skip;
|
||||
}
|
||||
if(state)
|
||||
{
|
||||
context = PPMdContextSuffix(context, &self->core);
|
||||
if(PPMdStateSuccessor(state, &self->core) != upbranch)
|
||||
{
|
||||
context = PPMdStateSuccessor(state, &self->core);
|
||||
goto skip;
|
||||
}
|
||||
statelist[n++] = state;
|
||||
if(!context->Suffix) goto skip;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
context=PPMdContextSuffix(context,&self->core);
|
||||
if(!context) longjmp(self->errorjmp,1);
|
||||
if(NumberOfStates(context)!=1)
|
||||
{
|
||||
state=PPMdContextStates(context,&self->core);
|
||||
while(state->Symbol!=self->core.FoundState->Symbol) state++;
|
||||
}
|
||||
else state=PPMdContextOneState(context);
|
||||
do
|
||||
{
|
||||
context = PPMdContextSuffix(context, &self->core);
|
||||
if(!context) longjmp(self->errorjmp, 1);
|
||||
if(NumberOfStates(context) != 1)
|
||||
{
|
||||
state = PPMdContextStates(context, &self->core);
|
||||
while(state->Symbol != self->core.FoundState->Symbol) state++;
|
||||
}
|
||||
else
|
||||
state = PPMdContextOneState(context);
|
||||
|
||||
if(PPMdStateSuccessor(state,&self->core)!=upbranch)
|
||||
{
|
||||
context=PPMdStateSuccessor(state,&self->core);
|
||||
break;
|
||||
}
|
||||
statelist[n++]=state;
|
||||
}
|
||||
while(context->Suffix);
|
||||
if(PPMdStateSuccessor(state, &self->core) != upbranch)
|
||||
{
|
||||
context = PPMdStateSuccessor(state, &self->core);
|
||||
break;
|
||||
}
|
||||
statelist[n++] = state;
|
||||
} while(context->Suffix);
|
||||
|
||||
skip: (void)0;
|
||||
skip:
|
||||
(void)0;
|
||||
|
||||
PPMdState *upstate=PPMdContextOneState(upbranch);
|
||||
if(NumberOfStates(context)!=1)
|
||||
{
|
||||
state=PPMdContextStates(context,&self->core);
|
||||
while(state->Symbol!=upstate->Symbol) state++;
|
||||
PPMdState *upstate = PPMdContextOneState(upbranch);
|
||||
if(NumberOfStates(context) != 1)
|
||||
{
|
||||
state = PPMdContextStates(context, &self->core);
|
||||
while(state->Symbol != upstate->Symbol) state++;
|
||||
|
||||
int cf=state->Freq-1;
|
||||
int s0=context->SummFreq-context->LastStateIndex-1-cf;
|
||||
int cf = state->Freq - 1;
|
||||
int s0 = context->SummFreq - context->LastStateIndex - 1 - cf;
|
||||
|
||||
if(2*cf<=s0)
|
||||
{
|
||||
if(5*cf>s0) upstate->Freq=2;
|
||||
else upstate->Freq=1;
|
||||
}
|
||||
else upstate->Freq=1+((2*cf+3*s0-1)/(2*s0));
|
||||
}
|
||||
else upstate->Freq=PPMdContextOneState(context)->Freq;
|
||||
if(2 * cf <= s0)
|
||||
{
|
||||
if(5 * cf > s0)
|
||||
upstate->Freq = 2;
|
||||
else
|
||||
upstate->Freq = 1;
|
||||
}
|
||||
else
|
||||
upstate->Freq = 1 + ((2 * cf + 3 * s0 - 1) / (2 * s0));
|
||||
}
|
||||
else
|
||||
upstate->Freq = PPMdContextOneState(context)->Freq;
|
||||
|
||||
for(int i=n-1;i>=0;i--)
|
||||
{
|
||||
context=NewPPMdContextAsChildOf(&self->core,context,statelist[i],upstate);
|
||||
if(!context) return false;
|
||||
}
|
||||
for(int i = n - 1; i >= 0; i--)
|
||||
{
|
||||
context = NewPPMdContextAsChildOf(&self->core, context, statelist[i], upstate);
|
||||
if(!context) return false;
|
||||
}
|
||||
|
||||
if(self->core.OrderFall==0)
|
||||
{
|
||||
upbranch->LastStateIndex=0;
|
||||
upbranch->Flags=0;
|
||||
SetPPMdContextSuffixPointer(upbranch,context,&self->core);
|
||||
}
|
||||
if(self->core.OrderFall == 0)
|
||||
{
|
||||
upbranch->LastStateIndex = 0;
|
||||
upbranch->Flags = 0;
|
||||
SetPPMdContextSuffixPointer(upbranch, context, &self->core);
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void DecodeBinSymbolVariantG(PPMdContext *self,PPMdModelVariantG *model)
|
||||
static void DecodeBinSymbolVariantG(PPMdContext *self, PPMdModelVariantG *model)
|
||||
{
|
||||
PPMdState *rs=PPMdContextOneState(self);
|
||||
uint16_t *bs=&model->BinSumm[rs->Freq-1][model->core.PrevSuccess+model->NS2BSIndx[PPMdContextSuffix(self,&model->core)->LastStateIndex]];
|
||||
PPMdState *rs = PPMdContextOneState(self);
|
||||
uint16_t *bs =
|
||||
&model->BinSumm[rs->Freq - 1][model->core.PrevSuccess +
|
||||
model->NS2BSIndx[PPMdContextSuffix(self, &model->core)->LastStateIndex]];
|
||||
|
||||
PPMdDecodeBinSymbol(self,&model->core,bs,128,false);
|
||||
PPMdDecodeBinSymbol(self, &model->core, bs, 128, false);
|
||||
}
|
||||
|
||||
static void DecodeSymbol1VariantG(PPMdContext *self,PPMdModelVariantG *model)
|
||||
static void DecodeSymbol1VariantG(PPMdContext *self, PPMdModelVariantG *model)
|
||||
{ PPMdDecodeSymbol1(self, &model->core, false); }
|
||||
|
||||
static void DecodeSymbol2VariantG(PPMdContext *self, PPMdModelVariantG *model)
|
||||
{
|
||||
PPMdDecodeSymbol1(self,&model->core,false);
|
||||
}
|
||||
int diff = self->LastStateIndex - model->core.LastMaskIndex;
|
||||
SEE2Context *see;
|
||||
if(self->LastStateIndex != 255)
|
||||
{
|
||||
see =
|
||||
&model
|
||||
->SEE2Cont[model->NS2Indx[diff - 1]]
|
||||
[+(diff < PPMdContextSuffix(self, &model->core)->LastStateIndex - self->LastStateIndex ? 1
|
||||
: 0) +
|
||||
(self->SummFreq < 11 * NumberOfStates(self) ? 2 : 0) +
|
||||
(model->core.LastMaskIndex + 1 > diff ? 4 : 0)];
|
||||
model->core.scale = GetSEE2MeanMasked(see);
|
||||
}
|
||||
else
|
||||
{
|
||||
model->core.scale = 1;
|
||||
see = &model->DummySEE2Cont;
|
||||
}
|
||||
|
||||
static void DecodeSymbol2VariantG(PPMdContext *self,PPMdModelVariantG *model)
|
||||
{
|
||||
int diff=self->LastStateIndex-model->core.LastMaskIndex;
|
||||
SEE2Context *see;
|
||||
if(self->LastStateIndex!=255)
|
||||
{
|
||||
see=&model->SEE2Cont[model->NS2Indx[diff-1]][
|
||||
+(diff<PPMdContextSuffix(self,&model->core)->LastStateIndex-self->LastStateIndex?1:0)
|
||||
+(self->SummFreq<11*NumberOfStates(self)?2:0)
|
||||
+(model->core.LastMaskIndex+1>diff?4:0)];
|
||||
model->core.scale=GetSEE2MeanMasked(see);
|
||||
}
|
||||
else
|
||||
{
|
||||
model->core.scale=1;
|
||||
see=&model->DummySEE2Cont;
|
||||
}
|
||||
|
||||
PPMdDecodeSymbol2(self,&model->core,see);
|
||||
PPMdDecodeSymbol2(self, &model->core, see);
|
||||
}
|
||||
|
||||
@@ -21,28 +21,27 @@
|
||||
#ifndef __PPMD_VARIANT_G_H__
|
||||
#define __PPMD_VARIANT_G_H__
|
||||
|
||||
#include "Context.h"
|
||||
#include <setjmp.h>
|
||||
#include "Context.h"
|
||||
|
||||
// PPMd Variant G. Used (slightly modified) by StuffIt X.
|
||||
|
||||
typedef struct PPMdModelVariantG
|
||||
{
|
||||
PPMdCoreModel core;
|
||||
PPMdCoreModel core;
|
||||
|
||||
PPMdContext *MinContext,*MedContext,*MaxContext;
|
||||
int MaxOrder;
|
||||
bool Brimstone;
|
||||
SEE2Context SEE2Cont[43][8],DummySEE2Cont;
|
||||
uint8_t NS2BSIndx[256],NS2Indx[256];
|
||||
uint16_t BinSumm[128][16]; // binary SEE-contexts
|
||||
PPMdContext *MinContext, *MedContext, *MaxContext;
|
||||
int MaxOrder;
|
||||
bool Brimstone;
|
||||
SEE2Context SEE2Cont[43][8], DummySEE2Cont;
|
||||
uint8_t NS2BSIndx[256], NS2Indx[256];
|
||||
uint16_t BinSumm[128][16]; // binary SEE-contexts
|
||||
|
||||
jmp_buf errorjmp;
|
||||
jmp_buf errorjmp;
|
||||
} PPMdModelVariantG;
|
||||
|
||||
bool StartPPMdModelVariantG(PPMdModelVariantG *self,
|
||||
PPMdReadFunction *readfunc,void *inputcontext,
|
||||
PPMdSubAllocator *alloc,int maxorder,bool brimstone);
|
||||
int NextPPMdVariantGByte(PPMdModelVariantG *self);
|
||||
bool StartPPMdModelVariantG(PPMdModelVariantG *self, PPMdReadFunction *readfunc, void *inputcontext,
|
||||
PPMdSubAllocator *alloc, int maxorder, bool brimstone);
|
||||
int NextPPMdVariantGByte(PPMdModelVariantG *self);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user