1 /********************************************************************
2  *                                                                  *
3  * THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE.   *
4  * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
5  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
7  *                                                                  *
8  * THE Theora SOURCE CODE IS COPYRIGHT (C) 2002-2009                *
9  * by the Xiph.Org Foundation and contributors http://www.xiph.org/ *
10  *                                                                  *
11  ********************************************************************
12 
13   function:
14     last mod: $Id$
15 
16  ********************************************************************/
17 
18 #if !defined(_huffman_H)
19 # define _hufffman_H (1)
20 # include "theora/codec.h"
21 # include "ocintrin.h"
22 
23 /*The range of valid quantized DCT coefficient values.
24   VP3 used 511 in the encoder, but the bitstream is capable of 580.*/
25 #define OC_DCT_VAL_RANGE         (580)
26 
27 #define OC_NDCT_TOKEN_BITS       (5)
28 
29 #define OC_DCT_EOB1_TOKEN        (0)
30 #define OC_DCT_EOB2_TOKEN        (1)
31 #define OC_DCT_EOB3_TOKEN        (2)
32 #define OC_DCT_REPEAT_RUN0_TOKEN (3)
33 #define OC_DCT_REPEAT_RUN1_TOKEN (4)
34 #define OC_DCT_REPEAT_RUN2_TOKEN (5)
35 #define OC_DCT_REPEAT_RUN3_TOKEN (6)
36 
37 #define OC_DCT_SHORT_ZRL_TOKEN   (7)
38 #define OC_DCT_ZRL_TOKEN         (8)
39 
40 #define OC_ONE_TOKEN             (9)
41 #define OC_MINUS_ONE_TOKEN       (10)
42 #define OC_TWO_TOKEN             (11)
43 #define OC_MINUS_TWO_TOKEN       (12)
44 
45 #define OC_DCT_VAL_CAT2          (13)
46 #define OC_DCT_VAL_CAT3          (17)
47 #define OC_DCT_VAL_CAT4          (18)
48 #define OC_DCT_VAL_CAT5          (19)
49 #define OC_DCT_VAL_CAT6          (20)
50 #define OC_DCT_VAL_CAT7          (21)
51 #define OC_DCT_VAL_CAT8          (22)
52 
53 #define OC_DCT_RUN_CAT1A         (23)
54 #define OC_DCT_RUN_CAT1B         (28)
55 #define OC_DCT_RUN_CAT1C         (29)
56 #define OC_DCT_RUN_CAT2A         (30)
57 #define OC_DCT_RUN_CAT2B         (31)
58 
59 #define OC_NDCT_EOB_TOKEN_MAX    (7)
60 #define OC_NDCT_ZRL_TOKEN_MAX    (9)
61 #define OC_NDCT_VAL_MAX          (23)
62 #define OC_NDCT_VAL_CAT1_MAX     (13)
63 #define OC_NDCT_VAL_CAT2_MAX     (17)
64 #define OC_NDCT_VAL_CAT2_SIZE    (OC_NDCT_VAL_CAT2_MAX-OC_DCT_VAL_CAT2)
65 #define OC_NDCT_RUN_MAX          (32)
66 #define OC_NDCT_RUN_CAT1A_MAX    (28)
67 
68 extern const unsigned char OC_DCT_TOKEN_EXTRA_BITS[TH_NDCT_TOKENS];
69 
70 #endif
71