Statistics
| Branch: | Revision:

ffmpeg / libavcodec / h261data.h @ ec697587

History | View | Annotate | Download (4.18 KB)

1
/**
2
 * @file h261data.h
3
 * H.261 tables.
4
 */
5
#define MB_TYPE_H261_FIL 0x800000
6

    
7
// H.261 VLC table for macroblock addressing
8
const uint8_t h261_mba_code[34] = {
9
     1,  3,  2,  3,
10
     2,  3,  2,  7,
11
     6, 11, 10,  9,
12
     8,  7,  6, 23,
13
    22, 21, 20, 19,
14
    18, 35, 34, 33,
15
    32, 31, 30, 29,
16
    28, 27, 26, 25,
17
    24,
18
    15             //(MBA stuffing)
19
};
20

    
21
const uint8_t h261_mba_bits[34] = {
22
     1,  3,  3,  4,
23
     4,  5,  5,  7,
24
     7,  8,  8,  8,
25
     8,  8,  8, 10,
26
    10, 10, 10, 10,
27
    10, 11, 11, 11,
28
    11, 11, 11, 11,
29
    11, 11, 11, 11,
30
    11,
31
    11            //(MBA stuffing)
32
};
33

    
34
//H.261 VLC table for macroblock type
35
const uint8_t h261_mtype_code[10] = {
36
    1,  1,  1,  1,
37
    1,  1,  1,  1,
38
    1,  1
39
};
40

    
41
const uint8_t h261_mtype_bits[10] = {
42
    4,  7,  1,  5,
43
    9,  8, 10,  3,
44
    2,  6
45
};
46

    
47
static const int h261_mtype_map[10]= {
48
        MB_TYPE_INTRA4x4,
49
        MB_TYPE_INTRA4x4  |  MB_TYPE_QUANT,
50
                                               MB_TYPE_CBP,
51
                             MB_TYPE_QUANT  |  MB_TYPE_CBP,
52
                                                               MB_TYPE_16x16,
53
                                               MB_TYPE_CBP  |  MB_TYPE_16x16,
54
                             MB_TYPE_QUANT  |  MB_TYPE_CBP  |  MB_TYPE_16x16,
55
                                                               MB_TYPE_16x16  |  MB_TYPE_H261_FIL,
56
                                               MB_TYPE_CBP  |  MB_TYPE_16x16  |  MB_TYPE_H261_FIL,
57
                             MB_TYPE_QUANT  |  MB_TYPE_CBP  |  MB_TYPE_16x16  |  MB_TYPE_H261_FIL
58
};
59

    
60
//H.261 VLC table for motion vectors
61
const uint8_t h261_mv_tab[17][2] = {
62
    {1,1}, {1,2}, {1,3}, {1,4}, {3,6}, {5,7}, {4,7}, {3,7},
63
    {11,9}, {10,9}, {9,9}, {17,10}, {16,10}, {15,10}, {14,10}, {13,10}, {12,10}
64
};
65

    
66
static const int mvmap[17] =
67
{
68
    0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, 16
69
};
70

    
71
//H.261 VLC table for coded block pattern
72
const uint8_t h261_cbp_tab[63][2] =
73
{
74
    {11,5}, {9,5}, {13,6}, {13,4}, {23,7}, {19,7}, {31,8}, {12,4},
75
    {22,7}, {18,7}, {30,8}, {19,5}, {27,8}, {23,8}, {19,8}, {11,4},
76
    {21,7}, {17,7}, {29,8}, {17,5}, {25,8}, {21,8}, {17,8}, {15,6},
77
    {15,8}, {13,8}, {3,9}, {15,5}, {11,8}, {7,8}, {7,9}, {10,4},
78
    {20,7}, {16,7}, {28,8}, {14,6}, {14,8}, {12,8}, {2,9}, {16,5},
79
    {24,8}, {20,8}, {16,8}, {14,5}, {10,8}, {6,8}, {6,9}, {18,5},
80
    {26,8}, {22,8}, {18,8}, {13,5}, {9,8}, {5,8}, {5,9}, {12,5},
81
    {8,8}, {4,8}, {4,9}, {7,3}, {10,5}, {8,5}, {12,6}
82
};
83

    
84
//H.261 VLC table for transform coefficients
85
const uint16_t h261_tcoeff_vlc[65][2] = {
86
{ 0x2, 2 }, { 0x3, 2 },{ 0x4, 4 },{ 0x5, 5 },
87
{ 0x6, 7 },{ 0x26, 8 },{ 0x21, 8 },{ 0xa, 10 },
88
{ 0x1d, 12 },{ 0x18, 12 },{ 0x13, 12 },{ 0x10 , 12 },
89
{ 0x1a, 13},{ 0x19, 13 }, { 0x18, 13 }, { 0x17, 13 },
90
{ 0x3, 3 }, { 0x6, 6 }, { 0x25 , 8 }, { 0xc, 10 },
91
{ 0x1b, 12 }, { 0x16, 13 }, { 0x15, 13 }, { 0x5, 4},
92
{ 0x4, 7}, { 0xb, 10 }, { 0x14, 12 }, { 0x14, 13 },
93
{ 0x7, 5 }, { 0x24, 8 }, { 0x1c, 12 }, { 0x13, 13 },
94
{ 0x6, 5 }, { 0xf, 10 }, { 0x12, 12}, { 0x7, 6},
95
{ 0x9 , 10 }, { 0x12, 13 }, { 0x5, 6 }, { 0x1e, 12 },
96
{ 0x4, 6 }, { 0x15, 12 }, { 0x7, 7 }, { 0x11, 12},
97
{ 0x5, 7 }, { 0x11, 13 }, { 0x27, 8 }, { 0x10, 13 },
98
{ 0x23, 8 }, { 0x22, 8 }, { 0x20, 8 }, { 0xe , 10 },
99
{ 0xd, 10 }, { 0x8, 10 },{ 0x1f, 12 }, { 0x1a, 12 },
100
{ 0x19, 12 }, { 0x17, 12 }, { 0x16, 12}, { 0x1f, 13},
101
{ 0x1e, 13 }, { 0x1d, 13 }, { 0x1c, 13}, { 0x1b, 13},
102
{ 0x1, 6 }                                             //escape
103
};
104

    
105
const int8_t h261_tcoeff_level[64] = {
106
    0,  1,  2,  3,  4,  5,  6,  7,
107
    8,  9, 10, 11, 12, 13, 14, 15,
108
    1,  2,  3,  4,  5,  6,  7,  1,
109
    2,  3,  4,  5,  1,  2,  3,  4,
110
    1,  2,  3,  1,  2,  3,  1,  2,
111
    1,  2,  1,  2,  1,  2,  1,  2,
112
    1,  1,  1,  1,  1,  1,  1,  1,
113
    1,  1,  1,  1,  1,  1,  1,  1
114
};
115

    
116
const int8_t h261_tcoeff_run[64] = {
117
    0,
118
    0,  0,  0,  0,  0,  0,  0,  0,
119
    0,  0,  0,  0,  0,  0,  0,  1,
120
    1,  1,  1,  1,  1,  1,  2,  2,
121
    2,  2,  2,  3,  3,  3,  3,  4,
122
    4,  4,  5,  5,  5,  6,  6,  7,
123
    7,  8,  8,  9,  9, 10, 10, 11,
124
   12, 13, 14, 15, 16, 17, 18, 19,
125
   20, 21, 22, 23, 24, 25, 26
126
};
127

    
128
static RLTable h261_rl_tcoeff = {
129
    64,
130
    64,
131
    h261_tcoeff_vlc,
132
    h261_tcoeff_run,
133
    h261_tcoeff_level,
134
};