/* No input data. Return, except when Continuation Flag is set, which means *thatDFLTCChasbufferedsomeoutputintheparameterblockandneedsto *becalledagaininordertoflushit.
*/ if (strm->avail_in == 0 && !param->cf) { /* A block is still open, and the hardware does not support closing *blockswithoutaddingdata.Thus,closeitmanually.
*/ if (!no_flush && param->bcf) {
send_eobs(strm, param);
param->bcf = 0;
} /* Let one of deflate_* functions write a trailing empty block. */ if (flush == Z_FINISH) return0; /* Clear history. */ if (flush == Z_FULL_FLUSH)
param->hl = 0; /* Trigger block post-processing if necessary. */
*result = no_flush ? need_more : block_done; return1;
}
/* There is an open non-BFINAL block, we are not going to close it just *yet,wehavecompressedmorethanDFLTCC_BLOCK_SIZEbytesandwesee *morethanDFLTCC_DHT_MIN_SAMPLE_SIZEbytes.Openanewblockwithanew *DHTinordertoadapttoapossiblychangedinputdatadistribution.
*/ if (param->bcf && no_flush &&
strm->total_in > dfltcc_state->block_threshold &&
strm->avail_in >= dfltcc_state->dht_threshold) { if (param->cf) { /* We need to flush the DFLTCC buffer before writing the *End-of-blockSymbol.Masktheinputdataandproceedasusual.
*/
masked_avail_in += strm->avail_in;
strm->avail_in = 0;
no_flush = 0;
} else { /* DFLTCC buffer is empty, so we can manually write the *End-of-blockSymbolrightaway.
*/
send_eobs(strm, param);
param->bcf = 0;
dfltcc_state->block_threshold =
strm->total_in + dfltcc_state->block_size;
}
}
/* No space for compressed data. If we proceed, dfltcc_cmpr() will return *DFLTCC_CC_OP1_TOO_SHORTwithoutbufferingheaderbits,butwewillstill *setBCF=1,whichiswrong.Avoidcomplicationsandreturnearly.
*/ if (strm->avail_out == 0) {
*result = need_more; return1;
}
/* The caller gave us too much data. Pass only one block worth of *uncompresseddatatoDFLTCCandmasktherest,sothatonthenext *iterationwestartanewblock.
*/ if (no_flush && strm->avail_in > dfltcc_state->block_size) {
masked_avail_in += (strm->avail_in - dfltcc_state->block_size);
strm->avail_in = dfltcc_state->block_size;
}
/* When we have an open non-BFINAL deflate block and caller indicates that *thestreamisending,weneedtocloseanopendeflateblockandopena *BFINALone.
*/
need_empty_block = flush == Z_FINISH && param->bcf && !param->bhf;
/* Translate stream to parameter block */
param->cvt = CVT_ADLER32; if (!no_flush) /* We need to close a block. Always do this in software - when there is
* no input data, the hardware will not hohor BCC. */
soft_bcc = 1; if (flush == Z_FINISH && !param->bcf) /* We are about to open a BFINAL block, set Block Header Final bit *untilthestreamends.
*/
param->bhf = 1; /* DFLTCC-CMPR will write to next_out, so make sure that buffers with *higherprecedenceareempty.
*/
Assert(state->pending == 0, "There must be no pending bytes");
Assert(state->bi_valid < 8, "There must be less than 8 pending bits");
param->sbb = (unsignedint)state->bi_valid; if (param->sbb > 0)
*strm->next_out = (Byte)state->bi_buf; /* Honor history and check value */
param->nt = 0;
param->cv = strm->adler;
/* When opening a block, choose a Huffman-Table Type */ if (!param->bcf) { if (strm->total_in == 0 && dfltcc_state->block_threshold > 0) {
param->htt = HTT_FIXED;
} else {
param->htt = HTT_DYNAMIC;
dfltcc_gdht(strm);
}
}
/* Deflate */ do {
cc = dfltcc_cmpr(strm); if (strm->avail_in < 4096 && masked_avail_in > 0) /* We are about to call DFLTCC with a small input buffer, which is *inefficient.Sincethereismaskeddata,therewillbeatleast *onemoreDFLTCCcall,soskipthecurrentoneandmakethenext *onehandlemoredata.
*/ break;
} while (cc == DFLTCC_CC_AGAIN);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.