>> I'm jumping in on this thread to make a few remarks about the spec. I >> implemented a FLAC decoder by only looking at the spec, and I have a few >> notes that would have saved me a lot of time if the spec had mentioned >> them. They are obvious in hindsight, of course. >> >> * If the channel assignment includes a difference channel, then the >> subframe for that channel has one extra bit per sample in order to >> encode the difference. >> >> * The number of bits per sample for a subframe, is the number of bits >> per sample of the frame, minus the number of wasted bits per sample of >> the subframe (and possibly plus one for a difference channel). >> >> I hope this helps future implementers. > > I would love to see a patch against the documentation for this. > > Erik
Here you go. Kind regards, Ruud van Asseldonk
From 7ee085acc99bb60f0335f93f96682a0a0cf66649 Mon Sep 17 00:00:00 2001 From: Ruud van Asseldonk <[email protected]> Date: Sun, 11 Jun 2017 13:16:27 +0200 Subject: [PATCH] doc: Add notes about subframe sample size --- doc/html/format.html | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/html/format.html b/doc/html/format.html index bce3c453..1047092a 100644 --- a/doc/html/format.html +++ b/doc/html/format.html @@ -1267,7 +1267,7 @@ <3> </td> <td> - Sample size in bits:<br /> + Sample size in bits: <a href="#frame_header_notes">[5]</a><br /> <ul> <li> <tt>000</tt> : get from STREAMINFO metadata block @@ -1367,6 +1367,11 @@ <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> + <li> + For subframes that encode a difference channel, + the sample size is one bit larger than the sample size of the frame, + in order to be able to encode the difference between extreme values. + </li> </ol> </td> </tr> @@ -1489,6 +1494,8 @@ <tt>1</tt> : k wasted bits-per-sample in source subblock, k-1 follows, unary coded; e.g. k=3 => 001 follows, k=7 => 0000001 follows. </li> </ul> + The size of the samples stored in the subframe is the subframe sample size reduced by k bits. + Decoded samples must be shifted left by k bits. </td> </tr> </table> -- 2.13.1
_______________________________________________ flac-dev mailing list [email protected] http://lists.xiph.org/mailman/listinfo/flac-dev
