decode sequences from the stream without the provided history.
(seqs []seqVals)
| 14 | |
| 15 | // decode sequences from the stream without the provided history. |
| 16 | func (s *sequenceDecs) decode(seqs []seqVals) error { |
| 17 | br := s.br |
| 18 | |
| 19 | // Grab full sizes tables, to avoid bounds checks. |
| 20 | llTable, mlTable, ofTable := s.litLengths.fse.dt[:maxTablesize], s.matchLengths.fse.dt[:maxTablesize], s.offsets.fse.dt[:maxTablesize] |
| 21 | llState, mlState, ofState := s.litLengths.state.state, s.matchLengths.state.state, s.offsets.state.state |
| 22 | s.seqSize = 0 |
| 23 | litRemain := len(s.literals) |
| 24 | |
| 25 | maxBlockSize := maxCompressedBlockSize |
| 26 | if s.windowSize < maxBlockSize { |
| 27 | maxBlockSize = s.windowSize |
| 28 | } |
| 29 | for i := range seqs { |
| 30 | var ll, mo, ml int |
| 31 | if br.cursor > 4+((maxOffsetBits+16+16)>>3) { |
| 32 | // inlined function: |
| 33 | // ll, mo, ml = s.nextFast(br, llState, mlState, ofState) |
| 34 | |
| 35 | // Final will not read from stream. |
| 36 | var llB, mlB, moB uint8 |
| 37 | ll, llB = llState.final() |
| 38 | ml, mlB = mlState.final() |
| 39 | mo, moB = ofState.final() |
| 40 | |
| 41 | // extra bits are stored in reverse order. |
| 42 | br.fillFast() |
| 43 | mo += br.getBits(moB) |
| 44 | if s.maxBits > 32 { |
| 45 | br.fillFast() |
| 46 | } |
| 47 | ml += br.getBits(mlB) |
| 48 | ll += br.getBits(llB) |
| 49 | |
| 50 | if moB > 1 { |
| 51 | s.prevOffset[2] = s.prevOffset[1] |
| 52 | s.prevOffset[1] = s.prevOffset[0] |
| 53 | s.prevOffset[0] = mo |
| 54 | } else { |
| 55 | // mo = s.adjustOffset(mo, ll, moB) |
| 56 | // Inlined for rather big speedup |
| 57 | if ll == 0 { |
| 58 | // There is an exception though, when current sequence's literals_length = 0. |
| 59 | // In this case, repeated offsets are shifted by one, so an offset_value of 1 means Repeated_Offset2, |
| 60 | // an offset_value of 2 means Repeated_Offset3, and an offset_value of 3 means Repeated_Offset1 - 1_byte. |
| 61 | mo++ |
| 62 | } |
| 63 | |
| 64 | if mo == 0 { |
| 65 | mo = s.prevOffset[0] |
| 66 | } else { |
| 67 | var temp int |
| 68 | if mo == 3 { |
| 69 | temp = s.prevOffset[0] - 1 |
| 70 | } else { |
| 71 | temp = s.prevOffset[mo] |
| 72 | } |
| 73 |
nothing calls this directly
no test coverage detected