1 UVLC File Specification
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)
12 Then comes the picture resolution which is used in combination with the picture's format (3 bits)
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)
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)
25 Picture header is at least 67 bits long
27 Group of Blocks Header
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.
34 Then comes the quantizer's reference for the GOB that ranges from 1 to 31 (5 bits)
36 Group of Blocks Header is at least 27 bits long
40 Coded Macroblock bit (1 bit)
41 bit 0 : 1 means there's a macoblock, 0 means macroblock is all zero
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
53 Then comes a differential value for the quantization (2 bits)
62 Codes used for uvlc encoding
66 coarse | additional | size | value of run | length of run
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
77 coarse | additional | size | value of level | length of level
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
91 A picture ends alwways with a code 0000 0000 0000 0000 1111 11 that is byte aligned and 22 bytes long