summaryrefslogtreecommitdiffstats
path: root/media/libtheora/lib/huffman.h
blob: eb805866b9d9bc16a621756d2c12e38d78276c65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/********************************************************************
 *                                                                  *
 * THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE.   *
 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
 *                                                                  *
 * THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2009                *
 * by the Xiph.Org Foundation and contributors http://www.xiph.org/ *
 *                                                                  *
 ********************************************************************

  function:
    last mod: $Id$

 ********************************************************************/

#if !defined(_huffman_H)
# define _huffman_H (1)
# include "theora/codec.h"
# include "ocintrin.h"

/*The range of valid quantized DCT coefficient values.
  VP3 used 511 in the encoder, but the bitstream is capable of 580.*/
#define OC_DCT_VAL_RANGE         (580)

#define OC_NDCT_TOKEN_BITS       (5)

#define OC_DCT_EOB1_TOKEN        (0)
#define OC_DCT_EOB2_TOKEN        (1)
#define OC_DCT_EOB3_TOKEN        (2)
#define OC_DCT_REPEAT_RUN0_TOKEN (3)
#define OC_DCT_REPEAT_RUN1_TOKEN (4)
#define OC_DCT_REPEAT_RUN2_TOKEN (5)
#define OC_DCT_REPEAT_RUN3_TOKEN (6)

#define OC_DCT_SHORT_ZRL_TOKEN   (7)
#define OC_DCT_ZRL_TOKEN         (8)

#define OC_ONE_TOKEN             (9)
#define OC_MINUS_ONE_TOKEN       (10)
#define OC_TWO_TOKEN             (11)
#define OC_MINUS_TWO_TOKEN       (12)

#define OC_DCT_VAL_CAT2          (13)
#define OC_DCT_VAL_CAT3          (17)
#define OC_DCT_VAL_CAT4          (18)
#define OC_DCT_VAL_CAT5          (19)
#define OC_DCT_VAL_CAT6          (20)
#define OC_DCT_VAL_CAT7          (21)
#define OC_DCT_VAL_CAT8          (22)

#define OC_DCT_RUN_CAT1A         (23)
#define OC_DCT_RUN_CAT1B         (28)
#define OC_DCT_RUN_CAT1C         (29)
#define OC_DCT_RUN_CAT2A         (30)
#define OC_DCT_RUN_CAT2B         (31)

#define OC_NDCT_EOB_TOKEN_MAX    (7)
#define OC_NDCT_ZRL_TOKEN_MAX    (9)
#define OC_NDCT_VAL_MAX          (23)
#define OC_NDCT_VAL_CAT1_MAX     (13)
#define OC_NDCT_VAL_CAT2_MAX     (17)
#define OC_NDCT_VAL_CAT2_SIZE    (OC_NDCT_VAL_CAT2_MAX-OC_DCT_VAL_CAT2)
#define OC_NDCT_RUN_MAX          (32)
#define OC_NDCT_RUN_CAT1A_MAX    (28)

extern const unsigned char OC_DCT_TOKEN_EXTRA_BITS[TH_NDCT_TOKENS];

#endif