diff options
author | Cosimo Lupo <cosimo.lupo@daltonmaag.com> | 2015-05-08 12:07:10 +0100 |
---|---|---|
committer | Cosimo Lupo <cosimo.lupo@daltonmaag.com> | 2015-05-11 10:39:21 +0100 |
commit | dbcb32614af80b5cdfd773cef4017892a3a5de1d (patch) | |
tree | 2cb3db949c5dbdbe7f46f7cd517709eaf78a9c10 /python | |
parent | 4c1d06931ecf3ec063fa4ab820bb2d102413a01c (diff) | |
download | brotli-dbcb32614af80b5cdfd773cef4017892a3a5de1d.zip brotli-dbcb32614af80b5cdfd773cef4017892a3a5de1d.tar.gz brotli-dbcb32614af80b5cdfd773cef4017892a3a5de1d.tar.bz2 |
[brotlimodule] add enable_context_modeling parameter (defaults to True)
Diffstat (limited to 'python')
-rw-r--r-- | python/brotlimodule.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/python/brotlimodule.cc b/python/brotlimodule.cc index 79e48c6..67c63ac 100644 --- a/python/brotlimodule.cc +++ b/python/brotlimodule.cc @@ -66,20 +66,22 @@ static PyObject* brotli_compress(PyObject *self, PyObject *args, PyObject *keywd PyObject* enable_dictionary = NULL; PyObject* enable_transforms = NULL; PyObject* greedy_block_split = NULL; + PyObject* enable_context_modeling = NULL; uint8_t *input, *output; size_t length, output_length; BrotliParams::Mode mode = (BrotliParams::Mode) -1; int ok; static char *kwlist[] = {"data", "mode", "enable_dictionary", "enable_transforms", - "greedy_block_split", NULL}; + "greedy_block_split", "enable_context_modeling", NULL}; - ok = PyArg_ParseTupleAndKeywords(args, keywds, "s#|O&O!O!O!:compress", kwlist, + ok = PyArg_ParseTupleAndKeywords(args, keywds, "s#|O&O!O!O!O!:compress", kwlist, &input, &length, &mode_convertor, &mode, &PyBool_Type, &enable_dictionary, &PyBool_Type, &enable_transforms, - &PyBool_Type, &greedy_block_split); + &PyBool_Type, &greedy_block_split, + &PyBool_Type, &enable_context_modeling); if (!ok) return NULL; @@ -96,6 +98,8 @@ static PyObject* brotli_compress(PyObject *self, PyObject *args, PyObject *keywd params.enable_transforms = PyObject_IsTrue(enable_transforms); if (greedy_block_split) params.greedy_block_split = PyObject_IsTrue(greedy_block_split); + if (enable_context_modeling) + params.enable_context_modeling = PyObject_IsTrue(enable_context_modeling); ok = BrotliCompressBuffer(params, length, input, &output_length, output); |