libandroidplugin added
[mardrone] / mardrone / ARDrone_SDK_Version_1_8_20110726 / ARDroneLib / VLIB / Docs / uvlc.txt
1 UVLC File Specification
2
3 Picture Header
4
5         Like in H.263 UVLC start with a PSC (Picture start code) which is 22 bits long
6                 0000 0000 0000 0000 1000 00
7         A PSC is always byte aligned
8         The second information is the picture's format which can be one of following : CIF or VGA (2 bits)
9                 00  : forbidden
10                 01  : CIF
11                 10  : VGA
12         Then comes the picture resolution which is used in combination with the picture's format (3 bits)
13                 000 : forbidden
14                 001 : for CIF it means sub-QCIF
15                 010 : for CIF it means QCIF
16                 011 : for CIF it means CIF
17                 100 : for CIF it means 4-CIF
18                 101 : for CIF it means 16-CIF
19         Then comes the picture's type (3 bits)
20                 000 : INTRA picture
21                 001 : INTER picture
22         Then comes the quantizer's reference for the picture that ranges from 1 to 31 (5 bits)
23         Then comes the frame number (32 bits)
24         
25         Picture header is at least 67 bits long
26
27 Group of Blocks Header
28
29         Each GOB starts with a GOBSC (Group of Blocks start code) wich is 22 bits long
30                 0000 0000 0000 0000 1xxx xx
31         A GOBSC is always byte aligned. The least significant bytes represent the blockline's number. We can see that PSC
32         means first gob too. So for the first GOB, GOB's header is always omitted.
33         
34         Then comes the quantizer's reference for the GOB that ranges from 1 to 31 (5 bits)
35         
36         Group of Blocks Header is at least 27 bits long
37         
38 MacroBlock Header
39
40         Coded Macroblock bit (1 bit)
41                 bit 0 : 1 means there's a macoblock, 0 means macroblock is all zero
42
43         Macrobock description code (7 bits)
44                 bit 0 : 1 means there's non dc coefficients for block y0
45                 bit 1 : 1 means there's non dc coefficients for block y1
46                 bit 2 : 1 means there's non dc coefficients for block y2
47                 bit 3 : 1 means there's non dc coefficients for block y3
48                 bit 4 : 1 means there's non dc coefficients for block cb
49                 bit 5 : 1 means there's non dc coefficients for block cr
50                 bit 6 : 1 means there's a quantization value following this code
51                 bit 7 : Always 1 to avoid a zero byte
52                 
53         Then comes a differential value for the quantization (2 bits)
54                 00 : -1
55                 01 : -2
56                 10 :  1
57                 11 :  2
58         
59
60 Block layer
61
62         Codes used for uvlc encoding
63
64  1/ Run encoding
65  
66   coarse | additional | size |   value of run      | length of run
67        1 |            |   1  |                  0  |       1
68       01 |            |   2  |                  1  |       1
69      001 | x          |   4  |     x +  2   (2:3)  |       2
70     0001 | xx         |   6  |    xx +  4   (4:7)  |       3
71    00001 | xxx        |   8  |   xxx +  8  (8:15)  |       4
72   000001 | xxxx       |  10  |  xxxx + 16 (16:31)  |       5
73  0000001 | xxxxx      |  12  | xxxxx + 32 (32:63)  |       6
74
75  2/ Level encoding
76
77    coarse | additional | size | value of level | length of level
78         1 | s          |   2  |              1 |       1
79        01 |            |   2  |            EOB |
80       001 | xs         |   5  |         x +  2 |       2
81      0001 | xxs        |   7  |        xx +  4 |       3
82     00001 | xxxs       |   9  |       xxx +  8 |       4
83    000001 | xxxxs      |  11  |      xxxx + 16 |       5
84   0000001 | xxxxxs     |  13  |     xxxxx + 32 |       6
85  00000001 | xxxxxxs    |  15  |    xxxxxx + 64 |       7
86
87  (s stands for sign)
88
89 End of Picture header
90
91         A picture ends alwways with a code 0000 0000 0000 0000 1111 11 that is byte aligned and 22 bytes long
92