Peter Steele
2015-Mar-28 07:50 UTC
[Vorbis-dev] Building a new decoder - some questions on the spec (residue decode)
Hi
I am trying to build a new decoder in Java, I know there are a couple
of java decoders already but they don't implement the bit of the spec
I am having questions on
Question 1)
In section 8.6.2 it mentions
"However, it is also possible to set [residue_begin] and [residue_end]
to specify
a range partially or wholly beyond the maximum vector size. Before
beginning residue
decode, limit [residue_begin] and [residue_end] to the maximum
possible vector size
as follows."
The code segment then has
1) [actual\_size] = current blocksize/2;
2) if residue encoding is format 2
3) [actual\_size] = [actual\_size] * [ch];
4) [limit\_residue\_begin] = maximum of ([residue\_begin],[actual\_size]);
5) [limit\_residue\_end] = maximum of ([residue\_end],[actual\_size]);
In a real world vorbis file I see
residue_begin = 0;
residue_end = 256;
actual_size = 8;
following that code I would get
limit_residue_begin = 8
limit_residue_end = 256
Is this right? It feels wrong having an actual size of 8 yet the
difference of end-begin being 248.
Question 2)
Further down in 8.6.2 it has a line of code
18) if ([vqbook] is not ?unused?) {
Can someone tell me the full definition of 'unused' here? I have an
instance currently where the vqbook returned is not of type 1 or 2 so
doesn't have any vqvectors (The index returned from the
classifications was 0 which is the default up populated value from the
code in 8.6.1 which was retrieved in the header packet decode)
Many Thanks
Peter
Peter Steele
2015-Apr-03 10:39 UTC
[Vorbis-dev] Building a new decoder - some questions on the spec (residue decode)
I didn't hear anything from anybody but I have resolved the problem by looking through the libvorbis code. I did find that the specification document for residue decode is not 100% correct and that libvorbis does not implement it as it is written (from a logic perspective). The key differences being : 1) limit_residue_begin = residue_begin (does != max(residue_begin,actualSize)) 2) building classifications information has incorrect logic in the spec On Sat, Mar 28, 2015 at 7:50 AM, Peter Steele <steelehere at gmail.com> wrote:> Hi > > I am trying to build a new decoder in Java, I know there are a couple > of java decoders already but they don't implement the bit of the spec > I am having questions on > > Question 1) > > In section 8.6.2 it mentions > > "However, it is also possible to set [residue_begin] and [residue_end] > to specify > a range partially or wholly beyond the maximum vector size. Before > beginning residue > decode, limit [residue_begin] and [residue_end] to the maximum > possible vector size > as follows." > > The code segment then has > > 1) [actual\_size] = current blocksize/2; > 2) if residue encoding is format 2 > 3) [actual\_size] = [actual\_size] * [ch]; > 4) [limit\_residue\_begin] = maximum of ([residue\_begin],[actual\_size]); > 5) [limit\_residue\_end] = maximum of ([residue\_end],[actual\_size]); > > In a real world vorbis file I see > > residue_begin = 0; > residue_end = 256; > actual_size = 8; > > following that code I would get > > limit_residue_begin = 8 > limit_residue_end = 256 > > Is this right? It feels wrong having an actual size of 8 yet the > difference of end-begin being 248. > > Question 2) > > Further down in 8.6.2 it has a line of code > > 18) if ([vqbook] is not ?unused?) { > > Can someone tell me the full definition of 'unused' here? I have an > instance currently where the vqbook returned is not of type 1 or 2 so > doesn't have any vqvectors (The index returned from the > classifications was 0 which is the default up populated value from the > code in 8.6.1 which was retrieved in the header packet decode) > > Many Thanks > > Peter