aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLode Vandevenne <lode@google.com>2013-03-04 19:58:27 +0100
committerLode Vandevenne <lode@google.com>2013-03-04 19:58:27 +0100
commit42afd06de11fca2625b1d2b43a21f252b1b35627 (patch)
tree3d9d862121915cfb3064df80cfe5ce428e5520c0
parentacc035299f8dfe1ddcbc93c99f8600269790f88c (diff)
downloadzopfli-42afd06de11fca2625b1d2b43a21f252b1b35627.tar.gz
Expose DeflatePart function
-rw-r--r--deflate.c13
-rw-r--r--deflate.h15
2 files changed, 23 insertions, 5 deletions
diff --git a/deflate.c b/deflate.c
index 74bb3d8..ada9a40 100644
--- a/deflate.c
+++ b/deflate.c
@@ -17,6 +17,11 @@ Author: lode.vandevenne@gmail.com (Lode Vandevenne)
Author: jyrki.alakuijala@gmail.com (Jyrki Alakuijala)
*/
+/*
+Modified by madler@alumni.caltech.edu (Mark Adler)
+Exposed DeflatePart() as an external function.
+*/
+
#include "deflate.h"
#include <assert.h>
@@ -640,10 +645,10 @@ previous bytes are used as the initial dictionary for LZ77.
This function will usually output multiple deflate blocks. If final is 1, then
the final bit will be set on the last block.
*/
-static void DeflatePart(const Options* options, int btype, int final,
- const unsigned char* in, size_t instart, size_t inend,
- unsigned char* bp, unsigned char** out,
- size_t* outsize) {
+void DeflatePart(const Options* options, int btype, int final,
+ const unsigned char* in, size_t instart, size_t inend,
+ unsigned char* bp, unsigned char** out,
+ size_t* outsize) {
if (options->blocksplitting) {
if (options->blocksplittinglast) {
DeflateSplittingLast(options, btype, final, in, instart, inend,
diff --git a/deflate.h b/deflate.h
index 4aaae1c..542358f 100644
--- a/deflate.h
+++ b/deflate.h
@@ -17,6 +17,11 @@ Author: lode.vandevenne@gmail.com (Lode Vandevenne)
Author: jyrki.alakuijala@gmail.com (Jyrki Alakuijala)
*/
+/*
+Modified by madler@alumni.caltech.edu (Mark Adler)
+Exposed DeflatePart() as an external function.
+*/
+
#ifndef ZOPFLI_DEFLATE_H_
#define ZOPFLI_DEFLATE_H_
@@ -40,7 +45,11 @@ btype: the deflate block type. Use 2 for best compression.
final: whether this is the last section of the input, sets the final bit to the
last deflate block.
in: the input bytes
-insize: number of input bytes
+insize (Deflate() only): number of input bytes
+instart (DeflatePart() only): offset of the start of the data to compress at in
+ if instart is not zero, then the data preceding instart will be used as the
+ LZ77 dictionary
+inend (DeflatePart() only): offset + 1 of the end of the data to compress at in
bp: bit pointer for the output array. This must initially be 0, and for
consecutive calls must be reused (it can have values from 0-7). This is
because deflate appends blocks as bit-based data, rather than on byte
@@ -52,6 +61,10 @@ outsize: pointer to the dynamic output array size.
void Deflate(const Options* options, int btype, int final,
const unsigned char* in, size_t insize,
unsigned char* bp, unsigned char** out, size_t* outsize);
+void DeflatePart(const Options* options, int btype, int final,
+ const unsigned char* in, size_t instart, size_t inend,
+ unsigned char* bp, unsigned char** out,
+ size_t* outsize);
/*
Outputs the tree to a dynamic block (btype 10) according to the deflate