From: Monty Date: Fri, 19 Jul 2002 04:54:24 +0000 (+0000) Subject: Plow changes into CVS X-Git-Tag: v1.3.3~686 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e084bfcb566a374f246bb555af532f506d2ba8d1;p=platform%2Fupstream%2Flibvorbis.git Plow changes into CVS svn path=/trunk/vorbis/; revision=3668 --- diff --git a/doc/vorbis-spec-ref.html b/doc/vorbis-spec-ref.html index e8d53ba..60d97e2 100644 --- a/doc/vorbis-spec-ref.html +++ b/doc/vorbis-spec-ref.html @@ -14,7 +14,10 @@ This document serves as the top-level reference document for the bit-by-bit decode specification of Vorbis I. This document assumes a high-level understanding of the Vorbis decode process, which is provided in the document Ogg Vorbis I -format specification: introduction and description. +format specification: introduction and description. Ogg Vorbis I format specification: +bitpacking convention covers reading and writing bit fields from +and to bitstream packets.

Header decode and decode setup

@@ -25,6 +28,21 @@ end-of-packet condition during decoding the first or third header packet renders the stream undecodable. End-of-packet decoding the comment header is a non-fatal error condition.

+

Common header decode

+ +Each header packet begins with the same header fields + +
+  1) [packet_type] : 8 bit value
+  2) 0x76, 0x6f, 0x72, 0x62, 0x69, 0x73: the characters 'v','o','r','b','i','s' as six octets
+
+ +Decode continues according to packet type; the identification header +is type 1, the comment header type 3 and the setup header type 5 +(these types are all odd as a packet with a leading single bit of '0' +is an audio packet). The packets must occur in the order of +identification, comment, setup. +

Identification Header

The identification header is a short header of only a few fields used @@ -32,10 +50,25 @@ to declare the stream definitively as Vorbis, and provide a externally relevant pieces of information about the audio stream. The identification header is coded as follows:

-

    -
  1. - - +
    + 1) [vorbis_version] = read 32 bits as unsigned integer
    + 2) [audio_channels] = read 8 bit integer as unsigned
    + 3) [audio_sample_rate] = read 32 bits as unsigned integer
    + 4) [bitrate_maximum] = read 32 bits as unsigned integer
    + 5) [bitrate_nominal] = read 32 bits as unsigned integer
    + 6) [bitrate_lower] = read 32 bits as unsigned integer
    + 7) [blocksize_0] = 2 exponent (read 4 bits as unsigned integer)
    + 8) [blocksize_1] = 2 exponent (read 4 bits as unsigned integer)
    + 9) [framing_flag] = read one bit
    +
    + +[vorbis_version] is to read '0' in order to be compatable +with this docuement. Both [audio_channels] and +[audio_rate] must read greater than zero. Allowed final +blocksize values are 64, 128, 256, 512, 1024, 2048, 4096 and 8192 in +Vorbis I. [blocksize_0] must be less than or equal to +[blocksize_1]. The framing bit must be nonzero. Failure to +meet any of these conditions renders a stream undecodable.

    Comment Header

    @@ -45,8 +78,135 @@ and header specification.

    Setup Header

    +Vorbis codec setup is configurable to an extreme degree:

    + +

    + +The setup header contains the bulk of the codec setup information +needed for decode. The setup header contains, in order, the lists of +codebook configurations, time-domain transform configurations +(placeholders in Vorbis I), floor configurations, residue +configurations, channel mappping configurations and mode +configurations. It finishes with a framing bit of '1'. Header decode +proceeds in the following order:

    + +

    codebooks

    + +
      +
    1. [vorbis_codebook_count] = read eight bits as unsigned integer and add one +
    2. Decode [vorbis_codebook_count] codebooks in order as defined +in the codebook specification +document. Save each configuration, in order, in an array of +codebook configurations [vorbis_codebook_configurations]. +
    + +

    time domain transforms

    + +These hooks are placeholders in Vorbis I. Nevertheless, the +configuration placeholder values must be read to maintain bitstream +sync.

    + +

      +
    1. [vorbis_time_count] = read 6 bits as unsigned integer and add one +
    2. read [vorbis_time_count] 16 bit values; each value should be zero. If any othe values is nonzero, this is an error condition and the stream is undecodable. +
    + +

    floors

    + +Vorbis uses two floor type; header decode is handed to the decode +abstraction of the appropriate type. + +
      +
    1. [vorbis_floor_count] = read 6 bits as unsigned integer and add one +
    2. For each of [vorbis_floor_count] floor numbers: +
        +
      1. read the floor type; vector [vorbis_floor_types] element [i] = read 16 bits as unsigned integer +
      2. If the floor type is zero, decode the floor configuration as defined in the floor type 0 specification document; save this configuration in slot [i] of the floor configuration array [vorbis_floor_configurations]. +
      3. If the floor type is one, decode the floor configuration as defined in the floor type 1 specification document; save this configuration in slot [i] of the floor configuration array [vorbis_floor_configurations]. +
      4. If the the floor type is greater than one, this stream is undecodable; ERROR CONDITION +
      +
    + +

    residues

    + +Vorbis uses three residue types; header decode of each type is identical. + +
      +
    1. [vorbis_residue_count] = read 6 bits as unsigned integer and add one +
    2. For each of [vorbis_residue_count] residue numbers: +
        +
      1. read the residue type; vector [vorbis_residue_types] element [i] = read 16 bits as unsigned integer +
      2. If the residue type is zero, one or two, decode the residue configuration as defined in the residue specification document; save this configuration in slot [i] of the residue configuration array [vorbis_residue_configurations]. +
      3. If the the residue type is greater than two, this stream is undecodable; ERROR CONDITION +
      +
    + +

    mappings

    + +Mappings are used to set up specific pipelines for encoding +multichannel audio with varying channel mapping applications. Vorbis I +uses a single mapping type (0), with implicit PCM channel mappings.

    + +

      +
    1. [vorbis_mapping_count] = read 6 bits as unsigned integer and add one

      +

    2. For each [i] of [vorbis_mapping_count] mapping numbers:

      +

        +
      1. read the mapping type: 16 bits as unsigned integer. There's no reason to save the mapping type in Vorbis I.

        +

      2. If the mapping type is nonzero, the stream is undecodable

        +

      3. If the mapping type is zero:

        +

        1. read 1 bit as a boolean flag

          +

          1. if set, [vorbis_mapping_submaps] = read 4 bits as unsigned integer and add one

            +

          2. if unset, [vorbis_mapping_submaps] = 1

            +

          +
        2. read 1 bit as a boolean flag; if set, square polar channel mapping is in use:

          +

          1. [vorbis_mapping_coupling_steps]= read 8 bits as unsigned int and add one

            +

          2. for [j] each of [vorbis_mapping_coupling_steps] steps:

            +

              +
            1. vector [vorbis_mapping_magnitude] element [j]= read ilog([audio_channels]) bits as unsiged integer

              +

            2. vector [vorbis_mapping_angle] element [j]= read ilog([audio_channels]) bits as unsiged integer

              +

            3. the numbers read in the above two steps are channel numbers representing the channel to treat as magnitude and the channel to treat as angle, respectively. If any of angle channel equals magnitud channel, magnitude channel is greater than [audio_channels]-1, or angle channel is greater than [audio_channels]-1, the stream is undecodable.

              +

            +
          +
        3. read 2 bits (reserved field); if the value is nonzero, the stream is undecodable

          +

        4. if [vorbis_mapping_submaps] is greater than one, we read channel multiplex settings. For each [j] of [audio_channels] channels:

          +

          1. vector [vorbis_mapping_mux] element [j] = read 4 bits as unsigned integer

            +

          2. if the value is greater than the highest numbered submap, this in an error condition rendering the stream undecodable

            +

          +
        5. for each submap [j] of [vorbis_mapping_submaps] submaps, read the floor and residue numbers for use in decoding that submap: +
          1. read and discard 8 bits (the unused time configuration placeholder)

            +

          2. read 8 bits as unsigned integer for the floor number; save in vector [vorbis_mapping_submap_floor] element [j]

            +

          3. verify the floor number is not greater than the highest number floor configured for the bitstream. If it is, the bitstream is undecodable

            +

          4. read 8 bits as unsigned integer for the residue number; save in vector [vorbis_mapping_submapping_residue] element [j]

            +

          5. verify the residue number is not greater than the highest number residue configured for the bitstream. If it is, the bitstream is undecodable

            +

          + + +
        6. save this mapping configuration in slot [i] of the mapping configuration array [vorbis_mapping_configurations]. + +
        +
      +
    + +

    modes

    + +
      +
    1. [vorbis_mode_count] = read 6 bits as unsigned integer and add one +
    2. For each of [vorbis_mode_count] mode numbers: +
        +
      1. [vorbis_mode_blockflag] = read 1 bit

        +

      2. [vorbis_mode_windowtype] = read 16 bits as unsigned integer

        +

      3. [vorbis_mode_transformtype] = read 16 bits as unsigned integer

        +

      4. [vorbis_mode_mapping] = read 8 bits as unsigned integer

        +

      5. verify ranges; zero is the only legal value in Vorbis I for [vorbis_mode_windowtype] and [vorbis_mode_transformtype]. [vorbis_mode_mapping] must not be greater than the highest number mapping in use. Any illegal values render the stream undecodable.

        +

      +
    3. read 1 bit as a framing flag. If unset, a framing error occurred and the stream is not decodable. + +

    + +After reading mode descriptions, setup header decode is complete.

    + +

    Packet decode

    -

    mapping 0

    channel order

    @@ -67,9 +227,6 @@ mapping as seen fit. Future channel mappings (such as three and four channel Ambisonics) will make use of channel mappings other than mapping 0. -

    Packet decode

    - -