[Flac-dev] 'Wasted bits-per-sample' flag

Brian Willoughby brianw at sounds.wa.com
Mon Apr 26 16:36:33 PDT 2010


I'm guessing here, but it seems that some encoders might only be able  
to process samples in 4-bit or 8-bit groups, maybe even 16-bit  
multiples, so this flag would allow the decoder to remove any padding  
that might have been necessary on the encoder side.  For example, if  
someone were to encode 12-bit samples, but the encoder was forced to  
use 16-bit registers for calculations, then perhaps this flag would  
be needed to show that 4 bits per sample are wasted.

You might find more information in the source code.

Whatever the reason might be for wasted bits getting into the flac  
file, it seems clear that this flag is intended to allow any excess  
bits to be removed.  One thing to keep in mind is that FLAC is  
designed so that the encoder and decoder can be as independent as  
possible.  The algorithm for the encoder can be improved over time,  
but the format must allow the decoder to work no matter which version  
of the encoder is used.  Ideally, the FLAC format would not change  
even if the encoder changed, which means that the format must be  
capable of describing a wide range of data which might never be  
used.  i.e. I wouldn't be surprised if there are no FLAC files with  
this flag set.

Again, most of the above is conjecture.

Brian Willoughby
Sound Consulting


On Apr 26, 2010, at 16:02, Fernando Alberto Marengo Rodriguez wrote:
> I am currently investigating about the FLAC format and one
> thing I can't understand is the "WASTED BITS PER SAMPLE" flag.
> I've seen an explanation saying:
> "After decoding subframe decoder should bitwise shift all
> samples to left."
>
> Could anyone explain to me what this flag is for?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xiph.org/pipermail/flac-dev/attachments/20100426/e4722930/attachment.htm 


More information about the Flac-dev mailing list