武装突袭 Wiki
探索
首页
讨论板
所有页面
社区页
交互式地图
最新博文
页面
最新页面
Contact Reports
Hotshot's Sandbox
DIK KeyCodes
Curator
武装突袭 Wiki
Product.cpp/bin File Format
Oxygen Light
最新博客
分类
Uploaded with UploadWizard
Face A2 Face101.jpg
Face A2 Face102.jpg
Face A2 Face103.jpg
Face A2 Face104.jpg
Face A2 Face105.jpg
Face A2 Face106.jpg
Face A2 Face107.jpg
含有损坏文件链接的页面
Eden Editor: Introduction
Eden Editor: Switching from 2D Editor
Eden Editor: Menu Bar
Eden Editor: Asset Browser
Eden Editor: Toolbar
Eden Editor: Status Bar
Eden Editor: Entity Attributes
社区
社区首页
社区中心
帮助中心
FANDOM
游戏
电影
电视
wiki
探索wiki
社区中心
创建wiki
尚未注册?
注册
登录
登录
注册
武装突袭 Wiki
4,828
个页面
探索
首页
讨论板
所有页面
社区页
交互式地图
最新博文
页面
最新页面
Contact Reports
Hotshot's Sandbox
DIK KeyCodes
Curator
武装突袭 Wiki
Product.cpp/bin File Format
Oxygen Light
最新博客
分类
Uploaded with UploadWizard
Face A2 Face101.jpg
Face A2 Face102.jpg
Face A2 Face103.jpg
Face A2 Face104.jpg
Face A2 Face105.jpg
Face A2 Face106.jpg
Face A2 Face107.jpg
含有损坏文件链接的页面
Eden Editor: Introduction
Eden Editor: Switching from 2D Editor
Eden Editor: Menu Bar
Eden Editor: Asset Browser
Eden Editor: Toolbar
Eden Editor: Status Bar
Eden Editor: Entity Attributes
社区
社区首页
社区中心
帮助中心
不转换
简体
繁體
大陆简体
香港繁體
澳門繁體
大马简体
新加坡简体
臺灣正體
编辑“
WSS File Format
”(章节)
返回页面
编辑
可视化编辑器
查看历史
讨论 (0)
正在编辑
WSS File Format
警告:
您没有登录。如果您做出任意编辑,您的IP地址将会公开可见。如果您
登录
或
创建
一个账户,您的编辑将归属于您的用户名,且将享受其他好处。
反垃圾检查。
不要
加入这个!
==Decompression== Bis '''optionally''' use Delta8 (byte) or Delta4 (nibble) 'Lossy' Compression for mono pcm data only. The facility exists to handle stereo compression but it isn't employed. ===Byte Compression=== Compression consists of single encoded byte 'samples' versus uncompressed short 'samples'. Each byte is, effectively, extrapolated to a short, thus making the compressed BYTE array, and the resulting decompressed SHORT array the same number of elements(length). The length is the remaining file length (in bytes) after the header. ===C++ code=== Function returns a short array, same size as it's compressed byte equivalent <syntaxhighlight lang="cpp"> #define LOG10 2.3025850929940456840 //ln(10) #define LOG2 1.4426950408889634070 //log2(e) #define MAGIC_NUMBER ((LOG10*LOG2)/28.12574042515172) short* DeCompress(const char *CompressedData,int len) { short *snap,*OutputData; if (!(snap=OutputData=new short[len])) return 0; short LastVal=0; for (;len--;CompressedData++) { if (*CompressedData) { double asFloat = abs(*CompressedData) *MAGIC_NUMBER; double rnd = Round(asFloat); asFloat = pow(2.0, asFloat - rnd) * pow(2, rnd);// mantissa - if (*CompressedData < 0) asFloat *= -1; int asInt = Round(asFloat)+LastVal; if (asInt > SHRT_MAX ) asInt = SHRT_MAX ; if (asInt < SHRT_MIN) asInt = SHRT_MIN; LastVal=(short)asInt; } *OutputData++ = LastVal; } return snap; } </syntaxhighlight> ===C# code=== If the <soundData> is compressed the following (C#) code can be used for decompression: <syntaxhighlight lang="csharp"> PCMData = new Int16[soundData.Length]; for (int j = 0; j < PCMData.Length; j++) { SByte srcSample = (SByte)soundData[j]; if (srcSample != 0) { double asFloat = Math.Abs(srcSample) / 28.12574042515172; asFloat *= 2.3025850929940456840; //ln(10) asFloat *= 1.4426950408889634070; //log2(e) double rnd = Math.Round(asFloat); double mantisse = Math.Pow(2.0, asFloat - rnd); asFloat = mantisse * Math.Pow(2, rnd); if (srcSample < 0) asFloat *= -1; Int32 asInt = (int)Math.Round(asFloat); asInt = (j == 0) ? asInt : (asInt + PCMData[j - 1]); if (asInt > short.MaxValue) asInt = short.MaxValue; if (asInt < short.MinValue) asInt = short.MinValue; PCMData[j] = (Int16)asInt; } else PCMData[j] = (j == 0) ? (Int16)0 : PCMData[j - 1]; } </syntaxhighlight> ===Nibble Compression=== Although by no means the same thing, Nibble compression is an adaptation of IMA ADPCM compression. Each nibble represents a SHORT of PCMdata. Thus the resultant output size will be four times larger (in bytes). ===C++ Code=== // // all honor and glory to T_D // static short PCMIndex[] = {-8192, -4096, -2048, -1024, -512, -256, -64, 0, 64, 256, 512, 1024, 2048, 4096, 8192}; static short limits(int PCM) { if(PCM > SHRT_MAX) PCM = SHRT_MAX; else if(PCM < SHRT_MIN) PCM = SHRT_MIN; return PCM; } short * DeCompressNibble(const char *NibbleData,int len)//len in bytes { short *snap,*pcmData; if (!(snap=pcmData=new short[2*len])) throw GENERR_NOMEM; int delta = 0; while (len--) { byte nibble=*NibbleData++; *pcmData++ = limits(delta += PCMIndex[nibble >> 4]); *pcmData++ = limits(delta += PCMIndex[nibble & 0x0F]); } return snap; } [[Category:BIS_File_Formats]]
摘要:
请注意在武装突袭 Wiki上的所有贡献都将依据CC-BY-SA进行发布。
取消
编辑帮助
(在新窗口中打开)
Follow on IG
TikTok
Join Fan Lab