From 0f9551cdb6a764780c56dcddefbe52671acaa8d5 Mon Sep 17 00:00:00 2001 From: Monty Date: Tue, 19 Feb 2008 10:37:19 +0000 Subject: [PATCH] Fix trac 1169: make it clear that the granpos refers to the last completed, returned sample, not an internal sample awaiting lapping. svn path=/trunk/vorbis/; revision=14530 --- doc/Vorbis_I_spec.html | 22 +++++++++++++++------- doc/xml/a1-encapsulation_ogg.xml | 22 +++++++++++++++++----- 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/doc/Vorbis_I_spec.html b/doc/Vorbis_I_spec.html index e6bac66..87d5213 100644 --- a/doc/Vorbis_I_spec.html +++ b/doc/Vorbis_I_spec.html @@ -1254,7 +1254,7 @@ bitstream octet first):

This is actually somewhat easier to describe in code; implementation of the above can be found in vorbis/lib/info.c, _vorbis_pack_comment() and _vorbis_unpack_comment().

6. Floor type 0 setup and decode

- $Id: 06-floor0.xml 10424 2005-11-23 08:44:18Z xiphmont $ + $Id: 06-floor0.xml 14529 2008-02-19 10:15:13Z xiphmont $

6.1. Overview

Vorbis floor type zero uses Line Spectral Pair (LSP, also alternately known as Line Spectral Frequency or LSF) representation to encode a @@ -2215,13 +2215,21 @@ Ogg encapsulation of a Vorbis packet stream is straightforward.

completed on that page. - A page that is entirely spanned by a single packet (that completes on a - subsequent page) has no granule position, and the granule position is - set to '-1'.
  • + The granule position of a page represents the end PCM sample + position of the last packet completed on that + page. The 'last PCM sample' is the last complete sample returned by + decode, not an internal sample awaiting lapping with a + subsequent block. A page that is entirely spanned by a single + packet (that completes on a subsequent page) has no granule + position, and the granule position is set to '-1'.

    + Note that the last decoded (fully lapped) PCM sample from a packet + is not necessarily the middle sample from that block. If, eg, the + current Vorbis packet encodes a "long block" and the next Vorbis + packet encodes a "short block", the last decodable sample from the + current packet be at position (3*long_block_length/4) - + (short_block_length/4). +

  • The granule (PCM) position of the first page need not indicate that the stream started at position zero. Although the granule position belongs to the last completed packet on the page and a diff --git a/doc/xml/a1-encapsulation_ogg.xml b/doc/xml/a1-encapsulation_ogg.xml index 51e2681..676b983 100644 --- a/doc/xml/a1-encapsulation_ogg.xml +++ b/doc/xml/a1-encapsulation_ogg.xml @@ -134,11 +134,23 @@ Ogg encapsulation of a Vorbis packet stream is straightforward. The granule position of a page represents the end PCM sample - position of the last packet completed on that page. - A page that is entirely spanned by a single packet (that completes on a - subsequent page) has no granule position, and the granule position is - set to '-1'. - + position of the last packet completed on that + page. The 'last PCM sample' is the last complete sample returned by + decode, not an internal sample awaiting lapping with a + subsequent block. A page that is entirely spanned by a single + packet (that completes on a subsequent page) has no granule + position, and the granule position is set to '-1'. + + + Note that the last decoded (fully lapped) PCM sample from a packet + is not necessarily the middle sample from that block. If, eg, the + current Vorbis packet encodes a "long block" and the next Vorbis + packet encodes a "short block", the last decodable sample from the + current packet be at position (3*long_block_length/4) - + (short_block_length/4). + + + -- 2.7.4