| 11 | |
| 12 | |
| 13 | void Unpack::Unpack20(bool Solid) |
| 14 | { |
| 15 | static unsigned char LDecode[]={0,1,2,3,4,5,6,7,8,10,12,14,16,20,24,28,32,40,48,56,64,80,96,112,128,160,192,224}; |
| 16 | static unsigned char LBits[]= {0,0,0,0,0,0,0,0,1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5}; |
| 17 | static uint DDecode[]={0,1,2,3,4,6,8,12,16,24,32,48,64,96,128,192,256,384,512,768,1024,1536,2048,3072,4096,6144,8192,12288,16384,24576,32768U,49152U,65536,98304,131072,196608,262144,327680,393216,458752,524288,589824,655360,720896,786432,851968,917504,983040}; |
| 18 | static unsigned char DBits[]= {0,0,0,0,1,1,2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16}; |
| 19 | static unsigned char SDDecode[]={0,4,8,16,32,64,128,192}; |
| 20 | static unsigned char SDBits[]= {2,2,3, 4, 5, 6, 6, 6}; |
| 21 | uint Bits; |
| 22 | |
| 23 | if (Suspended) |
| 24 | UnpPtr=WrPtr; |
| 25 | else |
| 26 | { |
| 27 | UnpInitData(Solid); |
| 28 | if (!UnpReadBuf()) |
| 29 | return; |
| 30 | if ((!Solid || !TablesRead2) && !ReadTables20()) |
| 31 | return; |
| 32 | --DestUnpSize; |
| 33 | } |
| 34 | |
| 35 | while (DestUnpSize>=0) |
| 36 | { |
| 37 | UnpPtr&=MaxWinMask; |
| 38 | |
| 39 | if (Inp.InAddr>ReadTop-30) |
| 40 | if (!UnpReadBuf()) |
| 41 | break; |
| 42 | if (((WrPtr-UnpPtr) & MaxWinMask)<270 && WrPtr!=UnpPtr) |
| 43 | { |
| 44 | UnpWriteBuf20(); |
| 45 | if (Suspended) |
| 46 | return; |
| 47 | } |
| 48 | if (UnpAudioBlock) |
| 49 | { |
| 50 | uint AudioNumber=DecodeNumber(Inp,&MD[UnpCurChannel]); |
| 51 | |
| 52 | if (AudioNumber==256) |
| 53 | { |
| 54 | if (!ReadTables20()) |
| 55 | break; |
| 56 | continue; |
| 57 | } |
| 58 | Window[UnpPtr++]=DecodeAudio((int)AudioNumber); |
| 59 | if (++UnpCurChannel==UnpChannels) |
| 60 | UnpCurChannel=0; |
| 61 | --DestUnpSize; |
| 62 | continue; |
| 63 | } |
| 64 | |
| 65 | uint Number=DecodeNumber(Inp,&BlockTables.LD); |
| 66 | if (Number<256) |
| 67 | { |
| 68 | Window[UnpPtr++]=(byte)Number; |
| 69 | --DestUnpSize; |
| 70 | continue; |