[Matroska-devel] Reference and the disc space they waste

Alexander Noé alexander.noe at s2001.tu-chemnitz.de
Sat Nov 1 10:57:04 CET 2003


The current way you store references wastes space:
  { <reference> <size> <timecode> }

This means at least 3 bytes per references = 6 bytes for a b-frame. With 
an average block overhead of 10 bytes, those are 16 bytes of overhead 
per frame, equal to an AVI file.

2 Bytes could be saved if you allowed several references inside one 
<reference> element, like
{ <reference> <total size> { <timecodes xiph-lacing encoded }}

This gain is not too much, but you know, the goal is to make OGM have 
10x more overhead than Matroska for my testfile #3 :p

Someone just needs to find a good way to encode signed ints with 
xiph-encoding.
(EBML encoding would often waste one byte). Maybe the first byte of each
reference should be signed.

Example:
0x7E      =  126
0x7F 0x00 =  127
0x7F 0x01 =  128
0x7F 0x02 =  129
...

0x01      =    1
0x00      =    0
0xFF      =   -1
0xFE      =   -2
...
0x81      = -127
0x80 0x00 = -128
0x80 0x01 = -129

If you put 2 B-frames between 2 P-frames, which is not unusual, you 
won't leave the range between 126 and -127, meaning that the timecodes 
of 2 refered frames could be encoded with
<reference = 1 byte> <size = 1 byte> <timecodes = 1 byte each> = 4 bytes 
instead of 6

What do you think?


Alex




More information about the Matroska-devel mailing list