Home | History | Annotate | Download | only in src
      1 /* stats1a.h -- statistics for the the LZO1A algorithm
      2 
      3    This file is part of the LZO real-time data compression library.
      4 
      5    Copyright (C) 1996-2014 Markus Franz Xaver Johannes Oberhumer
      6    All Rights Reserved.
      7 
      8    The LZO library is free software; you can redistribute it and/or
      9    modify it under the terms of the GNU General Public License as
     10    published by the Free Software Foundation; either version 2 of
     11    the License, or (at your option) any later version.
     12 
     13    The LZO library is distributed in the hope that it will be useful,
     14    but WITHOUT ANY WARRANTY; without even the implied warranty of
     15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     16    GNU General Public License for more details.
     17 
     18    You should have received a copy of the GNU General Public License
     19    along with the LZO library; see the file COPYING.
     20    If not, write to the Free Software Foundation, Inc.,
     21    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
     22 
     23    Markus F.X.J. Oberhumer
     24    <markus (at) oberhumer.com>
     25    http://www.oberhumer.com/opensource/lzo/
     26  */
     27 
     28 
     29 /* WARNING: this file should *not* be used by applications. It is
     30    part of the implementation of the LZO package and is subject
     31    to change.
     32  */
     33 
     34 
     35 #ifndef __LZO_STATS1A_H
     36 #define __LZO_STATS1A_H 1
     37 
     38 #ifdef __cplusplus
     39 extern "C" {
     40 #endif
     41 
     42 
     43 
     44 /***********************************************************************
     45 // collect statistical information when compressing
     46 // used for finetuning, view with a debugger
     47 ************************************************************************/
     48 
     49 #if (LZO_COLLECT_STATS)
     50 #  define LZO_STATS(expr)   expr
     51 #else
     52 #  define LZO_STATS(expr)   ((void) 0)
     53 #endif
     54 
     55 
     56 /***********************************************************************
     57 //
     58 ************************************************************************/
     59 
     60 typedef struct {
     61 
     62 /* configuration */
     63     unsigned rbits;
     64     unsigned clevel;
     65 
     66 /* internal configuration */
     67     unsigned dbits;
     68     unsigned lbits;
     69 
     70 /* constants */
     71     unsigned min_match_short;
     72     unsigned max_match_short;
     73     unsigned min_match_long;
     74     unsigned max_match_long;
     75     unsigned min_offset;
     76     unsigned max_offset;
     77     unsigned r0min;
     78     unsigned r0fast;
     79     unsigned r0max;
     80 
     81 /* counts */
     82     long short_matches;
     83     long long_matches;
     84     long r1_matches;
     85     long lit_runs;
     86     long lit_runs_after_long_match;
     87     long r0short_runs;
     88     long r0fast_runs;
     89     long r0long_runs;
     90 
     91 /* */
     92     long lit_run[RSIZE];
     93     long lit_run_after_long_match[RSIZE];
     94     long short_match[MAX_MATCH_SHORT + 1];
     95     long long_match[MAX_MATCH_LONG + 1];
     96     long marker[256];
     97 
     98 /* these could prove useful for further optimizations */
     99     long short_match_offset_osize[MAX_MATCH_SHORT + 1];
    100     long short_match_offset_256[MAX_MATCH_SHORT + 1];
    101     long short_match_offset_1024[MAX_MATCH_SHORT + 1];
    102     long matches_out_of_range;
    103     long matches_out_of_range_2;
    104     long matches_out_of_range_4;
    105     long match_out_of_range[MAX_MATCH_SHORT + 1];
    106 
    107 /* */
    108     long in_len;
    109     long out_len;
    110 }
    111 lzo1a_stats_t;
    112 
    113 extern lzo1a_stats_t *lzo1a_stats;
    114 
    115 
    116 
    117 #ifdef __cplusplus
    118 } /* extern "C" */
    119 #endif
    120 
    121 #endif /* already included */
    122 
    123 /*
    124 vi:ts=4:et
    125 */
    126