Chris@1: Chris@1: Chris@1:
Chris@1:Vorbisfile documentation |
Chris@1: vorbisfile version 1.3.2 - 20101101 |
Chris@1:
Crosslapping blends two samples together using a window function, Chris@1: such that any sudden discontinuities between the samples that may Chris@1: cause clicks or thumps are eliminated or blended away. The technique Chris@1: is nearly identical to how Vorbis internally splices together frames Chris@1: of audio data during normal decode. API functions are provided to crosslap transitions between seperate Chris@1: streams, or to crosslap when seeking within Chris@1: a single stream. Chris@1: Chris@1:
Vorbis is a lossy compression format such that any compressed Chris@1: signal is at best a close approximation of the original. The Chris@1: approximation may be very good (ie, indistingushable to the human Chris@1: ear), but it is an approximation nonetheless. Even if a sample or set Chris@1: of samples is contructed carefully such that transitions from one to Chris@1: another match perfectly in the original, the compression process Chris@1: introduces minute amplitude and phase errors. It's an unavoidable Chris@1: result of such high compression rates. Chris@1: Chris@1:
If an application transitions instantly from one sample to another, Chris@1: any tiny discrepancy introduced in the lossy compression process Chris@1: becomes audible as a stairstep discontinuity. Even if the discrepancy Chris@1: in a normal lapped frame is only .1dB (usually far below the Chris@1: threshhold of perception), that's a sudden cliff of 380 steps in a 16 Chris@1: bit sample (when there's a boundary with no lapping). Chris@1: Chris@1:
It is. Vorbis introduces no extra samples at the beginning or end Chris@1: of a stream, nor does it remove any samples. Gapless encoding Chris@1: eliminates 99% of the click, pop or outright blown speaker that would Chris@1: occur if boundaries had gaps or made no effort to align Chris@1: transitions. However, gapless encoding is not enough to entirely Chris@1: eliminate stairstep discontinuities all the time for exactly the Chris@1: reasons described above. Chris@1: Chris@1:
Frame lapping, like Vorbis performs internally during continuous Chris@1: playback, is necessary to eliminate that last epsilon of trouble. Chris@1: Chris@1:
Ideally, vorbisfile internally reads an extra frame of audio from Chris@1: the old stream/position to perform lapping into the new Chris@1: stream/position. However, automagic crosslapping works properly even Chris@1: if the old stream/position is at EOF. In this case, the synthetic Chris@1: post-extrapolation generated by the encoder to pad out the last block Chris@1: with appropriate data (and avoid encoding a stairstep, which is Chris@1: inefficient) is used for crosslapping purposes. Although this is Chris@1: synthetic data, the result is still usually completely unnoticable Chris@1: even in careful listening (and always preferable to a click or pop). Chris@1: Chris@1:
Vorbisfile will lap between streams of differing numbers of Chris@1: channels. Any extra channels from the old stream are ignored; playback Chris@1: of these channels simply ends. Extra channels in the new stream are Chris@1: lapped from silence. Vorbisfile will also lap between streams links Chris@1: of differing sample rates. In this case, the sample rates are ignored Chris@1: (no implicit resampling is done to match playback). It is up to the Chris@1: application developer to decide if this behavior makes any sense in a Chris@1: given context; in practical use, these default behaviors perform Chris@1: sensibly. Chris@1: Chris@1:
To acheive the best possible crosslapping results, avoid the case Chris@1: where synthetic extrapolation data is used for crosslapping. That is, Chris@1: design loops and samples such that a little bit of data is left over Chris@1: in sample A when seeking to sample B. Normally, the end of sample A Chris@1: and the beginning of B would overlap exactly; this allows Chris@1: crosslapping to perform exactly as it would within vorbis when Chris@1: stitching audio frames together into continuous decoded audio. Chris@1: Chris@1:
The optimal amount of overlap is half a short-block, and this
Chris@1: varies by compression mode. Each encoder will vary in exact block
Chris@1: size selection; for vorbis 1.0, for -q0 through -q10 and 44kHz or
Chris@1: greater, a half-short block is 64 samples.
Chris@1:
Chris@1:
Chris@1:
copyright © 2000-2010 Xiph.Org |
Chris@1: Chris@1: |
Vorbisfile documentation |
Chris@1: vorbisfile version 1.3.2 - 20101101 |
Chris@1: