Blame src/lzo1a_de.h

Packit 679830
/* lzo1a_de.h -- definitions for the the LZO1A algorithm
Packit 679830
Packit 679830
   This file is part of the LZO real-time data compression library.
Packit 679830
Packit 679830
   Copyright (C) 1996-2014 Markus Franz Xaver Johannes Oberhumer
Packit 679830
   All Rights Reserved.
Packit 679830
Packit 679830
   The LZO library is free software; you can redistribute it and/or
Packit 679830
   modify it under the terms of the GNU General Public License as
Packit 679830
   published by the Free Software Foundation; either version 2 of
Packit 679830
   the License, or (at your option) any later version.
Packit 679830
Packit 679830
   The LZO library is distributed in the hope that it will be useful,
Packit 679830
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 679830
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 679830
   GNU General Public License for more details.
Packit 679830
Packit 679830
   You should have received a copy of the GNU General Public License
Packit 679830
   along with the LZO library; see the file COPYING.
Packit 679830
   If not, write to the Free Software Foundation, Inc.,
Packit 679830
   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Packit 679830
Packit 679830
   Markus F.X.J. Oberhumer
Packit 679830
   <markus@oberhumer.com>
Packit 679830
   http://www.oberhumer.com/opensource/lzo/
Packit 679830
 */
Packit 679830
Packit 679830
Packit 679830
/* WARNING: this file should *not* be used by applications. It is
Packit 679830
   part of the implementation of the LZO package and is subject
Packit 679830
   to change.
Packit 679830
 */
Packit 679830
Packit 679830
Packit 679830
#ifndef __LZO_DEFS_H
Packit 679830
#define __LZO_DEFS_H 1
Packit 679830
Packit 679830
#ifdef __cplusplus
Packit 679830
extern "C" {
Packit 679830
#endif
Packit 679830
Packit 679830
Packit 679830
/***********************************************************************
Packit 679830
//
Packit 679830
************************************************************************/
Packit 679830
Packit 679830
/*
Packit 679830
     Format of the marker byte
Packit 679830
Packit 679830
Packit 679830
     76543210
Packit 679830
     --------
Packit 679830
     00000000   a long literal run ('R0' run) - there are short and long R0 runs
Packit 679830
     000rrrrr   a short literal run with len r
Packit 679830
     mmmooooo   a short match (len = 2+m, o = offset low bits)
Packit 679830
     111ooooo   a long match (o = offset low bits)
Packit 679830
*/
Packit 679830
Packit 679830
Packit 679830
#define RSIZE   (1 << RBITS)
Packit 679830
#define RMASK   (RSIZE - 1)
Packit 679830
Packit 679830
#define MBITS   (8 - OBITS)
Packit 679830
#define MSIZE   (1 << MBITS)
Packit 679830
#define MMASK   (MSIZE - 1)
Packit 679830
Packit 679830
#define OBITS   RBITS               /* offset and run-length use same bits */
Packit 679830
#define OSIZE   (1 << OBITS)
Packit 679830
#define OMASK   (OSIZE - 1)
Packit 679830
Packit 679830
Packit 679830
/* additional bits for coding the length in a long match */
Packit 679830
#define LBITS   8
Packit 679830
#define LSIZE   (1 << LBITS)
Packit 679830
#define LMASK   (LSIZE - 1)
Packit 679830
Packit 679830
Packit 679830
/***********************************************************************
Packit 679830
// some macros to improve readability
Packit 679830
************************************************************************/
Packit 679830
Packit 679830
/* Minimum len of a match */
Packit 679830
#define MIN_MATCH           3
Packit 679830
#define THRESHOLD           (MIN_MATCH - 1)
Packit 679830
Packit 679830
/* Min-/Maximum len of a match coded in 2 bytes */
Packit 679830
#define MIN_MATCH_SHORT     (MIN_MATCH)
Packit 679830
#define MAX_MATCH_SHORT     (MIN_MATCH_SHORT + (MSIZE - 2) - 1)
Packit 679830
/* why (MSIZE - 2) ? because 0 is used to mark runs,
Packit 679830
 *                   and MSIZE-1 is used to mark a long match */
Packit 679830
Packit 679830
/* Min-/Maximum len of a match coded in 3 bytes */
Packit 679830
#define MIN_MATCH_LONG      (MAX_MATCH_SHORT + 1)
Packit 679830
#define MAX_MATCH_LONG      (MIN_MATCH_LONG + LSIZE - 1)
Packit 679830
Packit 679830
/* Min-/Maximum offset of a match */
Packit 679830
#define MIN_OFFSET          1
Packit 679830
#define MAX_OFFSET          (1 << (CHAR_BIT + OBITS))
Packit 679830
Packit 679830
Packit 679830
/* R0 literal run (a long run) */
Packit 679830
Packit 679830
#define R0MIN   (RSIZE)             /* Minimum len of R0 run of literals */
Packit 679830
#define R0MAX   (R0MIN + 255)       /* Maximum len of R0 run of literals */
Packit 679830
#define R0FAST  (R0MAX & ~7)        /* R0MAX aligned to 8 byte boundary */
Packit 679830
Packit 679830
#if (R0MAX - R0FAST != 7) || ((R0FAST & 7) != 0)
Packit 679830
#  error "something went wrong"
Packit 679830
#endif
Packit 679830
Packit 679830
/* 7 special codes from R0FAST+1 .. R0MAX
Packit 679830
 * these codes mean long R0 runs with lengths
Packit 679830
 * 512, 1024, 2048, 4096, 8192, 16384, 32768 */
Packit 679830
Packit 679830
Packit 679830
/*
Packit 679830
Packit 679830
RBITS | MBITS  MIN  THR.  MSIZE  MAXS  MINL  MAXL   MAXO  R0MAX R0FAST
Packit 679830
======+===============================================================
Packit 679830
  3   |   5      3    2     32    32    33    288   2048    263   256
Packit 679830
  4   |   4      3    2     16    16    17    272   4096    271   264
Packit 679830
  5   |   3      3    2      8     8     9    264   8192    287   280
Packit 679830
Packit 679830
 */
Packit 679830
Packit 679830
Packit 679830
/***********************************************************************
Packit 679830
//
Packit 679830
************************************************************************/
Packit 679830
Packit 679830
#define DBITS       13
Packit 679830
#include "lzo_dict.h"
Packit 679830
#define DVAL_LEN    DVAL_LOOKAHEAD
Packit 679830
Packit 679830
Packit 679830
Packit 679830
#ifdef __cplusplus
Packit 679830
} /* extern "C" */
Packit 679830
#endif
Packit 679830
Packit 679830
#endif /* already included */
Packit 679830
Packit 679830
/*
Packit 679830
vi:ts=4:et
Packit 679830
*/
Packit 679830