IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
compression math question
hellokeith
post Nov 19 2011, 23:27
Post #1





Group: Members
Posts: 288
Joined: 14-August 06
Member No.: 34027



Lossy music file, let's say a modern mp3 or aac, is A.

A is converted to pcm wav, which is now B.

B is compressed using a lossless format such as FLAC or WMAL or Wavpack, which is now C.

For file size, is the following true in all cases?

B >= C >= A
Go to the top of the page
+Quote Post
dhromed
post Nov 19 2011, 23:48
Post #2





Group: Members
Posts: 1303
Joined: 16-February 08
From: NL
Member No.: 51347



Pretty much.

What's the reason you ask?
Go to the top of the page
+Quote Post
lvqcl
post Nov 19 2011, 23:51
Post #3





Group: Developer
Posts: 3361
Joined: 2-December 07
Member No.: 49183



QUOTE (hellokeith @ Nov 20 2011, 02:27) *
C >= A


Not true. E.g. 8 kbps MP3 with silence => ~0 kbps FLAC
Go to the top of the page
+Quote Post
Hanseat
post Nov 20 2011, 00:06
Post #4





Group: Members
Posts: 9
Joined: 22-July 11
Member No.: 92467



QUOTE (hellokeith @ Nov 19 2011, 23:27) *
Lossy music file, let's say a modern mp3 or aac, is A.

A is converted to pcm wav, which is now B.

B is compressed using a lossless format such as FLAC or WMAL or Wavpack, which is now C.

For file size, is the following true in all cases?

B >= C >= A

Yes, in real life, with real life quality settings, real life sample rates, real life bit depth and normal audio like speech or music, it is true in all cases that I could imagine. But there is no proof for that.

However, you might be able to construct cases with uncompressable audio, where the lossless compressed file is bigger than the wav file because its overhead. This uncompressable audio might be of very low sample rate, but compressed with Fraunhofer AAC with high constant bitrate (up to 578). Then A >= C >= B
In real life this is next to impossible because noise is not music. Maybe you can construct uncompressable noise, that sounds like music to some people...

Another example is long silence. Some lossless formats might compress silence better than MP3, because silence "costs" 32 kbps in MP3, so that B >= A >= C. This is much more likely in real life than the first example.
Go to the top of the page
+Quote Post
Jillian
post Nov 20 2011, 02:52
Post #5





Group: Members
Posts: 66
Joined: 29-April 06
From: Thailand
Member No.: 30166



C >= A is not true in all case. Silence is the problem. But I've no proove that lossless codec compress silence better than lossy codec, may be anyone here knows?
Go to the top of the page
+Quote Post
saratoga
post Nov 20 2011, 04:22
Post #6





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



QUOTE (Jillian @ Nov 19 2011, 21:52) *
C >= A is not true in all case. Silence is the problem. But I've no proove that lossless codec compress silence better than lossy codec, may be anyone here knows?


mp3 bitrate can't go below 32k @ 44.1khz, so with silence most lossless codecs will compress a bit better. For real audio at 44.1/48khz though lossless size > mp3 size.

This post has been edited by saratoga: Nov 20 2011, 04:22
Go to the top of the page
+Quote Post
mjb2006
post Nov 20 2011, 20:23
Post #7





Group: Members
Posts: 786
Joined: 12-May 06
From: Colorado, USA
Member No.: 30694



For lossy formats, not just silence, but also non-tonal noise in certain frequency bands, in the case of HE-AAC and mp3PRO. However, the OP was asking about lossless formats only.

Don't forget about tagging. Throw some giant images in a file and the losslessly compressed file can easily grow larger than the untagged, uncompressed original.
Go to the top of the page
+Quote Post
kwanbis
post Nov 20 2011, 22:02
Post #8





Group: Developer (Donating)
Posts: 2362
Joined: 28-June 02
From: Argentina
Member No.: 2425



QUOTE (hellokeith @ Nov 19 2011, 23:27) *
Lossy music file, let's say a modern mp3 or aac, is A...

Can I ask why would you ask this? Is the strangest question I have seen here.


--------------------
MAREO: http://www.webearce.com.ar
Go to the top of the page
+Quote Post
SoAnIs
post Jan 11 2012, 01:21
Post #9





Group: Members
Posts: 9
Joined: 28-August 07
Member No.: 46568



Remember that we're starting with a lossy file A. MP3, for example, will tend to cut out high frequencies due to the psychoacoustic model used. If the compression algorithm used in the lossy format is less efficient than that used in the lossless format the lossless file could well end up smaller than the lossy file.
C<B<A<Original
This is not the normal case, however it should be mentioned.
Go to the top of the page
+Quote Post
testyou
post Jan 11 2012, 02:51
Post #10





Group: Members
Posts: 99
Joined: 24-September 10
Member No.: 84113



QUOTE (SoAnIs @ Jan 10 2012, 16:21) *
MP3...will tend to cut out high frequencies...If the compression algorithm used in the lossy format is less efficient than that used in the lossless format...


What?
The lossy format is more space efficient because it throws away frequencies which are difficult to hear.
Keeping those frequencies in a lossless format would be more space inefficient.

This post has been edited by testyou: Jan 11 2012, 02:53
Go to the top of the page
+Quote Post
Porcus
post Jan 11 2012, 03:08
Post #11





Group: Members
Posts: 1842
Joined: 30-November 06
Member No.: 38207



I tried to ask the same question a couple of years ago, at massive noise (bar a developer or two, who understand the theory).


In principle:
There cannot be more information in track.mp3 file than the encoded size.
If this is decoded to a less efficient format -- track.wav -- it contains precisely the same information.
Now track.mp3 decodes to the same audio as track.wav -- by construction of the latter. Hence track.mp3 encodes -- losslessly -- the same audio.


So -- again, in principle -- one could reverse the decoding which took track.mp3 and returned track.wav, and get back the mp3.
So the best lossless representation of track.wav, is track.mp3 OR SMALLER -- it is certainly not necessarily so that the mp3 file you started with, is the minimum filesize (... try a few with 7-zip ... you might save a percent).


That was the 'in principle' story. The 'in practice' story seems to be a totally different one: I don't think a lossless encoder will be remotely close to finding one of those small mp3 files which decode to track.wav, and certainly not anything better. I tested the FLAC filesize of my CDs recorded with pre-emphasis -- that simple EQ application does hardly change the information content of the file, but the filesize increased massively. In that case, there is 'this simple pattern' which can -- in principle -- be exploited to take tens of percents off the filesize, but nope, the compressors are not looking in that direction (and I suppose that there would be many CPU hours wasted if they should run through 'all simple patterns').


--------------------
One day in the Year of the Fox came a time remembered well
Go to the top of the page
+Quote Post

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: 27th August 2014 - 19:30