Repository navigation
5 September 2026
So we know our first subband (Subband 0) is the value of 3. Then we run the rest of the bitstream through the Huffman tree until we find 13 more subbands from the previous subband value. We will not know how long each Huffman code will be, so we cannot determine how many bits it will take until we stop for the next step.
The remaining bits of the bitstream is thus:
100 10110001 01101001 00000100 10101001 00110010 00001111 11100100 00100110 11010001 11010110 01000001 11010100 01011010 10011000 01010010 00111111 01110110 01110110 01000110 01000010 10110000 00110110 01010010 01000011 11101011 10110110 00000111 11011010 10100011 00100001 00011000 11010111 10001111 01111100 00000111 11100010 10001011 00101011 10001010
So, for Subband 1 (the second Subband) we will walk the tree.
First bit to process is 1.
We start at Subband 1’s Huffman portion of the tree, at its relative node 0.
We see Subband 1’s Node 0 has the values of [1,2].
Since our bit is 1, we choose the right-side value, or rather 2.
This new value 2 becomes the node number we start looking with the next bit.
Our next bit is 0.
We look at Subband 1’s Node 2. We see Node 2 has values of [5,6].
Because our bit is 0, we choose the left-side value of 5.
This 5 becomes our next node to look at, and we move along with processing the next bit in the stream.
Our next bit is 0 again.
We go to Subband 1’s Node 5, which its values are [11,-12]. Because this Node’s array contains a negative number there is a possibility that we may stop. However, since our bit is 0, we carry on with the left-side value, Node 11.
Our next bit is 1.
We go to Subband’s Node 11 (from last bit) and we see that Node 11’s value is [0,13].
Since our bit is 1, we choose the right-side value, or the second value, which is 13.
Our next bit is 0.
We go to Subband 1’s Huffman Tree to Node 13 (from last bit) and see we get a value of [-3,-14]. Since both of the options are negative, we know that we will reach Subband 1’s energy difference (delta, or
Since our bit is 0, our delta is -3. We translate this negative into a positive, which is 3. This is the difference between Subband 0 and Subband 1.
To calculate the actual subband’s value, we use the following equation as shown in John-K's codec.md:
So, filling in the variables, we know
I will have to verify if this Subband can have a negative value gain… that does not make sense to me…
However, assuming we walked the tree correctly, our first Huffman Code for Subband 1’s delta was 10010.
For the next Subband, we would start with the next bit in the bitstream, 1 (from 1100010…).
| ⟵ Older | Table of Contents | Newer ⟶ |
|---|