IPB

Welcome Guest ( Log In | Register )

Something that's been bugging me about FLAC...
TempestGarden
post Dec 25 2011, 21:24
Post #1





Group: Members
Posts: 43
Joined: 12-September 04
From: Philadelphia
Member No.: 16959



So, I have been using FLAC for many, many years now and I have ripped countless CDs and encoded them to FLAC for archive purposes as well as general listening. In all these years, something has been bothering me that I don't understand about this codec and I have decided to post here and see if I can get an answer to this nagging question. Not sure why I waited this long to bring this up, but anyways, here goes...

As you all know, FLAC has various "compression" settings which you can select when encoding the file (which never made sense to me since this is supposed to be a lossless codec). Now I understand that these "compression" levels have been likened to how WinZip compresses a file. I sorta get the analogy but there is something else here that still doesn't make sense to me. To illustrate my question/point better, I did a little experiment and listed my results below. I ripped the same exact song at 4 different "compression" levels and the resulting bitrate that I got for each rip is listed as well.

(Uncompressed) - 1412 kbps
Level 0 - 986 kbps
Level 5 (default) - 933 kbps
Level 8 - 931 kbps

So, based on these results, here is what is bothering me. Between the uncompressed setting and the level 8 setting, there is a loss of almost 500 kbps of data. In my mind, that is quite a substantial amount. I totally understand that whatever setting you chose will ultimately affect the end result bitrate of the file. I get that. What makes no sense to me at all though, is how a file (at level 8 setting) can lose almost 500 kbps of data and still be considered "lossless".

How is that possible? What is in those ~500 kbps worth of data that is getting shaved off? I just don't understand how you can be losing this much data and still have the resulting file be considered lossless. Maybe it's too technical of an answer for me to understand but I figured if anyone would be able to answer this for me, the folks on the forum here would.

So, yeah... this has been nagging at me for awhile. Any help to make me understand this better would be greatly appreciated.

Oh and btw.... Merry Christmas! smile.gif

This post has been edited by TempestGarden: Dec 25 2011, 21:25
Go to the top of the page
+Quote Post
 
Start new topic
Replies
psycho
post Dec 25 2011, 23:20
Post #2





Group: Members
Posts: 241
Joined: 14-October 05
Member No.: 25099



TempestGarden, imagine this scenario.

You have a simple text file with the content "I love you, I love you, I love you.". That's 35 characters = 35 bytes. Some very simple form of lossless compression would be to do the folowing (and something like that is happening also with FLAC, plus a lot of more complicated calculaions): The algorithm detects repeating pattern "I love you" and it stores it like this: "I love you"=a, then it detects the comma and does ", "=b and then it stores the data like this:
I love you=a
, =b
ababa.
That's 24 characters = 24 bytes.

You see, none of the information has been lost, because when you decode this, you'll get the exact same file as you had before compression.

I hope this helps.


--------------------
lame -V 0
Go to the top of the page
+Quote Post
Speckmade
post Dec 26 2011, 06:04
Post #3





Group: Members
Posts: 36
Joined: 15-February 05
Member No.: 19848



QUOTE (psycho @ Dec 25 2011, 23:20) *
I love you=a
, =b
ababa.
That's 24 characters = 24 bytes.

Now this is an example of removing one type of so-called redundancy that isn't actually used with lossless audio compression AFAIK.
You might find it fascinating to find out not only about the already mentioned (stereo) channel decoupling, but also the prediction that takes advantage of the correlation between subsequent samples, and entropy coding that deals with values that appear more or less often (as an effect of the decorrelation).
Although, if you're unfamiliar with pulse-code modulation (PCM) you might wanna find out about that first...
Go to the top of the page
+Quote Post
saratoga
post Dec 26 2011, 07:34
Post #4





Group: Members
Posts: 4967
Joined: 2-September 02
Member No.: 3264



That is a simple form of entropy coding, which is used in FLAC.

This post has been edited by db1989: Dec 27 2011, 01:29
Reason for edit: removing unnecessary full quote
Go to the top of the page
+Quote Post
Speckmade
post Dec 26 2011, 21:09
Post #5





Group: Members
Posts: 36
Joined: 15-February 05
Member No.: 19848



QUOTE (saratoga @ Dec 26 2011, 07:34) *
QUOTE (Speckmade @ Dec 26 2011, 00:04) *
QUOTE (psycho @ Dec 25 2011, 23:20) *

ababa

...isn't actually used...

That is a simple form of entropy coding, which is used in FLAC.

I don't understand - this doesn't sound right.
This is a dictionary coder. It replaces strings of arbitrary length with place holders whereas entropy coding replaces (fixed-lenght) symbols. FLAC uses Rice coding and Run-length encoding.
Go to the top of the page
+Quote Post
TBeck
post Dec 27 2011, 00:15
Post #6


TAK Developer


Group: Developer
Posts: 1098
Joined: 1-April 06
Member No.: 29051



I have to agree.

I don't know of any lossless audio compressor utilizing something like this.

Well, ok, once i read LPAC is coding two consecutive zeros as one bit, because no appropriate rice code for very low volume signals (consisting mostly of zeros) exists. But this is a very specific or unique way to deal with quite rare signals.

This post has been edited by db1989: Dec 27 2011, 00:51
Reason for edit: removing unnecessary full quote
Go to the top of the page
+Quote Post

Posts in this topic
- TempestGarden   Something that's been bugging me about FLAC...   Dec 25 2011, 21:24
- - saratoga   QUOTE (TempestGarden @ Dec 25 2011, 15:24...   Dec 25 2011, 21:28
- - benski   From a layman's point of view, most of the ini...   Dec 25 2011, 21:30
- - db1989   It’s called lossless compression for a reaso...   Dec 25 2011, 21:31
|- - TempestGarden   Maybe because I didn't fully understand how it...   Dec 25 2011, 22:44
|- - saratoga   QUOTE (TempestGarden @ Dec 25 2011, 16:44...   Dec 25 2011, 23:08
|- - db1989   QUOTE (TempestGarden @ Dec 25 2011, 21:44...   Dec 26 2011, 01:07
|- - mjb2006   I think what the OP needs is just to understand th...   Dec 26 2011, 04:49
- - psycho   TempestGarden, imagine this scenario. You have a ...   Dec 25 2011, 23:20
|- - TempestGarden   Yes, this does help and is a great example! I ...   Dec 25 2011, 23:27
|- - Roseval   The compression ratio is a source of misunderstand...   Dec 25 2011, 23:41
|- - Speckmade   QUOTE (psycho @ Dec 25 2011, 23:20) I lov...   Dec 26 2011, 06:04
|- - saratoga   That is a simple form of entropy coding, which is ...   Dec 26 2011, 07:34
|- - Speckmade   QUOTE (saratoga @ Dec 26 2011, 07:34) QUO...   Dec 26 2011, 21:09
|- - TBeck   I have to agree. I don't know of any lossless...   Dec 27 2011, 00:15
|- - Speckmade   QUOTE (TBeck @ Dec 27 2011, 00:15) no app...   Dec 27 2011, 03:50
- - Grinderman   QUOTE (TempestGarden @ Dec 25 2011, 21:24...   Dec 25 2011, 23:49
|- - TempestGarden   ^ Another great, easy to understand example. Thank...   Dec 26 2011, 00:26
- - slks   To paraphrase what's already been said - The ...   Dec 26 2011, 10:54
- - halb27   A simple model for lossless audio compression: Ins...   Dec 26 2011, 11:34
- - Ron Jones   QUOTE (Grinderman @ Dec 25 2011, 15:49) T...   Dec 26 2011, 19:03


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 20th September 2014 - 05:57