diff options
author | Aki <please@ignore.pl> | 2021-09-29 22:52:49 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2021-09-29 22:52:49 +0200 |
commit | 74f4b1bc3b627ba4c7e03498234d88cacdfbe97b (patch) | |
tree | 197b5978d6e38f44069ea92583098a1da04aa635 /doc/vorbisfile/crosslap.html | |
download | starshatter-74f4b1bc3b627ba4c7e03498234d88cacdfbe97b.zip starshatter-74f4b1bc3b627ba4c7e03498234d88cacdfbe97b.tar.gz starshatter-74f4b1bc3b627ba4c7e03498234d88cacdfbe97b.tar.bz2 |
Squashed 'vorbis/' content from commit d22c3ab5f
git-subtree-dir: vorbis
git-subtree-split: d22c3ab5f633460abc2532feee60ca0892134cbf
Diffstat (limited to 'doc/vorbisfile/crosslap.html')
-rw-r--r-- | doc/vorbisfile/crosslap.html | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/doc/vorbisfile/crosslap.html b/doc/vorbisfile/crosslap.html new file mode 100644 index 0000000..9d28b0b --- /dev/null +++ b/doc/vorbisfile/crosslap.html @@ -0,0 +1,121 @@ +<html> + +<head> +<title>Vorbisfile - Sample Crosslapping</title> +<link rel=stylesheet href="style.css" type="text/css"> +</head> + +<body bgcolor=white text=black link="#5555ff" alink="#5555ff" vlink="#5555ff"> +<table border=0 width=100%> +<tr> +<td><p class=tiny>Vorbisfile documentation</p></td> +<td align=right><p class=tiny>vorbisfile version 1.3.2 - 20101101</p></td> +</tr> +</table> + +<h1>What is Crosslapping?</h1> + +<p>Crosslapping blends two samples together using a window function, +such that any sudden discontinuities between the samples that may +cause clicks or thumps are eliminated or blended away. The technique +is nearly identical to how Vorbis internally splices together frames +of audio data during normal decode. API functions are provided to <a +href="ov_crosslap.html">crosslap transitions between seperate +streams</a>, or to crosslap when <a href="seeking.html">seeking within +a single stream</a>. + +<h1>Why Crosslap?</h1> +<h2>The source of boundary clicks</h2> + +<p>Vorbis is a lossy compression format such that any compressed +signal is at best a close approximation of the original. The +approximation may be very good (ie, indistingushable to the human +ear), but it is an approximation nonetheless. Even if a sample or set +of samples is contructed carefully such that transitions from one to +another match perfectly in the original, the compression process +introduces minute amplitude and phase errors. It's an unavoidable +result of such high compression rates. + +<p>If an application transitions instantly from one sample to another, +any tiny discrepancy introduced in the lossy compression process +becomes audible as a stairstep discontinuity. Even if the discrepancy +in a normal lapped frame is only .1dB (usually far below the +threshhold of perception), that's a sudden cliff of 380 steps in a 16 +bit sample (when there's a boundary with no lapping). + +<h2>I thought Vorbis was gapless</h2> + +<p>It is. Vorbis introduces no extra samples at the beginning or end +of a stream, nor does it remove any samples. Gapless encoding +eliminates 99% of the click, pop or outright blown speaker that would +occur if boundaries had gaps or made no effort to align +transitions. However, gapless encoding is not enough to entirely +eliminate stairstep discontinuities all the time for exactly the +reasons described above. + +<p>Frame lapping, like Vorbis performs internally during continuous +playback, is necessary to eliminate that last epsilon of trouble. + +<h1>Easiest Crosslap</h1> + +The easiest way to perform crosslapping in Vorbis is to use the +lapping functions with no other extra effort. These functions behave +identically to when lapping isn't used except to provide +at-least-very-good lapping results. Crosslapping will not introduce +any samples into or remove any samples from the decoded audio; the +only difference is that the transition is lapped. Lapping occurs from +the current PCM position (either in the old stream, or at the position +prior to calling a lapping seek) forward into the next +half-short-block of audio data to be read from the new stream or +position. + +<p>Ideally, vorbisfile internally reads an extra frame of audio from +the old stream/position to perform lapping into the new +stream/position. However, automagic crosslapping works properly even +if the old stream/position is at EOF. In this case, the synthetic +post-extrapolation generated by the encoder to pad out the last block +with appropriate data (and avoid encoding a stairstep, which is +inefficient) is used for crosslapping purposes. Although this is +synthetic data, the result is still usually completely unnoticable +even in careful listening (and always preferable to a click or pop). + +<p>Vorbisfile will lap between streams of differing numbers of +channels. Any extra channels from the old stream are ignored; playback +of these channels simply ends. Extra channels in the new stream are +lapped from silence. Vorbisfile will also lap between streams links +of differing sample rates. In this case, the sample rates are ignored +(no implicit resampling is done to match playback). It is up to the +application developer to decide if this behavior makes any sense in a +given context; in practical use, these default behaviors perform +sensibly. + +<h1>Best Crosslap</h1> + +<p>To acheive the best possible crosslapping results, avoid the case +where synthetic extrapolation data is used for crosslapping. That is, +design loops and samples such that a little bit of data is left over +in sample A when seeking to sample B. Normally, the end of sample A +and the beginning of B would overlap exactly; this allows +crosslapping to perform exactly as it would within vorbis when +stitching audio frames together into continuous decoded audio. + +<p>The optimal amount of overlap is half a short-block, and this +varies by compression mode. Each encoder will vary in exact block +size selection; for vorbis 1.0, for -q0 through -q10 and 44kHz or +greater, a half-short block is 64 samples. + +<br><br> +<hr noshade> +<table border=0 width=100%> +<tr valign=top> +<td><p class=tiny>copyright © 2000-2010 Xiph.Org</p></td> +<td align=right><p class=tiny><a href="http://www.xiph.org/ogg/vorbis/">Ogg Vorbis</a></p></td> +</tr><tr> +<td><p class=tiny>Vorbisfile documentation</p></td> +<td align=right><p class=tiny>vorbisfile version 1.3.2 - 20101101</p></td> +</tr> +</table> + +</body> + +</html> |