mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-12-13 13:50:59 +00:00
040cb17370
# Conflicts: # CMakeLists.txt # libraries/glslang/OGLCompilersDLL/CMakeLists.txt # libraries/glslang/OGLCompilersDLL/InitializeDll.cpp # libraries/glslang/OGLCompilersDLL/InitializeDll.h # libraries/glslang/glslang/CMakeLists.txt # libraries/glslang/glslang/GenericCodeGen/CodeGen.cpp # libraries/glslang/glslang/GenericCodeGen/Link.cpp # libraries/glslang/glslang/Include/BaseTypes.h # libraries/glslang/glslang/Include/Common.h # libraries/glslang/glslang/Include/ConstantUnion.h # libraries/glslang/glslang/Include/InfoSink.h # libraries/glslang/glslang/Include/InitializeGlobals.h # libraries/glslang/glslang/Include/PoolAlloc.h # libraries/glslang/glslang/Include/ResourceLimits.h # libraries/glslang/glslang/Include/ShHandle.h # libraries/glslang/glslang/Include/Types.h # libraries/glslang/glslang/Include/arrays.h # libraries/glslang/glslang/Include/intermediate.h # libraries/glslang/glslang/Include/revision.h # libraries/glslang/glslang/Include/revision.template # libraries/glslang/glslang/MachineIndependent/Constant.cpp # libraries/glslang/glslang/MachineIndependent/InfoSink.cpp # libraries/glslang/glslang/MachineIndependent/Initialize.cpp # libraries/glslang/glslang/MachineIndependent/Initialize.h # libraries/glslang/glslang/MachineIndependent/IntermTraverse.cpp # libraries/glslang/glslang/MachineIndependent/Intermediate.cpp # libraries/glslang/glslang/MachineIndependent/LiveTraverser.h # libraries/glslang/glslang/MachineIndependent/ParseContextBase.cpp # libraries/glslang/glslang/MachineIndependent/ParseHelper.cpp # libraries/glslang/glslang/MachineIndependent/ParseHelper.h # libraries/glslang/glslang/MachineIndependent/PoolAlloc.cpp # libraries/glslang/glslang/MachineIndependent/RemoveTree.cpp # libraries/glslang/glslang/MachineIndependent/RemoveTree.h # libraries/glslang/glslang/MachineIndependent/Scan.cpp # libraries/glslang/glslang/MachineIndependent/Scan.h # libraries/glslang/glslang/MachineIndependent/ScanContext.h # libraries/glslang/glslang/MachineIndependent/ShaderLang.cpp # libraries/glslang/glslang/MachineIndependent/SymbolTable.cpp # libraries/glslang/glslang/MachineIndependent/SymbolTable.h # libraries/glslang/glslang/MachineIndependent/Versions.cpp # libraries/glslang/glslang/MachineIndependent/Versions.h # libraries/glslang/glslang/MachineIndependent/attribute.cpp # libraries/glslang/glslang/MachineIndependent/attribute.h # libraries/glslang/glslang/MachineIndependent/gl_types.h # libraries/glslang/glslang/MachineIndependent/glslang.y # libraries/glslang/glslang/MachineIndependent/glslang_tab.cpp # libraries/glslang/glslang/MachineIndependent/glslang_tab.cpp.h # libraries/glslang/glslang/MachineIndependent/intermOut.cpp # libraries/glslang/glslang/MachineIndependent/iomapper.cpp # libraries/glslang/glslang/MachineIndependent/iomapper.h # libraries/glslang/glslang/MachineIndependent/limits.cpp # libraries/glslang/glslang/MachineIndependent/linkValidate.cpp # libraries/glslang/glslang/MachineIndependent/localintermediate.h # libraries/glslang/glslang/MachineIndependent/parseConst.cpp # libraries/glslang/glslang/MachineIndependent/parseVersions.h # libraries/glslang/glslang/MachineIndependent/pch.cpp # libraries/glslang/glslang/MachineIndependent/pch.h # libraries/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp # libraries/glslang/glslang/MachineIndependent/preprocessor/PpAtom.cpp # libraries/glslang/glslang/MachineIndependent/preprocessor/PpContext.cpp # libraries/glslang/glslang/MachineIndependent/preprocessor/PpContext.h # libraries/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp # libraries/glslang/glslang/MachineIndependent/preprocessor/PpTokens.cpp # libraries/glslang/glslang/MachineIndependent/preprocessor/PpTokens.h # libraries/glslang/glslang/MachineIndependent/propagateNoContraction.cpp # libraries/glslang/glslang/MachineIndependent/propagateNoContraction.h # libraries/glslang/glslang/MachineIndependent/reflection.cpp # libraries/glslang/glslang/MachineIndependent/reflection.h # libraries/glslang/glslang/OSDependent/Unix/CMakeLists.txt # libraries/glslang/glslang/OSDependent/Unix/ossource.cpp # libraries/glslang/glslang/OSDependent/Windows/CMakeLists.txt # libraries/glslang/glslang/OSDependent/Windows/main.cpp # libraries/glslang/glslang/OSDependent/Windows/ossource.cpp # libraries/glslang/glslang/OSDependent/osinclude.h # libraries/glslang/glslang/Public/ShaderLang.h # libraries/glslang/glslang/updateGrammar # libraries/glslang/spirv/CMakeLists.txt # libraries/glslang/spirv/GLSL.ext.AMD.h # libraries/glslang/spirv/GLSL.ext.EXT.h # libraries/glslang/spirv/GLSL.ext.KHR.h # libraries/glslang/spirv/GLSL.ext.NV.h # libraries/glslang/spirv/GLSL.std.450.h # libraries/glslang/spirv/GlslangToSpv.cpp # libraries/glslang/spirv/GlslangToSpv.h # libraries/glslang/spirv/InReadableOrder.cpp # libraries/glslang/spirv/Logger.cpp # libraries/glslang/spirv/Logger.h # libraries/glslang/spirv/SPVRemapper.cpp # libraries/glslang/spirv/SPVRemapper.h # libraries/glslang/spirv/SpvBuilder.cpp # libraries/glslang/spirv/SpvBuilder.h # libraries/glslang/spirv/SpvPostProcess.cpp # libraries/glslang/spirv/SpvTools.cpp # libraries/glslang/spirv/SpvTools.h # libraries/glslang/spirv/bitutils.h # libraries/glslang/spirv/disassemble.cpp # libraries/glslang/spirv/disassemble.h # libraries/glslang/spirv/doc.cpp # libraries/glslang/spirv/doc.h # libraries/glslang/spirv/hex_float.h # libraries/glslang/spirv/spirv.hpp # libraries/glslang/spirv/spvIR.h # src/CMakeLists.txt
142 lines
3.7 KiB
C
142 lines
3.7 KiB
C
/* Ppmd7.h -- PPMdH compression codec
|
|
2018-07-04 : Igor Pavlov : Public domain
|
|
This code is based on PPMd var.H (2001): Dmitry Shkarin : Public domain */
|
|
|
|
/* This code supports virtual RangeDecoder and includes the implementation
|
|
of RangeCoder from 7z, instead of RangeCoder from original PPMd var.H.
|
|
If you need the compatibility with original PPMd var.H, you can use external RangeDecoder */
|
|
|
|
#ifndef __PPMD7_H
|
|
#define __PPMD7_H
|
|
|
|
#include "Ppmd.h"
|
|
|
|
EXTERN_C_BEGIN
|
|
|
|
#define PPMD7_MIN_ORDER 2
|
|
#define PPMD7_MAX_ORDER 64
|
|
|
|
#define PPMD7_MIN_MEM_SIZE (1 << 11)
|
|
#define PPMD7_MAX_MEM_SIZE (0xFFFFFFFF - 12 * 3)
|
|
|
|
struct CPpmd7_Context_;
|
|
|
|
typedef
|
|
#ifdef PPMD_32BIT
|
|
struct CPpmd7_Context_ *
|
|
#else
|
|
UInt32
|
|
#endif
|
|
CPpmd7_Context_Ref;
|
|
|
|
typedef struct CPpmd7_Context_
|
|
{
|
|
UInt16 NumStats;
|
|
UInt16 SummFreq;
|
|
CPpmd_State_Ref Stats;
|
|
CPpmd7_Context_Ref Suffix;
|
|
} CPpmd7_Context;
|
|
|
|
#define Ppmd7Context_OneState(p) ((CPpmd_State *)&(p)->SummFreq)
|
|
|
|
typedef struct
|
|
{
|
|
CPpmd7_Context *MinContext, *MaxContext;
|
|
CPpmd_State *FoundState;
|
|
unsigned OrderFall, InitEsc, PrevSuccess, MaxOrder, HiBitsFlag;
|
|
Int32 RunLength, InitRL; /* must be 32-bit at least */
|
|
|
|
UInt32 Size;
|
|
UInt32 GlueCount;
|
|
Byte *Base, *LoUnit, *HiUnit, *Text, *UnitsStart;
|
|
UInt32 AlignOffset;
|
|
|
|
Byte Indx2Units[PPMD_NUM_INDEXES];
|
|
Byte Units2Indx[128];
|
|
CPpmd_Void_Ref FreeList[PPMD_NUM_INDEXES];
|
|
Byte NS2Indx[256], NS2BSIndx[256], HB2Flag[256];
|
|
CPpmd_See DummySee, See[25][16];
|
|
UInt16 BinSumm[128][64];
|
|
} CPpmd7;
|
|
|
|
void Ppmd7_Construct(CPpmd7 *p);
|
|
BoolInt Ppmd7_Alloc(CPpmd7 *p, UInt32 size, ISzAllocPtr alloc);
|
|
void Ppmd7_Free(CPpmd7 *p, ISzAllocPtr alloc);
|
|
void Ppmd7_Init(CPpmd7 *p, unsigned maxOrder);
|
|
#define Ppmd7_WasAllocated(p) ((p)->Base != NULL)
|
|
|
|
|
|
/* ---------- Internal Functions ---------- */
|
|
|
|
extern const Byte PPMD7_kExpEscape[16];
|
|
|
|
#ifdef PPMD_32BIT
|
|
#define Ppmd7_GetPtr(p, ptr) (ptr)
|
|
#define Ppmd7_GetContext(p, ptr) (ptr)
|
|
#define Ppmd7_GetStats(p, ctx) ((ctx)->Stats)
|
|
#else
|
|
#define Ppmd7_GetPtr(p, offs) ((void *)((p)->Base + (offs)))
|
|
#define Ppmd7_GetContext(p, offs) ((CPpmd7_Context *)Ppmd7_GetPtr((p), (offs)))
|
|
#define Ppmd7_GetStats(p, ctx) ((CPpmd_State *)Ppmd7_GetPtr((p), ((ctx)->Stats)))
|
|
#endif
|
|
|
|
void Ppmd7_Update1(CPpmd7 *p);
|
|
void Ppmd7_Update1_0(CPpmd7 *p);
|
|
void Ppmd7_Update2(CPpmd7 *p);
|
|
void Ppmd7_UpdateBin(CPpmd7 *p);
|
|
|
|
#define Ppmd7_GetBinSumm(p) \
|
|
&p->BinSumm[(size_t)(unsigned)Ppmd7Context_OneState(p->MinContext)->Freq - 1][p->PrevSuccess + \
|
|
p->NS2BSIndx[(size_t)Ppmd7_GetContext(p, p->MinContext->Suffix)->NumStats - 1] + \
|
|
(p->HiBitsFlag = p->HB2Flag[p->FoundState->Symbol]) + \
|
|
2 * p->HB2Flag[(unsigned)Ppmd7Context_OneState(p->MinContext)->Symbol] + \
|
|
((p->RunLength >> 26) & 0x20)]
|
|
|
|
CPpmd_See *Ppmd7_MakeEscFreq(CPpmd7 *p, unsigned numMasked, UInt32 *scale);
|
|
|
|
|
|
/* ---------- Decode ---------- */
|
|
|
|
typedef struct IPpmd7_RangeDec IPpmd7_RangeDec;
|
|
|
|
struct IPpmd7_RangeDec
|
|
{
|
|
UInt32 (*GetThreshold)(const IPpmd7_RangeDec *p, UInt32 total);
|
|
void (*Decode)(const IPpmd7_RangeDec *p, UInt32 start, UInt32 size);
|
|
UInt32 (*DecodeBit)(const IPpmd7_RangeDec *p, UInt32 size0);
|
|
};
|
|
|
|
typedef struct
|
|
{
|
|
IPpmd7_RangeDec vt;
|
|
UInt32 Range;
|
|
UInt32 Code;
|
|
IByteIn *Stream;
|
|
} CPpmd7z_RangeDec;
|
|
|
|
void Ppmd7z_RangeDec_CreateVTable(CPpmd7z_RangeDec *p);
|
|
BoolInt Ppmd7z_RangeDec_Init(CPpmd7z_RangeDec *p);
|
|
#define Ppmd7z_RangeDec_IsFinishedOK(p) ((p)->Code == 0)
|
|
|
|
int Ppmd7_DecodeSymbol(CPpmd7 *p, const IPpmd7_RangeDec *rc);
|
|
|
|
|
|
/* ---------- Encode ---------- */
|
|
|
|
typedef struct
|
|
{
|
|
UInt64 Low;
|
|
UInt32 Range;
|
|
Byte Cache;
|
|
UInt64 CacheSize;
|
|
IByteOut *Stream;
|
|
} CPpmd7z_RangeEnc;
|
|
|
|
void Ppmd7z_RangeEnc_Init(CPpmd7z_RangeEnc *p);
|
|
void Ppmd7z_RangeEnc_FlushData(CPpmd7z_RangeEnc *p);
|
|
|
|
void Ppmd7_EncodeSymbol(CPpmd7 *p, CPpmd7z_RangeEnc *rc, int symbol);
|
|
|
|
EXTERN_C_END
|
|
|
|
#endif
|