[Flac-dev] FLAC decoding details
Jonathan Lee
jonathan at sliid.org
Sun Apr 5 10:57:12 PDT 2009
Hello all,
I am writing an implementation of a FLAC decoder and I am polishing up
some details. The format <http://flac.sourceforge.net/format.html> page
leaves some room for interpretation. Can anyone help me by clarifying
the official rules about the following? Most of them are degenerate
cases that probably don't happen in practice:
Thanks,
--Jonathan
Can the bits per sample change from frame to frame? If so, does this
mean that the output sizes should be scaled to all be the bit width? Or
sign extended?
Can constant or verbatim subframes have left/side, right/side, or
mid/side channel assignment? If so, does the difference channel have an
extra bit per sample?
Is it a fatal error if the minimum frame size is larger than the maximum
frame size (in STREAMINFO)? What about the minimum number of samples
being larger than the maximum number of samples?
If the residue bit width is given by an escape code, can this escape
code be zero? What is the effect of reading "zero" bits? (assuming that
the stream is not advanced and 0 is the value read)
The MD5 is calculated on the "unencoded data", but this leaves a lot of
room for interpretation. Does this mean the data produced by the
decoder, or the data that was passed to the encoded when the file was
made? If it means on produced data, are the channels interleaved? Stored
as big or little endian? If it means the original data, how can we be
sure of the format of that data?
How do I handle negative QLPC shifts, officially? Treat them as positive
left shifts? Or treat them as an error condition? Or treat them as a
right shift with the shift index taken modulo 32 (as apparently happened
with earlier versions of the reference code)?
If I read a signed value that is one bit, what is "1" equal to?
If a sample rate of zero is specified, is this a fatal error? Or should
it be ignored?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xiph.org/pipermail/flac-dev/attachments/20090405/06966e34/attachment.htm
More information about the Flac-dev
mailing list