Changes between Version 29 and Version 30 of SV8Specification


Ignore:
Timestamp:
02/15/07 01:41:26 (17 years ago)
Author:
zorg
Comment:

Mostly Cosmetics, extract RG from SH

Legend:

Unmodified
Added
Removed
Modified
  • SV8Specification

    v29 v30  
    22= SV8 specification draft =
    33
    4 Nota : All fields, unless explicitely specified otherwise are read and written in Big-Endian order, independently of the underlying architecture.
     4Nota : All fields, unless explicitely specified otherwise are read and written in Big-Endian order.
    55
    66== File magic number ==
    77
    88Magic number is on 32bits and is equal to 'MPCK' or 0x4D50434B[[BR]]
    9 New value so old decoders will happily skip such files.
    109
    11 == Block formatting ==
     10== Packet formatting ==
    1211
    13 All blocks are formated using Key / Length / Value.[[BR]]
    14 Key is 16 bits long. It's the block ID.[[BR]]
    15 Length is a variable size field using the same values as [http://svn.mplayerhq.hu/mplayer/trunk/DOCS/tech/nut.txt?view=markup nut] :[[BR]]
     12All packets are formatted using Key / Size / Payload.[[BR]]
     13Keys are 16 bits long. It's equivalent to the packet ID or type.[[BR]]
     14Size is a variable-size field using the same values as [http://svn.mplayerhq.hu/mplayer/trunk/DOCS/tech/nut.txt?view=markup nut] :[[BR]]
    1615{{{
    1716bits, big-endian
     
    2322}}}
    2423
    25 The length is the size of the block in bytes, including the key and size fields. So the minimum length of a block is 3 bytes.[[BR]]
    26 The value is the block content. Its size can be 0.[[BR]]
    27 All unused bits in a block MUST be 0.[[BR]]
     24Size defines the packet length in bytes, including the Key and Size fields. So the minimum length of a block is 3 bytes.[[BR]]
     25The payload is the actual packet data. Its size can be null.[[BR]]
     26All unused bits in a packet MUST be null.[[BR]]
    2827
    29 || '''Field''' || '''length (bits)''' || '''Value''' ||
     28|| '''Field''' || '''Size (bits)''' || '''Payload''' ||
    3029|| Key || 16 || "EX" ||
    31 || Length || n*8; 0 < n < 10 || 0x1A ||
    32 || Value || Length * 8 || "example" ||
     30|| Size || n*8; 0 < n < 10 || 0x1A ||
     31|| Payload || Size * 8 || "example" ||
    3332
    3433
    35 == Summary of reserved block keys ==
     34== Summary of reserved packet keys ==
    3635
    37 || '''Block name''' || '''Key''' || '''Mandatory''' ||
    38 || Stream information || SI || yes ||
    39 || Encoder information || EI || no ||
    40 || Audio data || AD || yes ||
    41 || Seek Pointer || SP || no ||
     36|| '''Packet Name''' || '''Key''' || '''Mandatory''' ||
     37|| Stream Header || SH || yes ||
     38|| Replaygain || RG || yes ||
     39|| Encoder Info || EI || no ||
     40|| Edition || ED || no ||
     41|| Seek Table Offset || SO || no ||
     42|| Audio Packet || AP || yes ||
    4243|| Seek Table || ST || no ||
    43 || Edition || ED || no ||
    4444|| Stream End || SE || yes ||
    4545
    46 == Stream information block ==
     46== Stream Header Packet ==
    4747
    48 This block key is "SI".[[BR]]
    49 This block contains the informations needed to decode the stream. This block is mandatory and must be written before the first audio block.[[BR]]
     48This packet key is "SI".[[BR]]
     49It contains the informations needed to decode the stream. This block is mandatory and must be written before the first audio packet.[[BR]]
    5050
    51 || '''Field''' || '''length (bits)''' || '''Value''' || '''comment''' ||
     51|| '''Field''' || '''Size (bits)''' || '''Payload''' || '''Comment''' ||
    5252|| CRC || 32 ||  || CRC 32 of the block (this field excluded). 0 = invalid ||
    53 || Info length || n*8; 0 < n < 10 ||  || length (in bytes) from this field (included) to the ReplayGain version field ||
    54 || Stream version || 8 || 8 || bitstream version ||
    55 || Sample count || n*8; 0 < n < 10 ||  || number of samples in the stream. 0 = unknow ||
    56 || Sample frequency || 3 || 0..7 || see table below ||
    57 || Channel count || 4 || 1..16 || number of channels in the stream ||
    58 || Max used bands || 5 || 1..32 || maximum number of bands used in the file ||
    59 || MS used || 1 ||  || MidSideStereo ||
    60 || Audio block frames || 3 || 0..7 || number of frames in an audio block is : 4^Value^ (1..16384) ||
    61 || ReplayGain version || 8 ||  || The replay gain version - must be aligned on a byte - ||
    62 || Title gain || 16 ||  || The loudness calculated for the title, ''and not the gain that the player must apply'' ||
    63 || Title peak || 16 ||  ||  ||
    64 || Album gain || 16 ||  || The loudness calculated for the album ||
    65 || Album peak || 16 ||  ||  ||
     53|| Stream version || 8 || 8 || Bitstream version ||
     54|| Sample count || n*8; 0 < n < 10 ||  || Number of samples in the stream. 0 = unknown ||
     55|| Sample frequency || 3 || 0..7 || See table below ||
     56|| Channel count || 4 || 1..16 || Number of channels in the stream ||
     57|| Max used bands || 5 || 1..32 || Maximum number of bands used in the file ||
     58|| MS used || 1 ||  || True if Mid Side Stereo is enabled ||
     59|| Audio block frames || 3 || 0..7 || Number of frames per audio packet (4^value=(1..16384)) ||
    6660
    6761Do we need to specify the channel position ? Is there standard positions / order of the channels ?
     
    7670The CRC used is this one : [http://www.w3.org/TR/PNG/#D-CRCAppendix http://www.w3.org/TR/PNG/#D-CRCAppendix].
    7771
     72== Replaygain Packet ==
     73
     74This packet key is "RG".[[BR]]
     75It contains the necessary data needed to apply replaygain on the current stream. This packet is mandatory and must be written before the first audio packet.[[BR]]
     76
     77|| '''Field''' || '''Size (bits)''' || '''Payload''' || '''Comment''' ||
     78|| ReplayGain version || 8 ||  || The replay gain version - must be aligned on a byte - ||
     79|| Title gain || 16 ||  || The loudness calculated for the title, ''and not the gain that the player must apply'' ||
     80|| Title peak || 16 ||  ||  ||
     81|| Album gain || 16 ||  || The loudness calculated for the album ||
     82|| Album peak || 16 ||  ||  ||
     83
    7884The replay gain values are stored in dB in Q8.8 format (maybe Q7.9 or relative to the max value for the bitdepth is better ?).[[BR]]
    7985
     86== Encoder Info Packet ==
    8087
    81 == Encoder infomations ==
     88This packet key is "EI".[[BR]]
    8289
    83 This block key is "EI".
    84 
    85 || '''Field''' || '''length (bits)''' || '''Value''' || '''comment''' ||
    86 || profile used || 7 || 0..15.875 || quality in 4.3 format ||
    87 || PNS used || 1 ||  ||  ||
    88 || MajorNumber || 4 ||  ||  ||
    89 || MinorNumber || 8 ||  || even = release, odd = unstable ||
    90 || Implementation || 4 ||  ||  ||
    91 || Build || 8 ||  ||  ||
    92 
    93 == Audio data block ==
    94 
    95 This block key is "AD".[[BR]]
    96 This block contains audio frames. The first frame is a key frame.[[BR]]
    97 
    98 || '''Field''' || '''length (bits)''' || '''Value''' || '''comment''' ||
    99 || audio frames || ? ||  || n (or less if last block) frames of audio data as defined in SI block ||
     90|| '''Field''' || '''Size (bits)''' || '''Payload''' || '''Comment''' ||
     91|| Profile || 7 || 0..15.875 || quality in 4.3 format ||
     92|| PNS tool || 1 || True if enabled ||  ||
     93|| Major || 8 || 1 || Major version ||
     94|| Minor || 8 || 17 || Minor version, even numbers for stable version, odd when unstable ||
     95|| Build || 8 || 3 || Build ||
    10096
    10197
    102 == Seek Pointer Block ==
     98== Edition Packet ==
    10399
    104 This block key is "SP".[[BR]]
    105 This block contains a pointer to the seek table block.
    106 || '''Field''' || '''length (bits)''' || '''Value''' || '''comment''' ||
    107 || pointer || n*8; 0 < n < 10 ||  || number of bytes from this block header to the "ST" block header ||
     100This packet key is "ED"[[BR]]
     101The SV8 stream allow only to start decoding on first packet frame, so cutting the stream require to cut on packet boundaries. This packet
     102provides more precise cutting possibilities.[[BR]]
     103This packet must be written before the first audio packet.
    108104
    109 == Seek Table Block ==
     105|| '''Field''' || '''Size (bits)''' || '''Payload''' || '''Comment''' ||
     106|| Beginning silence || n*8; 0 < n < 10 ||  || Number of samples to skip at the beginning of the stream ||
     107|| End silence || n*8; 0 < n < 10 ||  || Number of samples to skip at the end of the stream ||
    110108
    111 This block key is "ST".[[BR]]
    112109
    113 || '''Field''' || '''length (bits)''' || '''Value''' || '''comment''' ||
    114 || Seek Count || n*8; 0 < n < 10 ||  || number of seek elements in this table ||
    115 || Seek Distance || 4 || 0..15 || distance between referenced blocks = 2^Value^ ||
    116 || Seek Datas || ? ||  ||  ||
     110== Seek Table Offset Packet ==
    117111
    118 Format of seek datas :[[BR]]
     112This packet key is "SO".[[BR]]
     113It contains an offset to the seek table packet.
    119114
    120 - The reference for the seek offset is the musepack magic number[[BR]]
    121 - The first 2 values are stored using the same code as the block length code.[[BR]]
    122 - The next values are coded as :[[BR]]
     115|| '''Field''' || '''Size (bits)''' || '''Payload''' || '''Comment''' ||
     116|| Offset || n*8; 0 < n < 10 ||  || Offset from this packet to the seek table packet ||
     117
     118
     119== Audio Packet ==
     120
     121This packet key is "AP".[[BR]]
     122It contains audio frames. The first frame is a key frame.[[BR]]
     123
     124|| '''Field''' || '''Size (bits)''' || '''Payload''' || '''Comment''' ||
     125|| Audio Frames || ? ||  || n (or less if last packet) frames of audio as defined in SH packet ||
     126
     127
     128== Seek Table Packet ==
     129
     130This packet key is "ST".[[BR]]
     131
     132|| '''Field''' || '''Size (bits)''' || '''Payload''' || '''Comment''' ||
     133|| Seek Count || n*8; 0 < n < 10 ||  || Number of seek elements in this table ||
     134|| Seek Distance || 4 || 0..15 || Distance between referenced blocks = 2^Value^ ||
     135|| Seek Data || ? ||  ||  ||
     136
     137Format of seek data :[[BR]]
     138
     139- Reference offset for seeking is the musepack magic number[[BR]]
     140- First 2 values are stored using the same code as the packet size code.[[BR]]
     141- Next values are coded as :[[BR]]
    123142{{{
    124143code = value(n) - 2*value(n-1) + value(n-2)
     
    130149
    131150
    132 == Security Block ==
     151== Security Packet ==
    133152
    134153Checksum (MD5, SHA1) or error correcting code (LDPC).[[BR]]
    135154To be defined later. May be better to keep security features external only.
    136155
    137 == Edition Block ==
    138156
    139 The SV8 stream allow only to start decoding on first block frame, so cutting the stream require to cut on block boundaries. This block
    140 provides more precise cutting possibilities.[[BR]]
    141 This block must be written before the first audio block.[[BR]]
    142 This block key is "ED"[[BR]]
     157== Stream End Packet ==
    143158
    144 || '''Field''' || '''length (bits)''' || '''Value''' || '''comment''' ||
    145 || Beginning silence || n*8; 0 < n < 10 ||  || number of samples to skip at the beginning of the stream ||
    146 || End silence || n*8; 0 < n < 10 ||  || number of samples to skip at the end of the stream ||
     159This packet key is "SE".[[BR]]
     160Recommended packet size is 3 bytes.[[BR]]
     161This packet is mandatory and must be the last stream packet. Tags, if present, must be written after this packet.
    147162
    148 == End Block ==
    149 
    150 This block key is "SE".[[BR]]
    151 The recommanded block lenth is 3 bytes.[[BR]]
    152 This block is mandatory and must be the last block of the stream. Tags are written after this block.
    153163
    154164== Streaming ==
    155165
    156 This file format can be used for streaming. The "SI" block is used as synchronization marker. The decoder will scan for a "SI" block and check the block CRC. Once the decoder is synchronized, it will start decoding. It's up to the streaming server to choose when to send "SI" block.[[BR]]
    157 There is currently no way to send tags during playback. This must be changed (a tag block ?).
     166This file format can be used for streaming. The "SH" block is (can?) used as synchronization marker. The decoder will scan for a "SH" block and check its CRC. Once the decoder is synchronized, it will start decoding. It's up to the streaming server to choose when to send "SH" block.[[BR]]
     167There is currently no way to send tags during playback. This must be changed (a tag packet ?).
     168
    158169
    159170== Tags ==
    160171
    161 No block must be written after the end block to allow tagging by other applications.[[BR]]
     172No packet must be written after the stream end packet to allow tagging by other applications.[[BR]]
    162173Remarks about tagging? Incompatibilities?[[BR]]