summaryrefslogtreecommitdiff
path: root/doc/format.html
blob: 7864da6c95effebda18defde782d322080466077 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
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
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
	<TITLE>FLAC - format</TITLE>
</HEAD>

<BODY MARGINWIDTH="0" MARGINHEIGHT="0" LEFTMARGIN="0" RIGHTMARGIN="0" TOPMARGIN="0" BGCOLOR="#99CC99" TEXT="#000000" LINK="#336699" VLINK="#336699" ALINK="#336699">

<TABLE BORDER=0 WIDTH="100%" CELLPADDING=1 CELLSPACING=0>
	<TR>
		<TD ALIGN="CENTER" BGCOLOR="#000000"><A HREF="http://flac.sourceforge.net/"><IMG SRC="images/logo.jpg" ALIGN=CENTER ALT="FLAC Logo" BORDER=0 HSPACE=0></a></TD>
	</TR>
</TABLE>

<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#99CC99"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="25" ALT=""></TD></TR></TABLE>

<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="2" ALT=""></TD></TR></TABLE>

<TABLE WIDTH="100%" CELLPADDING=0 CELLSPACING=0 BORDER=0>
	<TR>
		<TD ALIGN="CENTER" BGCOLOR="#D3D4C5">
			<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0>
				<TR>
					<TD HEIGHT=22 BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="index.html">home</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
					<TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="news.html">news</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
					<TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="download.html">download</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
					<TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="features.html">features</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
					<TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="goals.html">goals</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
					<TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;format&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
					<TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="comparison.html">comparison</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
					<TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="documentation.html">documentation</A>&nbsp;&nbsp;</TD><TD BGCOLOR="#D3D4C5" ALIGN=CENTER>|</TD>
					<TD           BGCOLOR="#D3D4C5" ALIGN=CENTER NOWRAP>&nbsp;&nbsp;<A CLASS="topnav" HREF="developers.html">developers</A>&nbsp;&nbsp;</TD>
				</TR>
			</TABLE>
		</TD>
	</TR>
</TABLE>

<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="2" ALT=""></TD></TR></TABLE>

<CENTER>

<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#99CC99"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="15" ALT=""></TD></TR></TABLE>


<TABLE WIDTH="100%" CELLPADDING="5" CELLSPACING="5" BORDER="0">
<TR><TD>
	<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
	<TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#D3D4C5">
		<TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
		<B><FONT SIZE="+2">format</FONT></B>
		</FONT></TD></TR>
	</TABLE>
	<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>
	<TABLE CELLSPACING="0" CELLPADDING="3" WIDTH="100%" BORDER="0" BGCOLOR="#EEEED4">
	<TR><TD><FONT FACE="Lucida,Verdana,Helvetica,Arial">
	<P>
		This is a detailed description of the FLAC format.  The format is currently in the beta stage, which means it will not change in a way that will break backward compatibility unless a bug related to the format is found.  Until the first official release you should probably not use FLAC for archiving unless you keep your beta binaries.
	</P>
	<P>
		First, as the original developer I have to say that I am not a compression expert and I feel obligated to give credit where it is due.  FLAC owes a lot to the many people who have advanced the audio compression field so freely.  For instance:
	</P>
	<P>
	<UL>
		<LI>
			<A HREF="http://svr-www.eng.cam.ac.uk/~ajr/">A. J. Robinson</A> for his work on <A HREF="http://svr-www.eng.cam.ac.uk/~ajr/GroupPubs/Robinson94-tr156/index.html">Shorten</A>; his code and paper are a good starting point on some of the basic methods used by FLAC.  FLAC expands on the fixed predictors used in shorten.
		</LI>
		<LI>
			<A HREF="http://commsci.usc.edu/faculty/golomb.html">S. W. Golomb</A> and Robert F. Rice; their universal codes are used by FLAC's entropy coder.
		</LI>
		<LI>
			N. Levinson and J. Durbin; the reference encoder uses an algorithm developed and refined by them for determining the LPC coefficients from the autocorrelation coefficients.
		</LI>
		<LI>
			And of course, the main guy, <A HREF="http://www.digitalcentury.com/encyclo/update/shannon.html">Claude Shannon</A>
		</LI>
	</UL>
	</P>
	<P>
		<A NAME="scope"><FONT SIZE="+1"><B><U>Scope</U></B></FONT></A>
	</P>
	<P>
		It is a known fact that no algorithm can losslessly compress all possible input, so most compressors restrict themselves to a useful domain and try to work as well as possible within that domain.  FLAC's domain is audio data.  Though it can losslessly code any input, only certain kinds of input will get smaller.  FLAC exploits the fact that audio data typically has a high degree of sample-to-sample correlation.
	</P>
	<P>
		Within the audio domain, there are many possible subdomains.  For example: low bitrate speech, high-bitrate multi-channel music, etc.  FLAC itself does not target a specific subdomain but many of the default parameters of the reference encoder are tuned to CD-quality music data (i.e. 44.1kHz, 2 channel, 16 bits per sample).  The effect of the encoding parameters on different kinds of audio data will be examined later.
	</P>
	<P>
		<A NAME="architecture"><FONT SIZE="+1"><B><U>Architecture</U></B></FONT></A>
	</P>
	<P>
		Similar to many audio coders, a FLAC encoder has the following stages:
	</P>
	<UL>
		<P><LI>
			<A HREF="#blocking">Blocking</A>.  The input is broken up into many contiguous blocks.  With FLAC, the blocks may vary in size.  The optimal size of the block is usually affected by many factors, including the sample rate, spectral characteristics over time, etc.  Though FLAC allows the block size to vary within a stream, the reference encoder uses a fixed block size.
		</LI></P>
		<P><LI>
			<A HREF="#interchannel">Interchannel Decorrelation</A>.  In the case of stereo streams, the encoder will create mid and side signals based on the average and difference (respectively) of the left and right channels.  The encoder will then pass the best form of the signal to the next stage.
		</LI></P>
		<P><LI>
			<A HREF="#prediction">Prediction</A>.  The block is passed through a prediction stage where the encoder tries to find a mathematical description (usually an approximate one) of the signal.  This description is typically much smaller than the raw signal itself.  Since the methods of prediction are known to both the encoder and decoder, only the parameters of the predictor need be included in the compressed stream.  FLAC currently uses four different classes of predictors (described in the <A HREF="#prediction">prediction</A> section), but the format has reserved space for additional methods.  FLAC allows the class of predictor to change from block to block, or even within the channels of a block.
		</LI></P>
		<LI><P>
			<A HREF="#residualcoding">Residual coding</A>.  If the predictor does not describe the signal exactly, the difference between the original signal and the predicted signal (called the error or residual signal) must be coded losslessy.  If the predictor is effective, the residual signal will require fewer bits per sample than the original signal.  FLAC currently uses only one method for encoding the residual (see the <A HREF="#residualcoding">Residual coding</A> section), but the format has reserved space for additional methods.  FLAC allows the residual coding method to change from block to block, or even within the channels of a block.
		</LI></P>
	</UL>
	<P>
		In addition, FLAC specifies a metadata system, which allows arbitrary information about the stream to be included at the beginning of the stream.
	</P>
	<P>
		<A NAME="definitions"><FONT SIZE="+1"><B><U>Definitions</U></B></FONT></A>
	</P>
	<P>
		Many terms like "block" and "frame" are used to mean different things in differenct encoding schemes.  For example, a frame in MP3 corresponds to many samples across several channels, whereas an S/PDIF frame represents just one sample for each channel.  The definitions we use for FLAC follow.  Note that when we talk about blocks and subblocks we are refering to the raw unencoded audio data that is the input to the encoder, and when we talk about frames and subframes, we are refering to the FLAC-encoded data.
	</P>
	<UL>
		<P><LI>
			<B>Block</B>: One or more audio samples that span several channels.
		</LI></P>
		<P><LI>
			<B>Subblock</B>: One or more audio samples within a channel.  So a block contains one subblock for each channel, and all subblocks contain the same number of samples.
		</LI></P>
		<P><LI>
			<B>Blocksize</B>: The number of samples in any of a block's subblocks.  For example, a one second block sampled at 44.1KHz has a blocksize of 44100, regardless of the number of channels.
		</LI></P>
		<P><LI>
			<B>Frame</B>: A frame header plus one or more subframes.
		</LI></P>
		<P><LI>
			<B>Subframe</B>: A subframe header plus one or more encoded samples from a given channel.  All subframes within a frame will contain the same number of samples.
		</LI></P>
	</UL>
	<P>
		<A NAME="blocking"><FONT SIZE="+1"><B><U>Blocking</U></B></FONT></A>
	</P>
	<P>
		The size used for blocking the audio data has a direct effect on the compression ratio.  If the block size is too small, the resulting large number of frames mean that excess bits will be wasted on frame headers.  If the block size is too large, the characteristics of the signal may vary so much that the encoder will be unable to find a good predictor.  In order to simplify encoder/decoder design, FLAC imposes a minimum block size of 16 samples, and a maximum block size of 65535 samples.  This range covers the optimal size for all of the audio data FLAC supports.
	</P>
	<P>
		Currently the reference encoder uses a fixed block size, optimized on the sample rate of the input.  Future version may vary the block size depending on the characteristics of the signal.
	</P>
	<P>
		Blocked data is passed to the predictor stage one subblock (channel) at a time.  Each subblock is independently coded into a subframe, and the subframes are concatenated into a frame.  Because each channel is coded separately, it means that one channel of a stereo frame may be encoded as a constant subframe, and the other an LPC subframe.
	</P>
	<P>
		<A NAME="interchannel"><FONT SIZE="+1"><B><U>Interchannel Decorrelation</U></B></FONT></A>
	</P>
	<P>
		In stereo streams, in many cases there is an exploitable amount of correlation between the left and right channels.  FLAC allows the frames of stereo streams to have different channel assignments, and an encoder may choose to use the best representation on a frame-by-frame basis.
	</P>
	<UL>
		<P><LI>
			<B>Independent</B>.  The left and right channels are coded independently.
		</LI></P>
		<P><LI>
			<B>Mid-side</B>.  The left and right channels are transformed into mid and side channels.  The mid channel is the midpoint (average) of the left and right signals, and the side is the difference signal (left minus right).
		</LI></P>
		<P><LI>
			<B>Left-side</B>.  The left channel and side channel are coded.
		</LI></P>
		<P><LI>
			<B>Right-side</B>.  The right channel and side channel are coded
		</LI></P>
	</UL>
	<P>
		Surprisingly, the left-side and right-side forms can be the most efficient in many frames, even though the raw number of bits per sample needed for the original signal is slightly more than that needed for independent or mid-side coding.
	</P>
	<P>
		<A NAME="prediction"><FONT SIZE="+1"><B><U>Prediction</U></B></FONT></A>
	</P>
	<P>
		FLAC uses four methods for modeling the input signal:
	</P>
	<UL>
		<P><LI>
			<B>Verbatim</B>.  This is essentially a zero-order predictor of the signal.  The predictor of the signal is the signal itself, so the compression is zero.  This is the baseline against which the other predictors are measured.  If you feed random data to the encoder, the verbatim predictor will probably be used for every subblock.  Since the raw signal is not actually passed through the residual coding stage (it is added to the stream 'verbatim'), the encoding results will not be the same as a zero-order linear predictor.
		</LI></P>
		<P><LI>
			<B>Constant</B>.  This predictor is used whenever the subblock contains digital silence, i.e. a constant value throughout.  The signal is run-length encoded and added to the stream.
		</LI></P>
		<P><LI>
			<B>Fixed linear predictor</B>.  FLAC uses a class of computationally-efficient fixed linear predictors (for a good description, see <A HREF="http://www.hpl.hp.com/techreports/1999/HPL-1999-144.pdf">audiopak</A> and <A HREF="http://svr-www.eng.cam.ac.uk/~ajr/GroupPubs/Robinson94-tr156/index.html">shorten</A>).  FLAC adds a fourth-order predictor to the zero-to-third-order predictors used by shorten.  Since the predictors are fixed, the predictor order is the only parameter that needs to be stored in the compressed stream.  The error signal is then passed to the residual coder.
		</LI></P>
		<P><LI>
			<B>FIR Linear prediction</B>.  For more accurate modeling (at a cost of slower encoding), FLAC supports up to 32nd order FIR linear prediction (again, for info on linear prediction, see <A HREF="http://www.hpl.hp.com/techreports/1999/HPL-1999-144.pdf">audiopak</A> and <A HREF="http://svr-www.eng.cam.ac.uk/~ajr/GroupPubs/Robinson94-tr156/index.html">shorten</A>).  The reference encoder uses the Levinson-Durbin method for calculating the LPC coefficients from the autocorrelation coefficients, and the coefficients are quantized before computing the residual.  Whereas encoders such as shorten used a fixed quantization for the entire input, FLAC allows the quantized coefficient precision to vary from subframe to subframe.  The FLAC reference encoder estimates the optimal precision to use based on the block size and dynamic range of the original signal.
		</LI></P>
	</UL>
	<P>
		<A NAME="residualcoding"><FONT SIZE="+1"><B><U>Residual Coding</U></B></FONT></A>
	</P>
	<P>
		FLAC currently defines two similar methods for the coding of the error signal from the prediction stage.  The error signal is coded using Rice codes in one of two ways: 1) the encoder estimates a single rice parameter based on the variance of the residual and Rice codes the entire residual using this parameter; 2) the residual is partitioned into several equal-length regions of contiguous samples, and each region is coded with its own Rice parameter based on the region's mean.  (Note that the first method is a special case of the second method with one partition, except the Rice parameter is based on the residual variance instead of the mean.)
	</P>
	<P>
		The FLAC format has reserved space for other coding methods.  Some possiblities for volunteers would be to explore better context-modeling of the Rice parameter, or Huffman coding.  See <A HREF="http://www.hpl.hp.com/techreports/98/HPL-98-193.html">LOCO-I</A> and <A HREF="http://www.cs.tut.fi/~albert/Dev/pucrunch/packing.html">pucrunch</A> for descriptions of several universal codes.
	</P>
	<P>
		<FONT SIZE="+1"><B><U>Format</U></B></FONT>
	</P>
	<P>
		This section specifies the FLAC bitstream format.  FLAC has no format version information, but it does contain reserved space in several places.  Future versions of the format may use this reserved space safely without breaking the format of older streams.  Older decoders may choose to abort decoding or skip data encoded with newer methods.  Apart from reserved patterns, in places the format specifies invalid patterns, meaning that the patterns may never appear in any valid bitstream, in any prior, present, or future versions of the format.  These invalid patterns are usually used to make the synchronization mechanism more robust.
	</P>
	<P>
		All numbers used in a FLAC bitstream are integers; there are no floating-point representations.  All numbers are big-endian coded.  All numbers are unsigned unless otherwise specified.
	</P>
	<P>
		<A NAME="overview">A FLAC bitstream may be appended with ID3V1 data or prepended with ID3V2 data.  FLAC has no knowledge of such data, but the reference decoder knows how to skip an ID3 tag.  The input plugins support ID3V1 tags</A>
	</P>
	<P>
		Before the formal description of the stream, an overview might be helpful.
	</P>
	<UL>
		<P><LI>
			A FLAC bitstream consists of the "fLaC" marker at the beginning of the stream, followed by a mandatory metadata block (called the STREAMINFO block), any number of other metadata blocks, then the audio frames.
		</LI></P>
		<P><LI>
			FLAC supports up to 128 kinds of metadata blocks, but currently only one is defined.  This is the STREAMINFO block, which has info about the whole stream like sample rate, number of channels, total number of samples, etc.  This block must be present as the first metadata block in the stream.  Other metadata blocks may follow, and ones that the decoder doesn't understand, it will skip.
		</LI></P>
		<P><LI>
			The audio data is composed of one or more audio frames.  Each frame consists of a frame header, which contains a sync code, info about the frame like the block size, sample rate, number of channels, et cetera, and an 8-bit CRC.  The frame header also contains either the sample number of the first sample in the frame (for variable-blocksize streams), or the frame number (for fixed-blocksize streams).  This allows for fast, sample-accurate seeking to be performed.  Following the frame header are encoded subframes, one for each channel, and finally, the frame is zero-padded to a byte boundary.  Each subframe has its own header that specifies how the subframe is encoded.
		</LI></P>
		<P><LI>
			Since a decoder may start decoding in the middle of a stream, there must be a method to determine the start of a frame.  A 9-bit sync code begins every frame.  The sync code will not appear anywhere else in the frame header.  However, since it may appear in the subframes, the decoder has two other ways of ensuring a correct sync.  The first is to check that the rest of the frame header contains no invalid data.  Even this is not foolproof since valid header patterns can still occur within the subframes.  The decoder's final check is to generate an 8-bit CRC of the frame header and compare this to the CRC stored at the end of the frame header.
		</LI></P>
		<P><LI>
			Again, since a decoder may start decoding at an arbitrary frame in the stream, each frame header must contain some basic information about the stream because the decoder may not have access to the STREAMINFO metadata block at the start of the stream.  This information includes sample rate, bits per sample, number of channels, etc.  Since the frame header is pure overhead, it has a direct effect on the compression ratio.  To keep the frame header as small as possible, FLAC uses lookup tables for the most commonly used values for frame parameters.  For instance, the sample rate part of the frame header is specified using 4 bits.  Eight of the bit patterns correspond to the commonly used sample rates of 8/16/22.05/24/32/44.1/48/96 kHz.  However, odd sample rates can be specified by using one of the 'hint' bit patterns, directing the decoder to find the exact sample rate at the end of the frame header.  The same method is used for specifying the block size and bits per sample.  In this way, the frame header size stays small for all of the most common forms of audio data.
		</LI></P>
		<P><LI>
			Individual subframes (one for each channel) are coded separately within a frame, and appear serially in the stream.  In other words, the encoded audio data is NOT channel-interleaved.  This reduces decoder complexity at the cost of requiring larger decode buffers.  Each subframe has its own header specifying the attributes of the subframe, like prediction method and order, residual coding parameters, etc.  The header is followed by the encoded audio data for that channel.
		</LI></P>
		<P><LI>
			FLAC specifies a subset of itself as the Subset format.  The purpose of this is to ensure that any streams encoded according to the Subset are truly "streamable", meaning that a decoder that cannot seek within the stream can still pick up in the middle of the stream and start decoding.  It also makes hardware decoder implementations more practical by limiting the blocking such that decoder buffer sizes can be easily determined.  "flac" generates Subset streams by default unless the "--lax" command-line option is used.  The Subset makes the following limitations on what may be used in the stream:
			<UL>
			<LI>
				The blocksize bits in the <A HREF="#frame_header">frame header</A> must be 001-101, specifying a fixed-blocksize stream (the exception being the last block as described in the table).  This also means that the STREAMINFO metadata block must specify equal mininum and maximum blocksizes.
			</LI>
			<LI>
				The bits-per-sample bits in the <A HREF="#frame_header">frame header</A> must be 001-110.
			</LI>
			<LI>
				The sample rate bits in the <A HREF="#frame_header">frame header</A> must be 0001-1011.
			</LI>
			</UL>
		</LI></P>
	</UL>

	<P>
		The following tables constitute a formal description of the FLAC format.  Numbers in angle brackets indicate how many bits are used for a given field.
	</P>

	</FONT>
	</TD></TR>
	</TABLE>
	<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0"><TR BGCOLOR="#000000"><TD><IMG SRC="images/1x1.gif" WIDTH="1" HEIGHT="1" ALT=""></TD></TR></TABLE>

	<P>
	<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
	<TABLE WIDTH="100%" BORDER="1" BGCOLOR="#EEEED4">
		<TR>
			<TD COLSPAN="2" BGCOLOR="#D3D4C5">
				<A NAME="stream"><FONT SIZE="+1"><B>STREAM</B></FONT></A>
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				&lt;32&gt;
			</TD>
			<TD>
				"fLaC", the FLAC stream marker in ASCII, meaning byte 0 of the stream is 0x66, followed by 0x4C 0x61 0x43
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				<A HREF="#metadata_streaminfo_block"><I>METADATA_BLOCK</I></A>
			</TD>
			<TD>
				This is the mandatory STREAMINFO metadata block that has the basic properties of the stream
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				<A HREF="#metadata_block"><I>METADATA_BLOCK</I></A>*
			</TD>
			<TD>
				Zero or more metadata blocks
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				<A HREF="#frame"><I>FRAME</I></A>+
			</TD>
			<TD>
				One or more audio frames
			</TD>
		</TR>
	</TABLE>
	</TD></TR></TABLE>
	</P>

	<P>
	<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
	<TABLE WIDTH="100%" BORDER="1" BGCOLOR="#EEEED4">
		<TR>
			<TD COLSPAN="2" BGCOLOR="#D3D4C5">
				<A NAME="metadata_block"><FONT SIZE="+1"><B>METADATA_BLOCK</B></FONT></A>
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				<A HREF="#metadata_block_header"><I>METADATA_BLOCK_HEADER</I></A>
			</TD>
			<TD>
				A block header that specifies the type and size of the metadata block data.
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				<A HREF="#metadata_block_data"><I>METADATA_BLOCK_DATA</I></A>
			</TD>
			<TD>
				&nbsp;
			</TD>
		</TR>
	</TABLE>
	</TD></TR></TABLE>
	</P>

	<P>
	<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
	<TABLE WIDTH="100%" BORDER="1" BGCOLOR="#EEEED4">
		<TR>
			<TD COLSPAN="2" BGCOLOR="#D3D4C5">
				<A NAME="metadata_block_header"><FONT SIZE="+1"><B>METADATA_BLOCK_HEADER</B></FONT></A>
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				&lt;1&gt;
			</TD>
			<TD>
				Last-metadata-block flag: '1' if this block is the last metadata block before the audio blocks, '0' otherwise.
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				&lt;7&gt;
			</TD>
			<TD>
				BLOCK_TYPE<BR>
				<UL>
				<LI>
					<TT>0</TT> : STREAMINFO
				</LI>
				<LI>
					<TT>1</TT> : PADDING
				</LI>
				<LI>
					<TT>2</TT> : APPLICATION
				</LI>
				<LI>
					<TT>3-127</TT> : reserved
				</LI>
				</UL>
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				&lt;24&gt;
			</TD>
			<TD>
				Length (in bytes) of metadata to follow (does not include the size of the METADATA_BLOCK_HEADER)
			</TD>
		</TR>
	</TABLE>
	</TD></TR></TABLE>
	</P>

	<P>
	<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
	<TABLE WIDTH="100%" BORDER="1" BGCOLOR="#EEEED4">
		<TR>
			<TD COLSPAN="2" BGCOLOR="#D3D4C5">
				<A NAME="metadata_block_data"><FONT SIZE="+1"><B>METADATA_BLOCK_DATA</B></FONT></A>
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				<A HREF="#metadata_block_streaminfo"><I>METADATA_BLOCK_STREAMINFO</I></A><BR>|| <A HREF="#metadata_block_padding"><I>METADATA_BLOCK_PADDING</I></A><BR>|| <A HREF="#metadata_block_application"><I>METADATA_BLOCK_APPLICATION</I></A>
			</TD>
			<TD>
				The block data must match the block type in the block header.
			</TD>
		</TR>
	</TABLE>
	</TD></TR></TABLE>
	</P>

	<P>
	<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
	<TABLE WIDTH="100%" BORDER="1">
		<TR>
			<TD COLSPAN="2" BGCOLOR="#D3D4C5">
				<A NAME="metadata_block_streaminfo"><FONT SIZE="+1"><B>METADATA_BLOCK_STREAMINFO</B></FONT></A>
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				&lt;16&gt;
			</TD>
			<TD>
				The minimum block size (in samples) used in the stream.
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				&lt;16&gt;
			</TD>
			<TD>
				The maximum block size (in samples) used in the stream.  (Minimum blocksize == maximum blocksize) implies a fixed-blocksize stream.
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				&lt;24&gt;
			</TD>
			<TD>
				The minimum frame size (in bytes) used in the stream.  May be 0 to imply the value is not known.
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				&lt;24&gt;
			</TD>
			<TD>
				The maximum frame size (in bytes) used in the stream.  May be 0 to imply the value is not known.
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				&lt;20&gt;
			</TD>
			<TD>
				Sample rate in Hz.  Though 20 bits are available, the maximum sample rate is limited by the structure of frame headers to 1048570Hz.  Also, a value of 0 is invalid.
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				&lt;3&gt;
			</TD>
			<TD>
				(number of channels)-1.  FLAC supports from 1 to 8 channels
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				&lt;5&gt;
			</TD>
			<TD>
				(bits per sample)-1.  FLAC supports from 1 to 32 bits per sample.  Currently the reference encoder and decoders only support up to 24 bits per sample.
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				&lt;36&gt;
			</TD>
			<TD>
				Total samples in stream.  'Samples' means channel-wide sample, i.e. one second of 44.1Khz audio will have 44100 samples regardless of the number of channels.  A value of zero here means the number of total samples is unknown.
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				&lt;128&gt;
			</TD>
			<TD>
				MD5 signature of the unencoded audio data.  This allows the decoder to determine if an error exists in the audio data even when the error does not result in an invalid bitstream.
			</TD>
		</TR>
		<TR>
			<TD>
			</TD>
			<TD BGCOLOR="#F4F4CC">
				<FONT SIZE="+1">NOTES</FONT><BR>
				<UL>
				<LI>
					FLAC specifies a minimum block size of 16 and a maximum block size of 65535, meaning the bit patterns corresponding to the numbers 0-15 in the minimum blocksize and maximum blocksize fields are invalid.
				</LI>
				</UL>
			</TD>
		</TR>
	</TABLE>
	</TD></TR></TABLE>
	</P>

	<P>
	<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
	<TABLE WIDTH="100%" BORDER="1">
		<TR>
			<TD COLSPAN="2" BGCOLOR="#D3D4C5">
				<A NAME="metadata_block_padding"><FONT SIZE="+1"><B>METADATA_BLOCK_PADDING</B></FONT></A>
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				&lt;n&gt;
			</TD>
			<TD>
				n '0' bits (n must be a multiple of 8)
			</TD>
		</TR>
	</TABLE>
	</TD></TR></TABLE>
	</P>

	<P>
	<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
	<TABLE WIDTH="100%" BORDER="1">
		<TR>
			<TD COLSPAN="2" BGCOLOR="#D3D4C5">
				<A NAME="metadata_block_application"><FONT SIZE="+1"><B>METADATA_BLOCK_APPLICATION</B></FONT></A>
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				&lt;128&gt;
			</TD>
			<TD>
				Registered application ID
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				&lt;n&gt;
			</TD>
			<TD>
				Application data (n must be a multiple of 8)
			</TD>
		</TR>
	</TABLE>
	</TD></TR></TABLE>
	</P>

	<P>
	<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
	<TABLE WIDTH="100%" BORDER="1" BGCOLOR="#EEEED4">
		<TR>
			<TD COLSPAN="2" BGCOLOR="#D3D4C5">
				<A NAME="frame"><FONT SIZE="+1"><B>FRAME</B></FONT></A>
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				<A HREF="#frame_header"><I>FRAME_HEADER</I></A>
			</TD>
			<TD>
				&nbsp;
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				<A HREF="#subframe"><I>SUBFRAME</I></A>+
			</TD>
			<TD>
				One SUBFRAME per channel.
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				&lt;?&gt;
			</TD>
			<TD>
				Zero-padding to byte alignment.
			</TD>
		</TR>
	</TABLE>
	</TD></TR></TABLE>
	</P>

	<P>
	<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
	<TABLE WIDTH="100%" BORDER="1" BGCOLOR="#EEEED4">
		<TR>
			<TD COLSPAN="2" BGCOLOR="#D3D4C5">
				<A NAME="frame_header"><FONT SIZE="+1"><B>FRAME_HEADER</B></FONT></A>
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				&lt;9&gt;
			</TD>
			<TD>
				sync code '<TT>111111110</TT>'
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				&lt;3&gt;
			</TD>
			<TD>
				block size in channel-wide samples:<BR>
				<UL>
				<LI>
					<TT>000</TT> : get from STREAMINFO metadata block
				</LI>
				<LI>
					<TT>001</TT> : 192 samples
				</LI>
				<LI>
					<TT>010-101</TT> : 576 * (2^(2-n)) samples, i.e. 576/1152/2304/4608
				</LI>
				<LI>
					<TT>110</TT> : get 8 bit (blocksize-1) from end of header
				</LI>
				<LI>
					<TT>111</TT> : get 16 bit (blocksize-1) from end of header
				</LI>
				</UL>
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				&lt;4&gt;
			</TD>
			<TD>
				sample rate:<BR>
				<UL>
				<LI>
					<TT>0000</TT> : get from STREAMINFO metadata block
				</LI>
				<LI>
					<TT>0001-0011</TT> : reserved
				</LI>
				<LI>
					<TT>0100</TT> : 8kHz
				</LI>
				<LI>
					<TT>0101</TT> : 16kHz
				</LI>
				<LI>
					<TT>0110</TT> : 22.05kHz
				</LI>
				<LI>
					<TT>0111</TT> : 24kHz
				</LI>
				<LI>
					<TT>1000</TT> : 32kHz
				</LI>
				<LI>
					<TT>1001</TT> : 44.1kHz
				</LI>
				<LI>
					<TT>1010</TT> : 48kHz
				</LI>
				<LI>
					<TT>1011</TT> : 96kHz
				</LI>
				<LI>
					<TT>1100</TT> : get 8 bit sample rate (in kHz) from end of header
				</LI>
				<LI>
					<TT>1101</TT> : get 16 bit sample rate (in Hz) from end of header
				</LI>
				<LI>
					<TT>1110</TT> : get 16 bit sample rate (in tens of Hz) from end of header
				</LI>
				<LI>
					<TT>1111</TT> : invalid, to prevent sync-fooling string of 1s
				</LI>
				</UL>
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				&lt;4&gt;
			</TD>
			<TD>
				channel assignment
				<UL>
				<LI>
					<TT>0000-0111</TT> : (number of independent channels)-1.  when == 0001, channel 0 is the left channel and channel 1 is the right
				</LI>
				<LI>
					<TT>1000</TT> : left/side stereo: channel 0 is the left channel, channel 1 is the side(difference) channel
				</LI>
				<LI>
					<TT>1001</TT> : right/side stereo: channel 0 is the side(difference) channel, channel 1 is the right channel
				</LI>
				<LI>
					<TT>1010</TT> : mid/side stereo: channel 0 is the mid(average) channel, channel 1 is the side(difference) channel
				</LI>
				<LI>
					<TT>1011-1111</TT> : reserved
				</LI>
				</UL>
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				&lt;3&gt;
			</TD>
			<TD>
				sample size in bits:<BR>
				<UL>
				<LI>
					<TT>000</TT> : get from STREAMINFO metadata block
				</LI>
				<LI>
					<TT>001</TT> : 8 bits per sample
				</LI>
				<LI>
					<TT>010</TT> : 12 bits per sample
				</LI>
				<LI>
					<TT>011</TT> : reserved
				</LI>
				<LI>
					<TT>100</TT> : 16 bits per sample
				</LI>
				<LI>
					<TT>101</TT> : 20 bits per sample
				</LI>
				<LI>
					<TT>110</TT> : 24 bits per sample
				</LI>
				<LI>
					<TT>111</TT> : reserved
				</LI>
				</UL>
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				&lt;1&gt;
			</TD>
			<TD>
				zero bit padding, to prevent sync-fooling string of 1s
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				&lt;?&gt;
			</TD>
			<TD>
				if(variable blocksize)<BR>
				&nbsp;&nbsp;&nbsp;&lt;8-56&gt;:"UTF-8" coded sample number (decoded number is 36 bits)<BR>
				else<BR>
				&nbsp;&nbsp;&nbsp;&lt;8-48&gt;:"UTF-8" coded frame number (decoded number is 31 bits)
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				&lt;?&gt;
			</TD>
			<TD>
				if(blocksize bits == 11x)<BR>
				&nbsp;&nbsp;&nbsp;8/16 bit (blocksize-1)
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				&lt;?&gt;
			</TD>
			<TD>
				if(sample rate bits == 11xx)<BR>
				&nbsp;&nbsp;&nbsp;8/16 bit sample rate
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				&lt;8&gt;
			</TD>
			<TD>
				CRC-8 (polynomial = x^8 + x^2 + x + 1) of everything before the crc, including the sync code
			</TD>
		</TR>
		<TR>
			<TD>
			</TD>
			<TD BGCOLOR="#F4F4CC">
				<FONT SIZE="+1">NOTES</FONT><BR>
				<UL>
				<LI>
					The blocksize bits 000-101 may only be used if the blocksize is fixed throughout the entire stream.  Blocksize bits 110-111 may be used in any case but the decoder will have to pessimistically guess that it is a variable-blocksize stream.  There is only one special case: the encoder may use blocksize bits 110-111 on the last frame of a fixed-blocksize stream, as long as the blocksize is not greater than the stream blocksize.
				</LI>
				<LI>
					The "UTF-8" coding used for the sample/frame number is the same variable length code used to store compressed UCS-2, extended to handle larger input.
				</LI>
				</UL>
			</TD>
		</TR>
	</TABLE>
	</TD></TR></TABLE>
	</P>

	<P>
	<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
	<TABLE WIDTH="100%" BORDER="1" BGCOLOR="#EEEED4">
		<TR>
			<TD COLSPAN="2" BGCOLOR="#D3D4C5">
				<A NAME="subframe"><FONT SIZE="+1"><B>SUBFRAME</B></FONT></A>
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				<A HREF="#subframe_header"><I>SUBFRAME_HEADER</I></A>
			</TD>
			<TD>
				&nbsp;
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				<A HREF="#subframe_constant"><I>SUBFRAME_CONSTANT</I></A><BR>|| <A HREF="#subframe_fixed"><I>SUBFRAME_FIXED</I></A><BR>|| <A HREF="#subframe_lpc"><I>SUBFRAME_LPC</I></A><BR>|| <A HREF="#subframe_verbatim"><I>SUBFRAME_VERBATIM</I></A>
			</TD>
			<TD VALIGN="TOP">
				The SUBFRAME_HEADER specifies which one.
			</TD>
		</TR>
	</TABLE>
	</TD></TR></TABLE>
	</P>

	<P>
	<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
	<TABLE WIDTH="100%" BORDER="1" BGCOLOR="#EEEED4">
		<TR>
			<TD COLSPAN="2" BGCOLOR="#D3D4C5">
				<A NAME="subframe_header"><FONT SIZE="+1"><B>SUBFRAME_HEADER</B></FONT></A>
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				&lt;8&gt;
			</TD>
			<TD>
				Subframe type:
				<UL>
				<LI>
					<TT>xxxxxxx1</TT> : invalid, to prevent sync-fooling string of 1s
				</LI>
				<LI>
					<TT>00000000</TT> : <A HREF="#subframe_constant">SUBFRAME_CONSTANT</A>
				</LI>
				<LI>
					<TT>00000010</TT> : <A HREF="#subframe_verbatim">SUBFRAME_VERBATIM</A>
				</LI>
				<LI>
					<TT>000001x0</TT> : reserved
				</LI>
				<LI>
					<TT>00001xx0</TT> : reserved
				</LI>
				<LI>
					<TT>0001xxx0</TT> : if(xxx <= 4) <A HREF="#subframe_fixed">SUBFRAME_FIXED</A>, xxx=order ; else reserved
				</LI>
				<LI>
					<TT>001xxxx0</TT> : reserved
				</LI>
				<LI>
					<TT>01xxxxx0</TT> : <A HREF="#subframe_lpc">SUBFRAME_LPC</A>, xxxxx=order-1
				</LI>
				<LI>
					<TT>1xxxxxxx</TT> : invalid, to prevent sync-fooling string of 1s
				</LI>
				</UL>
			</TD>
		</TR>
	</TABLE>
	</TD></TR></TABLE>
	</P>

	<P>
	<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
	<TABLE WIDTH="100%" BORDER="1" BGCOLOR="#EEEED4">
		<TR>
			<TD COLSPAN="2" BGCOLOR="#D3D4C5">
				<A NAME="subframe_constant"><FONT SIZE="+1"><B>SUBFRAME_CONSTANT</B></FONT></A>
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				&lt;n&gt;
			</TD>
			<TD>
				Unencoded constant value of the subblock, n = frame's bits-per-sample.
			</TD>
		</TR>
	</TABLE>
	</TD></TR></TABLE>
	</P>

	<P>
	<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
	<TABLE WIDTH="100%" BORDER="1" BGCOLOR="#EEEED4">
		<TR>
			<TD COLSPAN="2" BGCOLOR="#D3D4C5">
				<A NAME="subframe_fixed"><FONT SIZE="+1"><B>SUBFRAME_FIXED</B></FONT></A>
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				&lt;n&gt;
			</TD>
			<TD>
				Unencoded warm-up samples (n = frame's bits-per-sample * predictor order).
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				<A HREF="#residual"><I>RESIDUAL</I></A>
			</TD>
			<TD>
				Encoded residual
			</TD>
		</TR>
	</TABLE>
	</TD></TR></TABLE>
	</P>

	<P>
	<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
	<TABLE WIDTH="100%" BORDER="1" BGCOLOR="#EEEED4">
		<TR>
			<TD COLSPAN="2" BGCOLOR="#D3D4C5">
				<A NAME="subframe_lpc"><FONT SIZE="+1"><B>SUBFRAME_LPC</B></FONT></A>
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				&lt;n&gt;
			</TD>
			<TD>
				Unencoded warm-up samples (n = frame's bits-per-sample * lpc order).
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				&lt;4&gt;
			</TD>
			<TD>
				(quantized linear predictor coefficients' precision in bits)-1 (1111 = invalid).
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				&lt;5&gt;
			</TD>
			<TD>
				Quantized linear predictor coefficient shift needed in bits (NOTE: this number is signed).
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				&lt;n&gt;
			</TD>
			<TD>
				Unencoded predictor coefficients (n = qlp coeff precision * lpc order).
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				<A HREF="#residual"><I>RESIDUAL</I></A>
			</TD>
			<TD>
				Encoded residual
			</TD>
		</TR>
	</TABLE>
	</TD></TR></TABLE>
	</P>

	<P>
	<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
	<TABLE WIDTH="100%" BORDER="1" BGCOLOR="#EEEED4">
		<TR>
			<TD COLSPAN="2" BGCOLOR="#D3D4C5">
				<A NAME="subframe_verbatim"><FONT SIZE="+1"><B>SUBFRAME_VERBATIM</B></FONT></A>
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				&lt;n*i&gt;
			</TD>
			<TD>
				Unencoded subblock; n = frame's bits-per-sample, i = frame's blocksize.
			</TD>
		</TR>
	</TABLE>
	</TD></TR></TABLE>
	</P>

	<P>
	<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
	<TABLE WIDTH="100%" BORDER="1" BGCOLOR="#EEEED4">
		<TR>
			<TD COLSPAN="2" BGCOLOR="#D3D4C5">
				<A NAME="residual"><FONT SIZE="+1"><B>RESIDUAL</B></FONT></A>
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				&lt;2&gt;
			</TD>
			<TD>
				Residual coding method:<BR>
				<UL>
				<LI>
					<TT>00</TT> : partitioned rice coding
				</LI>
				<LI>
					<TT>01-11</TT> : reserved
				</LI>
				</UL>
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				<A HREF="#partitioned_rice"><I>RESIDUAL_CODING_METHOD_PARTITIONED_RICE</I></A>
			</TD>
			<TD>
				&nbsp;
			</TD>
		</TR>
		<TR>
			<TD>
			</TD>
			<TD BGCOLOR="#F4F4CC">
				<FONT SIZE="+1">NOTES</FONT><BR>
				<UL>
				<LI>
					Currently, FLAC specifies only one entropy coding method.
				</LI>
				</UL>
			</TD>
		</TR>
	</TABLE>
	</TD></TR></TABLE>
	</P>

	<P>
	<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
	<TABLE WIDTH="100%" BORDER="1" BGCOLOR="#EEEED4">
		<TR>
			<TD COLSPAN="2" BGCOLOR="#D3D4C5">
				<A NAME="partitioned_rice"><FONT SIZE="+1"><B>RESIDUAL_CODING_METHOD_PARTITIONED_RICE</B></FONT></A>
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				&lt;4&gt;
			</TD>
			<TD>
				Partition order.
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				<A HREF="#rice_partition"><I>RICE_PARTITION</I></A>+
			</TD>
			<TD>
				There will be 2^order partitions.
			</TD>
		</TR>
	</TABLE>
	</TD></TR></TABLE>
	</P>

	<P>
	<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BGCOLOR="#EEEED4"><TR><TD>
	<TABLE WIDTH="100%" BORDER="1" BGCOLOR="#EEEED4">
		<TR>
			<TD COLSPAN="2" BGCOLOR="#D3D4C5">
				<A NAME="rice_partition"><FONT SIZE="+1"><B>RICE_PARTITION</B></FONT></A>
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				&lt;4&gt;
			</TD>
			<TD>
				Rice parameter
			</TD>
		</TR>
		<TR>
			<TD ALIGN="RIGHT" VALIGN="TOP" BGCOLOR="#F4F4CC">
				&lt;?&gt;
			</TD>
			<TD>
				Encoded residual.  The number of samples (n) in the partition is determined as follows:<BR>
				<UL>
				<LI>
					if the partition order is zero, n = frame's blocksize
				</LI>
				<LI>
					else if this is not the first partition of the subframe, n = (frame's blocksize / (2^partition order))
				</LI>
				<LI>
					else n = (frame's blocksize / (2^partition order)) - predictor order
				</LI>
				</UL>
			</TD>
		</TR>
	</TABLE>
	</TD></TR></TABLE>
	</P>

</TD></TR>
</TABLE>


</CENTER>

</BODY>
</HTML>