Blame src/lzo1a_de.h

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