public
Description: A collection of audio handling programs which work from the command line.
Homepage: http://audiotools.sourceforge.net
Clone URL: git://github.com/tuffy/python-audio-tools.git
Added some documentation on determining Rice partition orders from a list of 
residuals.
tuffy (author)
Sat May 10 12:47:04 -0700 2008
commit  2e7139d403f8fd8b6a265b2a2147e430fe9c6606
tree    aa40fce5b55a53f03fbd6fd1ccce3cde04cf5307
parent  f41dc759e876f20a6c6e8695b778372b88112caa
...
307
308
309
 
310
311
312
...
708
709
710
711
 
712
713
714
...
731
732
733
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
307
308
309
310
311
312
313
...
709
710
711
 
712
713
714
715
...
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
0
@@ -307,6 +307,7 @@ For example: @-5~/~2 sup 1 = -3@
0
 
0
 .bp
0
 .SUBSUBSECTION "the Residual"
0
+.nr ZR \n%
0
 .PP
0
 Though the FLAC format allows for different forms of
0
 residual coding, two forms of partitioned Rice are the only ones
0
@@ -708,7 +709,7 @@ delta's absolute value sum, below.
0
 .PP
0
 In this example, @\[*D] sup 1@'s value of 26 is the smallest.
0
 Therefore, when compressing this set of samples in a FIXED subframe,
0
-it is best to use a predictor order of 1.
0
+it's best to use a predictor order of 1.
0
 .PP
0
 The predictor order indicates how many warm-up samples to take from
0
 the PCM stream.
0
@@ -731,3 +732,64 @@ Order:\^
0
 4:@"Residual" sub i = "Sample" sub i~~-~~((4 * "Sample" sub {i~-~1})~~-~~(6 * "Sample" sub {i~-~2})~~+~~(4 * "Sample" sub {i~-~3})~~-~~"Sample" sub {i~-~4})@
0
 _
0
 .TE
0
+.\"In this example, the residual values are: -1 1 1 1 0 3 0 -4 -1 0 1 1 1 4 -3 1 4 -1 -1
0
+.bp
0
+.SUBSUBSECTION "the Residual"
0
+.PP
0
+Given a stream of residual values, one must place them in one or more
0
+partitions, each with its own Rice parameter, and prepended with a
0
+small header.\(dg
0
+.FS
0
+\(dg See page \n(ZR for full details of how the residual is organized.
0
+.FE
0
+The residual's coding method is typically 0, unless one is encoding
0
+audio with more than 16 bits-per-sample and one of the partitions
0
+requests a Rice parameter higher than @2 sup 4@.
0
+The residual's partition order is chosen exhaustively, which means
0
+trying all of them within a certain range (e.g. 0 to 5) such that
0
+the residuals can be divided evenly between them and then the partiton
0
+order which uses the smallest estimated amount of space is chosen.
0
+.PP
0
+Choosing the best Rice parameter is a matter of selecting the smallest
0
+value of `x' such that:
0
+.EQ
0
+"sample count" * {2 sup x}~~>~~{sum from {i = 0} to {"residual count"~-~1}
0
+|{"residual" sub i}|}
0
+.EN
0
+.LP
0
+Again, this is easier to understand with a block of example residuals,
0
+19 in total:
0
+.TS
0
+tab(:);
0
+| c | c | c |
0
+| c | r | r |.
0
+_
0
+index:@residual sub i@:@|~{residual sub i}~|@
0
+=
0
+0:-1:1
0
+1:1:1
0
+2:1:1
0
+3:1:1
0
+4:0:0
0
+5:3:3
0
+6:0:0
0
+7:-4:4
0
+8:-1:1
0
+9:0:0
0
+10:1:1
0
+11:1:1
0
+12:1:1
0
+13:4:4
0
+14:-3:3
0
+15:1:1
0
+16:4:4
0
+17:-1:1
0
+18:-1:1
0
+_
0
+@|~{roman "sum"}~|@::29
0
+_
0
+.TE
0
+@19 * {2 sup 0}@ is not larger than 29.
0
+.br
0
+@19 * {2 sup 1}@ is larger than 29, so the best Rice parameter
0
+for this block of residuals is 1.

Comments