mpeg_tok.h
1.45 KB
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
71
72
73
74
75
76
77
78
#define TOK_PTYPE_INTRA (1)
#define TOK_PTYPE_PRED (2)
#define TOK_PTYPE_BIDIR (3)
#define TOK_BEGIN_BLOCK (0)
#define TOK_NEXT_MB (16)
#define TOK_NEXT_PIC (17)
#define TOK_NEXT_SEQ (18)
#define TOK_END_PAGE (29)
#define TOK_END_PIC (30)
#define TOK_END_SEQ (31)
#define TOK_MBTYPE_INTRA (1<<15)
#define TOK_MBTYPE_ERRS (1<<14)
#define TOK_MBTYPE_FOR (1<<13)
#define TOK_MBTYPE_BAK (1<<12)
#define TOK_MBTYPE_BCNTS (1<<11)
/*
Macroblock type encoding bitfields:
15 Intra
14 Errs
13 For
12 Back
11 Bcnts
10 ------
9 FhighY
8 FhighX
7 FhighX
6 FhighX
5 FhighX
4 BhighY
3 BhighX
2 BhighX
1 BhighX
0 BhighX
*/
/*
Motion vector encoding:
MPEG-2 Main Profile, Main Level says x in [-1024,+1023.5] (12 bits)
and y in [ -128, +127.5] ( 9 bits)
These can be stored in (1+4)(high bits in MBtype) + (8+8)(low bits)
So, only one extra 16-bit word is needed per macroblock per MV.
*/
#define TOK_MVY_HIGH_BITS (1)
#define TOK_MVX_HIGH_BITS (4)
#define TOK_MVY_LOW_BITS (8)
#define TOK_MVX_LOW_BITS (8)
#define TOK_MVY_HIGH_MASK ((1<<TOK_MVY_HIGH_BITS)-1)
#define TOK_MVX_HIGH_MASK ((1<<TOK_MVX_HIGH_BITS)-1)
#define TOK_MVY_LOW_MASK ((1<<TOK_MVY_LOW_BITS)-1)
#define TOK_MVX_LOW_MASK ((1<<TOK_MVX_LOW_BITS)-1)
#define TOK_FMVY_HIGH_SHIFT (9)
#define TOK_FMVX_HIGH_SHIFT (5)
#define TOK_BMVY_HIGH_SHIFT (4)
#define TOK_BMVX_HIGH_SHIFT (0)
#define TOK_MVY_LOW_SHIFT (8)
#define TOK_MVX_LOW_SHIFT (0)
#define TOK_PRED_SKIP (TOK_MBTYPE_FOR)