encoder = new Encoder(); encoder.setDictionarySize(dictionarySize); encoder.setEndMarkerMode(endMarkerMode); encoder.setMatchFinder(DEFAULT_MATCH_FINDER); encoder.setNumFastBytes(numFastBytes); encoder.setLcLpPb(lc, lp, pb);
@Override protected void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws Exception { final int length = in.readableBytes(); InputStream bbIn = null; ByteBufOutputStream bbOut = null; try { bbIn = new ByteBufInputStream(in); bbOut = new ByteBufOutputStream(out); bbOut.writeByte(properties); bbOut.writeInt(littleEndianDictionarySize); bbOut.writeLong(Long.reverseBytes(length)); encoder.code(bbIn, bbOut, -1, -1, null); } finally { if (bbIn != null) { bbIn.close(); } if (bbOut != null) { bbOut.close(); } } }
switch (compressionFormat.toLowerCase()) { case COMPRESSION_FORMAT_LZMA: compressionIn = new LzmaInputStream(bufferedIn, new Decoder()); break; case COMPRESSION_FORMAT_XZ_LZMA2:
int getPosLenPrice(int pos, int len, int posState) { int price; int lenToPosState = Base.getLenToPosState(len); if (pos < Base.kNumFullDistances) { price = _distancesPrices[(lenToPosState * Base.kNumFullDistances) + pos]; } else { price = _posSlotPrices[(lenToPosState << Base.kNumPosSlotBits) + getPosSlot2(pos)] + _alignPrices[pos & Base.kAlignMask]; } return price + _lenEncoder.getPrice(len - Base.kMatchMinLen, posState); }
int getRepPrice(int repIndex, int len, int state, int posState) { int price = _repMatchLenEncoder.getPrice(len - Base.kMatchMinLen, posState); return price + getPureRepPrice(repIndex, state, posState); }
public void encode(lzma.sdk.rangecoder.Encoder rangeEncoder, int symbol, int posState) throws IOException { super.encode(rangeEncoder, symbol, posState); if (--_counters[posState] == 0) { updateTable(posState); } } }
boolean setLcLpPb(int lc, int lp, int pb) { if (lc > Base.kNumLitContextBitsMax || lp > 4 || pb > Base.kNumPosStatesBitsMax) { return false; } m_LiteralDecoder.create(lp, lc); int numPosStates = 1 << pb; m_LenDecoder.create(numPosStates); m_RepLenDecoder.create(numPosStates); m_PosStateMask = numPosStates - 1; return true; }
void releaseStreams() { releaseMFStream(); releaseOutStream(); }
void updateTable(int posState) { setPrices(posState, _tableSize, _prices, posState * Base.kNumLenSymbols); _counters[posState] = _tableSize; }
public void init() { int numStates = 1 << (m_NumPrevBits + m_NumPosBits); for (int i = 0; i < numStates; i++) { m_Coders[i].init(); } }
encoder = new Encoder(); encoder.setDictionarySize(dictionarySize); encoder.setEndMarkerMode(endMarkerMode); encoder.setMatchFinder(DEFAULT_MATCH_FINDER); encoder.setNumFastBytes(numFastBytes); encoder.setLcLpPb(lc, lp, pb);
@Override protected void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws Exception { final int length = in.readableBytes(); InputStream bbIn = null; ByteBufOutputStream bbOut = null; try { bbIn = new ByteBufInputStream(in); bbOut = new ByteBufOutputStream(out); bbOut.writeByte(properties); bbOut.writeInt(littleEndianDictionarySize); bbOut.writeLong(Long.reverseBytes(length)); encoder.code(bbIn, bbOut, -1, -1, null); } finally { if (bbIn != null) { bbIn.close(); } if (bbOut != null) { bbOut.close(); } } }
int getPosLenPrice(int pos, int len, int posState) { int price; int lenToPosState = Base.getLenToPosState(len); if (pos < Base.kNumFullDistances) { price = _distancesPrices[(lenToPosState * Base.kNumFullDistances) + pos]; } else { price = _posSlotPrices[(lenToPosState << Base.kNumPosSlotBits) + getPosSlot2(pos)] + _alignPrices[pos & Base.kAlignMask]; } return price + _lenEncoder.getPrice(len - Base.kMatchMinLen, posState); }
int getRepPrice(int repIndex, int len, int state, int posState) { int price = _repMatchLenEncoder.getPrice(len - Base.kMatchMinLen, posState); return price + getPureRepPrice(repIndex, state, posState); }
public void encode(lzma.sdk.rangecoder.Encoder rangeEncoder, int symbol, int posState) throws IOException { super.encode(rangeEncoder, symbol, posState); if (--_counters[posState] == 0) { updateTable(posState); } } }
boolean setLcLpPb(int lc, int lp, int pb) { if (lc > Base.kNumLitContextBitsMax || lp > 4 || pb > Base.kNumPosStatesBitsMax) { return false; } m_LiteralDecoder.create(lp, lc); int numPosStates = 1 << pb; m_LenDecoder.create(numPosStates); m_RepLenDecoder.create(numPosStates); m_PosStateMask = numPosStates - 1; return true; }
void updateTable(int posState) { setPrices(posState, _tableSize, _prices, posState * Base.kNumLenSymbols); _counters[posState] = _tableSize; }
encoder = new Encoder(); encoder.setDictionarySize(dictionarySize); encoder.setEndMarkerMode(endMarkerMode); encoder.setMatchFinder(DEFAULT_MATCH_FINDER); encoder.setNumFastBytes(numFastBytes); encoder.setLcLpPb(lc, lp, pb);
@Override protected void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws Exception { final int length = in.readableBytes(); InputStream bbIn = null; ByteBufOutputStream bbOut = null; try { bbIn = new ByteBufInputStream(in); bbOut = new ByteBufOutputStream(out); bbOut.writeByte(properties); bbOut.writeInt(littleEndianDictionarySize); bbOut.writeLong(Long.reverseBytes(length)); encoder.code(bbIn, bbOut, -1, -1, null); } finally { if (bbIn != null) { bbIn.close(); } if (bbOut != null) { bbOut.close(); } } }
@Override public void code(InputStream in, OutputStream out) throws IOException { //both int attributes aren't used inside the method e.code(in, out, -1, -1, null); } }