| 1 |
/* Copyright (C) 2008 Vincent Penquerc'h. |
| 2 |
This file is part of the Kate codec library. |
| 3 |
Written by Vincent Penquerc'h. |
| 4 |
|
| 5 |
Use, distribution and reproduction of this library is governed |
| 6 |
by a BSD style source license included with this source in the |
| 7 |
file 'COPYING'. Please read these terms before distributing. */ |
| 8 |
|
| 9 |
|
| 10 |
/** |
| 11 |
|
| 12 |
\page granule Granule encoding |
| 13 |
|
| 14 |
Ogg leaves the encoding of granules up to a particular codec, only |
| 15 |
mandating that granules be non decreasing with time. |
| 16 |
|
| 17 |
The Kate bitstream format uses a linear mapping between time and |
| 18 |
granule, described here. |
| 19 |
|
| 20 |
A Kate granule position is composed of two different parts: |
| 21 |
- a base granule, in the high bits |
| 22 |
- a granule offset, in the low bits |
| 23 |
|
| 24 |
\verbatim |
| 25 |
+----------------+----------------+ |
| 26 |
| base | offset | |
| 27 |
+----------------+----------------+ |
| 28 |
\endverbatim |
| 29 |
|
| 30 |
The number of bits these parts occupy is variable, and each stream |
| 31 |
may choose how many bits to dedicate to each. The kate_info structure |
| 32 |
for a stream holds that information in the granule_shift field, |
| 33 |
so each part may be reconstructed from a granulepos. |
| 34 |
|
| 35 |
The kate_info structure for a stream also holds a rational fraction |
| 36 |
representing the time span of granule units. |
| 37 |
|
| 38 |
The granule rate is defined by the two fields: |
| 39 |
\code |
| 40 |
kate_info::gps_numerator |
| 41 |
kate_info::gps_denominator |
| 42 |
\endcode |
| 43 |
|
| 44 |
The number of bits reserved for the offset is defined by the field: |
| 45 |
\code |
| 46 |
kate_info::granule_shift |
| 47 |
\endcode |
| 48 |
|
| 49 |
*/ |
| 50 |
|