From 74df1bcefbd90fe1e028792918b2fc997061ef18 Mon Sep 17 00:00:00 2001 From: Monty Date: Tue, 11 Mar 2003 11:02:17 +0000 Subject: [PATCH] Many small but vital fixes to the spec pseudocode pointed out by jripley@sonicblue.com. svn path=/trunk/vorbis/; revision=4474 --- doc/xifish.pdf | Bin 0 -> 1747 bytes doc/xml/04-codec.xml | 15 +++++----- doc/xml/07-floor1.xml | 9 +++--- doc/xml/08-residue.xml | 73 +++++++++++++++++++++++++------------------------ 4 files changed, 48 insertions(+), 49 deletions(-) create mode 100644 doc/xifish.pdf diff --git a/doc/xifish.pdf b/doc/xifish.pdf new file mode 100644 index 0000000000000000000000000000000000000000..42bd1c84491c4127d7e761fab5b7e7836f5af291 GIT binary patch literal 1747 zcmZWq3p7-D7+2D1uSo4Cy^jA@9+StN%NWLEnv%zeFvRAu8siREW3KL88fulKqeh4JZ z?Dl9pz1nnfMXTqV%$l@5MZm7Pr<3Qevm-y|Rm_1+-QbUF6))YcXVz*ZAHJ>7yl~OM z_enAuZT#xTqSAo}W22KP>?oFO=aDB)dPn>WhR5rz@B1As*B;{!hxa)rmj8aS?Qy!q zP{sKJnKxO!q-x&f$%A9jy+203Q(0Dry^qgdY~Jp3C$}A3@%-2^aZ1rQu}@JFV#O_3 zIn=THv`6N<;>4d9Ze1E(rnfd$kDKavvma02w%3^#`RL4iFUDYsRs<|*?z!KYeZ5DC z6Wnl#Fm)*8>ip`?^|e@G6P3EbD(qrco&okoq5nW!vF@!(wVY~~-&%iKj6lrz5&-iK zez#MlBuO1P;gyX}lz-S&c;#(ex8+n^TNvjdXV@#T(;nmpV=572_f2axZrAn|M3$ay zT3_X5kjLy^xV)is&0**T8E@fSB~5$ORLi}kx_f@cP30PNM_DYgUNaAiU)OMX!Gf|b z2L``GspBs%`y6%dh36@mWkx4&kK~Zr#YL8>M^x`Hi^WPM$xq{zT(S@!wQY>f2RX6l zm(_0cZV68}EEwdKBAjE$v?1QlbKWPgdaIOsNNTNJ#N8v7cC=rpeEQGo-p0o!BDL$w z69YOqw!Zn_3(x&2yqTtvJI`-#MSAF3 z<75}PdQ8WoY#_TWdp(x*dgN?~rAWVr=!qqrUy|HmOr*8+o&DM}&GCx) zBe{bnyRz;fRWDX0@7er*16op;*fhg>R24MUxxD1(b&{>U89P zROB;tmTAo=`64{Fno>>@Cv=5apiuxC4m?mog5hFdY-j{r_@p36godLcV9cj%H;0iyl&PE@ zLKT+dCdNr2CJ6#Qx=z%4gucGM4~@oV&(>HS!Q>`GcJ%G7lAr9n)pXn+I$tTE}d=UoK@LF0n&bH9M^YyVu literal 0 HcmV?d00001 diff --git a/doc/xml/04-codec.xml b/doc/xml/04-codec.xml index 27c6146..f3b513b 100644 --- a/doc/xml/04-codec.xml +++ b/doc/xml/04-codec.xml @@ -7,8 +7,8 @@
- $Id: 04-codec.xml,v 1.7 2002/10/27 16:20:47 giles Exp $ - Last update to this document: October 15, 2002 + $Id: 04-codec.xml,v 1.8 2003/03/11 11:02:17 xiphmont Exp $ + Last update to this document: March 11, 2003 Codec Setup and Packet Decode @@ -357,7 +357,6 @@ proceeds as follows: [window_center] = [n] / 2 - [left_window_start] if ([vorbis_mode_blockflag] is set and [previous_window_flag] is not set) then @@ -393,7 +392,7 @@ set) then for [i] in range [left_window_start] ... [left_window_end]-1, window([i]) = sin(.5 * π * sin^2( ([i]-[left_window_start]+.5) / [left_n] * .5 * π) ) window from range [left_window_end] ... [right_window_start]-1 -inclusive is one for [i] in range [right_window_start] ... [right_window_end]-1, window([i]) = sin(.5 * π * sin^2( ([i]-[right_window_start]+.5) / [right_n] * .5 * π/2. + .5 * π) ) +inclusive is one for [i] in range [right_window_start] ... [right_window_end]-1, window([i]) = sin(.5 * π * sin^2( ([i]-[right_window_start]+.5) / [right_n] * .5 * π + .5 * π) ) window from range [rigth_window_start] ... [n]-1 is zero @@ -483,17 +482,17 @@ for each submap [i] in order from 0 ... [vorbis_mapp [ch] = 0 - for each channel [j] in order from 0 ... [audio_channels] + for each channel [j] in order from 0 ... [audio_channels] - 1 - if channel [j] is in submap [i] (vector [vorbis_mapping_mux] element [j] is equal to [i]) + if channel [j] in submap [i] (vector [vorbis_mapping_mux] element [j] is equal to [i]) if vector [no_residue] element [j] is true - vector [do_not_decode_flag] element [channels_in_bundle] is set + vector [do_not_decode_flag] element [ch] is set else - vector [do_not_decode_flag] element [channels_in_bundle] is unset + vector [do_not_decode_flag] element [ch] is unset increment [ch] diff --git a/doc/xml/07-floor1.xml b/doc/xml/07-floor1.xml index 614826b..33037d6 100644 --- a/doc/xml/07-floor1.xml +++ b/doc/xml/07-floor1.xml @@ -7,8 +7,8 @@
- $Id: 07-floor1.xml,v 1.4 2002/10/27 16:20:47 giles Exp $ - Last update to this document: October 15, 2002 + $Id: 07-floor1.xml,v 1.5 2003/03/11 11:02:17 xiphmont Exp $ + Last update to this document: March 11, 2003 Floor type 1 setup and decode @@ -185,9 +185,8 @@ context. 20) iterate [j] over the range 0 ... ([floor1_class_dimensions] element [current_class_number])-1 { 21) vector [floor1_X_list] element ([j] + [floor1_values]) = read [rangebits] bits as unsigned integer - } - - 22) [floor1_values] = [floor1_values] + [floor1_class_dimensions] element [i] + 22) increment [floor1_values] by one + } } 23) done diff --git a/doc/xml/08-residue.xml b/doc/xml/08-residue.xml index 5a34775..a807ea8 100644 --- a/doc/xml/08-residue.xml +++ b/doc/xml/08-residue.xml @@ -7,8 +7,8 @@
- $Id: 08-residue.xml,v 1.4 2002/10/27 16:20:47 giles Exp $ - Last update to this document: July 19, 2002 + $Id: 08-residue.xml,v 1.5 2003/03/11 11:02:17 xiphmont Exp $ + Last update to this document: March 11, 2003 Residue setup and decode @@ -286,8 +286,8 @@ The following convenience values are conceptually useful to clarifying the decode process: - 1) [classvals_per_codeword] = [codebook_dimensions] value of codebook [residue_classbook] - 2) [n_to_read] = [residue_end] - [residue-begin] + 1) [classwords_per_codeword] = [codebook_dimensions] value of codebook [residue_classbook] + 2) [n_to_read] = [residue_end] - [residue_begin] 3) [partitions_to_read] = [n_to_read] / [residue_partition_size] @@ -298,6 +298,7 @@ Packet decode proceeds as follows, matching the description offered earlier in t 2) iterate [pass] over the range 0 ... 7 { 3) [partition_count] = 0 + 4) if ([pass] is zero) { 5) iterate [j] over the range 0 .. [ch]-1 { @@ -305,9 +306,9 @@ Packet decode proceeds as follows, matching the description offered earlier in t 6) if vector [j] is not marked 'do not decode' { 7) [temp] = read from packet using codebook [residue_classbook] in scalar context - 8) iterate [k] descending over the range [classvals_per_codeword]-1 ... 0 { + 8) iterate [i] descending over the range [classwords_per_codeword]-1 ... 0 { - 9) array [classifications] element [j],([partition_count]+[k]) = + 9) array [classifications] element [j],([i]+[partition_count]) = [temp] integer modulo [residue_classifications] 10) [temp] = [temp] / [residue_classifications] using integer division @@ -319,32 +320,29 @@ Packet decode proceeds as follows, matching the description offered earlier in t } - 11) [classword_count] = 0 - 12) iterate [j] over the range 0 .. [ch]-1 { - - 13) if vector [j] is not marked 'do not decode' { + 11) iterate [i] over the range 0 .. ([classwords_per_codeword] - 1) while [partition_count] + is also less than [partitions_to_read] { - - 14) [vqclass] = array [classifications] element [j],([partition_count]+[classword_count]) - 15) [vqbook] = array [residue_books] element [vqclass],[pass] - 16) if ([vqbook] is not 'unused') { + 12) iterate [j] over the range 0 .. [ch]-1 { - 17) decode partition into output vector number [j], starting at scalar + 13) if vector [j] is not marked 'do not decode' { + + 14) [vqclass] = array [classifications] element [j],[partition_count] + 15) [vqbook] = array [residue_books] element [vqclass],[pass] + 16) if ([vqbook] is not 'unused') { + + 17) decode partition into output vector number [j], starting at scalar offset [residue_begin]+[partition_count]*[residue_partition_size] using codebook number [vqbook] in VQ context } - } + } + + 18) increment [partition_count] by one } - - 18) increment [classword_count] - 19) increment [partition_count] - 20) if ([classword_count] is less than [classvals_per_codeword]) AND - ([partition_count] is less than [partitions_to_read) then continue at step 11 - 21) if ([partition_count] is less than [partitions_to_read) then continue at step 4 - } + } - 22) done + 19) done @@ -424,18 +422,27 @@ presents the same algorithm. Assume:
format 2 specifics -Format 2 is reducible to format 1 through the following steps, performed in order: +Format 2 is reducible to format 1. It may be implemented as an additional stepprior to and an additional post-decode step after a normal format 1 decode. + + + +Format 2 handles 'do not decode' vectors differently than residue 0 or +1; if all vectors are marked 'do not decode', no decode occurrs. +However, if at least one vector is to be decoded, all the vectors are +decoded. We then request normal format 1 to decode a single vector +representing all output channels, rather than a vector for each +channel. After decode, deinterleave the vector into independent vectors, one for each output channel. That is: - Assume format 2 is to decode ch vectors of length n. - Decode, using format 1, a single vector [v]of length ch*n. - Deinterleave this single vector [v] into ch independent vectors according to: + If all vectors 0 through ch-1 are marked 'do not decode', allocate and clear a single vector [v]of length ch*n and skip step 2 below; proceed directly to the post-decode step. + Rather than performing format 1 decode to produce ch vectors of length n each, call format 1 decode to produce a single vector [v] of length ch*n. + Post decode: Deinterleave the single vector [v] returned by format 1 decode as described above into ch independent vectors, one for each outputchannel, according to: 1) iterate [i] over the range 0 ... [n]-1 { 2) iterate [j] over the range 0 ... [ch]-1 { - 3) output vector number [j] element [i] = vector [t] element ([i] * [ch] +[j]) + 3) output vector number [j] element [i] = vector [v] element ([i] * [ch] + [j]) } } @@ -444,16 +451,10 @@ Format 2 is reducible to format 1 through the following steps, performed in orde - - - -Format 2 handles 'do not decode' vectors differently that residue 0 or -1; if all vectors are marked 'do not decode', no decode occurrs. -However, if at least one vector is to be decoded, all the vectors are -decoded.
+ -- 2.7.4