Hi, From the vorbis decoder specification, it is clear that the decoder needs to have all the codebooks before decoding can actually begin. I will appreciate if someone can clear the following questions: 1. I guess the codebooks are derived from the actual input data. Probably the encoder may be making two passes through the input. The first pass finds out the frequency of different symbols and the second pass just replaces these symbols with the codewords. If the above is true: I wonder how vorbis encoder can be used for real-time data? Will it use some known codebooks or will it use someform of adaptive coding? Any help appreciated. Shashank
Shashank Khanvilkar wrote:> Hi, > > From the vorbis decoder specification, it is clear that the decoder > needs to have all the codebooks before decoding can actually begin. > I will appreciate if someone can clear the following questions: > > 1. I guess the codebooks are derived from the actual input data. > Probably the encoder may be making two passes through the input. The > first pass finds out the frequency of different symbols and the second > pass just replaces these symbols with the codewords. > If the above is true: > I wonder how vorbis encoder can be used for real-time data? Will it > use some known codebooks or will it use someform of adaptive coding? > > Any help appreciated. > ShashankLast I checked oggenc does not try to invent a codebook from the source audio but picks its codebook depending on the level of compression that's desired. So two files encoded with oggenc -q3 will have the same codebook. This is distinct from the huffman coding that's applied to the data afterwards. Clever people then try to invent better sounding codebooks. - Daniel Holth
On Fri, Aug 26, 2005 at 01:35:21PM -0500, Shashank Khanvilkar wrote:> 1. I guess the codebooks are derived from the actual input data. > Probably the encoder may be making two passes through the input. The > first pass finds out the frequency of different symbols and the second > pass just replaces these symbols with the codewords.It's certainly possible to write a two-pass encoder, but the one in libvorbis works in a single pass. The codebooks are tuned for general audio across many test files during development, and fixed per release. The encoder "chooses" a set of codebooks based on the target quality/bitrate and then just makes choices of which available mode to use for each block on the fly, I think with a 3 block look-ahead. So it's not adaptive in the usual sense in that the codebooks are fixed at the start. But emphasis on codebooks plural lets the encoder tailor mode choices from that fixed set to match particular input data and so encode in a single pass. Note that the look-ahead, and the generally long block sizes, and the latency of the Ogg container itself make vorbis a poor choice for interactive audio streams. But for "live" broadcast where a few seconds delay is in fact normal, it works great. Hope that helps, -r