Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: What does FLAC actually store? (Read 5246 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

What does FLAC actually store?

I've just recently gotten into all these different kinds of lossless codecs and I'm fascinated by how they work.

I understand that codecs like FLAC and TTA make a prediction for the next sample and then simply store the difference between the prediction and the actual value - which is most of the time significantly smaller than storing the full amplitude.

My question is.. does it only store that difference value? Or is it having to store the prediction model/function/curve or whatever was used for that particular chunk of data. If it's only storing the difference, and that difference is usually a very small number, then shouldnt compression ratios be much better than 2:1 or 3:1?

Maybe I havent fully understood how this stuff works, anyone able to shed a bit of light on it for me? Thanks.

What does FLAC actually store?

Reply #1
FLAC and related codecs do store the prediction model (an LPC filter), also called forwards prediction.

However, that only takes a relatively low amount of bytes. The  problem is that the prediction mostly a bit off, but the amount by which it is off is very random, so the error cannot be compressed that well.

Monkey's Audio and WavPack use another system, in which they predict based on the previous decoded samples (backwards prediction). This means that you dont have to store the predictor, but it will also be a bit less accurate which means bigger prediction errors.

What does FLAC actually store?

Reply #2
Following info is for completeness. Current lossless codecs are more advanced that this.


Codecs that *only* store the difference are called delta codecs. both, the coding and decoding is pretty simple (just a sum or a difference), and they aren't much efficient in compression. Storing just the difference would actually require one more bit for each sample, not less! To compress, they store just the needed number of bits to represent that value, but here is the drawback: you need a way to tell the decoder how many bits you're storing, and of course, this goes in the compressed data.

 

What does FLAC actually store?

Reply #3
Quote
,Feb 15 2006, 09:56 PM]Following info is for completeness.
[a href="index.php?act=findpost&pid=364592"][{POST_SNAPBACK}][/a]


Actually I don't see what it has to do with anything, other than confuse matters. Lossless codecs simply don't work like that at all.

What does FLAC actually store?

Reply #4
Thanks for the info, I'm studying music tech software development, and lossless compression for audio is something i want to research for my final year. I'm thinking of working at my own form of prediction-difference methods but I also want to try and attack this whole issue from another angle. For now I'm just gonna heavily investigate whats currently going on this field. I may be back for more questions!

Thanks again.