r5703 - trunk/varnish-cache/lib/libvgz
phk at varnish-cache.org
phk at varnish-cache.org
Mon Jan 10 12:29:22 CET 2011
Author: phk
Date: 2011-01-10 12:29:22 +0100 (Mon, 10 Jan 2011)
New Revision: 5703
Modified:
trunk/varnish-cache/lib/libvgz/deflate.c
trunk/varnish-cache/lib/libvgz/trees.c
Log:
Also register the start, stop and last bits when compressing
PS: I'm getting faster at this, today I wrote 3 lines of code per hour
Modified: trunk/varnish-cache/lib/libvgz/deflate.c
===================================================================
--- trunk/varnish-cache/lib/libvgz/deflate.c 2011-01-07 15:01:18 UTC (rev 5702)
+++ trunk/varnish-cache/lib/libvgz/deflate.c 2011-01-10 11:29:22 UTC (rev 5703)
@@ -811,6 +811,9 @@
ERR_RETURN(strm, Z_BUF_ERROR);
}
+ if (strm->start_bit == 0)
+ strm->start_bit = (strm->total_out + s->pending) * 8 + s->bi_valid;
+
/* Start a new block or continue the current one.
*/
if (strm->avail_in != 0 || s->lookahead != 0 ||
Modified: trunk/varnish-cache/lib/libvgz/trees.c
===================================================================
--- trunk/varnish-cache/lib/libvgz/trees.c 2011-01-07 15:01:18 UTC (rev 5702)
+++ trunk/varnish-cache/lib/libvgz/trees.c 2011-01-10 11:29:22 UTC (rev 5703)
@@ -931,6 +931,10 @@
ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */
int max_blindex = 0; /* index of last bit length code of non zero freq */
+ if (last)
+ s->strm->last_bit =
+ (s->strm->total_out + s->pending) * 8 + s->bi_valid;
+
/* Build the Huffman trees unless a stored block is forced */
if (s->level > 0) {
@@ -1011,6 +1015,9 @@
init_block(s);
if (last) {
+ s->strm->stop_bit =
+ (s->strm->total_out + s->pending) * 8 + s->bi_valid;
+
bi_windup(s);
#ifdef DEBUG
s->compressed_len += 7; /* align on byte boundary */
More information about the varnish-commit
mailing list