Cync
[mardrone] / mardrone / ARDrone_SDK_Version_1_8_20110726 / ARDroneLib / VLIB / P263 / p263_huffman.h
1 #ifndef _P263_HUFFMAN_H_
2 #define _P263_HUFFMAN_H_
3
4 #include <VLIB/video_huffman.h>
5
6 #ifndef NULL
7 #define NULL 0
8 #endif
9
10
11
12 /// Macroblock type & Coded Block Pattern for Chrominance (MCBPC)
13
14 #define VLC_MCBPC_IPICTURES_NUM         9
15 #define VLC_MCBPC_IPICTURES_MAX_LENGTH  9
16
17 #define CBPC_CB(mcbpc) (((mcbpc).cbpc) & 1)
18 #define CBPC_CR(mcbpc) (((mcbpc).cbpc) & 2)
19
20 extern huffman_code_t   vlc_mcbpc_ipictures[VLC_MCBPC_IPICTURES_NUM];
21 extern huffman_tree_t*  vlc_mcbpc_ipictures_tree;
22
23 typedef struct _p263_mcbpc_t {
24   int32_t mb_type;
25   int32_t cbpc;
26 } p263_mcbpc_t;
27
28 extern p263_mcbpc_t mcbpc_ipictures[VLC_MCBPC_IPICTURES_NUM];
29
30
31 /// Coded Block Pattern for luminance (CBPY)
32
33 #define VLC_CBPY_STANDARD_NUM         16
34 #define VLC_CBPY_STANDARD_MAX_LENGTH  6
35
36 extern huffman_code_t   vlc_cbpy_standard[VLC_CBPY_STANDARD_NUM];
37 extern huffman_tree_t*  vlc_cbpy_standard_tree;
38
39 #define CBPY_MAKE( i12, i34 ) (((i34) << 2) | (i12))
40
41 #define CBPY_INTRA_Y0(cpby) ((((cbpy).intra) >> 0) & 1)
42 #define CBPY_INTRA_Y1(cpby) ((((cbpy).intra) >> 1) & 1)
43 #define CBPY_INTRA_Y2(cpby) ((((cbpy).intra) >> 2) & 1)
44 #define CBPY_INTRA_Y3(cpby) ((((cbpy).intra) >> 3) & 1)
45
46 #define CBPY_INTER_Y0(cpby) ((((cbpy).inter) >> 0) & 1)
47 #define CBPY_INTER_Y1(cpby) ((((cbpy).inter) >> 1) & 1)
48 #define CBPY_INTER_Y2(cpby) ((((cbpy).inter) >> 2) & 1)
49 #define CBPY_INTER_Y3(cpby) ((((cbpy).inter) >> 3) & 1)
50
51 typedef struct _p263_cbpy_t {
52   int32_t intra;
53   int32_t inter;
54 } p263_cbpy_t;
55
56 extern p263_cbpy_t cbpy_standard[VLC_CBPY_STANDARD_NUM - 1];
57
58
59 /// Transform Coefficient (TCOEF)
60
61 #define VLC_TCOEFF_NUM          103
62 #define VLC_TCOEFF_MAX_LENGTH   12
63 #define VLC_TCOEFF_ESCAPE       2
64
65 extern huffman_code_t   vlc_tcoeff[VLC_TCOEFF_NUM];
66 extern huffman_tree_t*  vlc_tcoeff_tree;
67
68 typedef struct _p263_tcoeff_t {
69   int32_t run;
70   int32_t level;
71   int32_t last;
72 } p263_tcoeff_t;
73
74 extern p263_tcoeff_t tcoeff[VLC_TCOEFF_NUM];
75
76
77 /// VLC table for Motion Vector Data (MVD)
78
79 #define MVD_VLC_NUM             64
80 #define MVD_VLC_MAX_LENGTH      13
81
82 extern huffman_code_t   mvd_vlc[MVD_VLC_NUM];
83 extern huffman_tree_t*  mvd_vlc_tree;
84
85 typedef struct _p263_mvd_t {
86   int32_t vector;
87   int32_t differences;
88 } p263_mvd_t;
89
90 extern p263_mvd_t mvd[MVD_VLC_NUM];
91
92 #endif // _P263_HUFFMAN_H_