"Fossies" - the Fresh Open Source Software Archive

Member "pigz-2.8/zopfli/src/zopfli/blocksplitter.h" (28 Dec 2017, 2656 Bytes) of package /linux/privat/pigz-2.8.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "blocksplitter.h" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 2.4_vs_2.5.

    1 /*
    2 Copyright 2011 Google Inc. All Rights Reserved.
    3 
    4 Licensed under the Apache License, Version 2.0 (the "License");
    5 you may not use this file except in compliance with the License.
    6 You may obtain a copy of the License at
    7 
    8     http://www.apache.org/licenses/LICENSE-2.0
    9 
   10 Unless required by applicable law or agreed to in writing, software
   11 distributed under the License is distributed on an "AS IS" BASIS,
   12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   13 See the License for the specific language governing permissions and
   14 limitations under the License.
   15 
   16 Author: lode.vandevenne@gmail.com (Lode Vandevenne)
   17 Author: jyrki.alakuijala@gmail.com (Jyrki Alakuijala)
   18 */
   19 
   20 /*
   21 Functions to choose good boundaries for block splitting. Deflate allows encoding
   22 the data in multiple blocks, with a separate Huffman tree for each block. The
   23 Huffman tree itself requires some bytes to encode, so by choosing certain
   24 blocks, you can either hurt, or enhance compression. These functions choose good
   25 ones that enhance it.
   26 */
   27 
   28 #ifndef ZOPFLI_BLOCKSPLITTER_H_
   29 #define ZOPFLI_BLOCKSPLITTER_H_
   30 
   31 #include <stdlib.h>
   32 
   33 #include "lz77.h"
   34 #include "zopfli.h"
   35 
   36 
   37 /*
   38 Does blocksplitting on LZ77 data.
   39 The output splitpoints are indices in the LZ77 data.
   40 maxblocks: set a limit to the amount of blocks. Set to 0 to mean no limit.
   41 */
   42 void ZopfliBlockSplitLZ77(const ZopfliOptions* options,
   43                           const ZopfliLZ77Store* lz77, size_t maxblocks,
   44                           size_t** splitpoints, size_t* npoints);
   45 
   46 /*
   47 Does blocksplitting on uncompressed data.
   48 The output splitpoints are indices in the uncompressed bytes.
   49 
   50 options: general program options.
   51 in: uncompressed input data
   52 instart: where to start splitting
   53 inend: where to end splitting (not inclusive)
   54 maxblocks: maximum amount of blocks to split into, or 0 for no limit
   55 splitpoints: dynamic array to put the resulting split point coordinates into.
   56   The coordinates are indices in the input array.
   57 npoints: pointer to amount of splitpoints, for the dynamic array. The amount of
   58   blocks is the amount of splitpoitns + 1.
   59 */
   60 void ZopfliBlockSplit(const ZopfliOptions* options,
   61                       const unsigned char* in, size_t instart, size_t inend,
   62                       size_t maxblocks, size_t** splitpoints, size_t* npoints);
   63 
   64 /*
   65 Divides the input into equal blocks, does not even take LZ77 lengths into
   66 account.
   67 */
   68 void ZopfliBlockSplitSimple(const unsigned char* in,
   69                             size_t instart, size_t inend,
   70                             size_t blocksize,
   71                             size_t** splitpoints, size_t* npoints);
   72 
   73 #endif  /* ZOPFLI_BLOCKSPLITTER_H_ */