-
Notifications
You must be signed in to change notification settings - Fork 282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cases where -e makes compression worse; does -e really do everything it should? #728
Comments
Without having done any tests, I assume this has to do with the inexact residual bits calculation. The code has two methods of calculating the size of the residual, which one is used is a compile time option, not a run time option. When running with exhaustive model search ( Maybe these signals can help to find a better fast way to estimate the amount of bits needed. |
Here are two Win64 compiles to experiment with, one standard, one with exact rice calculation turned on: |
Trying those compiles, I got system errors that libwinpthread-1.dll was not found and then that libogg-0.dll was not found. |
Ah, yes, I didn't do the usual checks. Attempt no. 2: flac-test-exact-rice.zip |
Here are a couple of "really bad" examples in that -e increases size by fifty percent, both on the "exact" build and the "inexact" build: For those parameters where -e lost in the previous rounds (highly biased selection!), ran with these two builds, the -e outcompresses the --no-exhaustive-model-search more often in the "inexact" build. But for the "exact" build, -e loses most settings that it lost in the previous round. Edit: this sounds dramatic. Note again to other readers, this is only 16384 samples with values -1, 0, 1. Issue opened just in case it is a symptom of something. |
The plot thickens, and I do suspect it is a bug. I discovered it on the "near-mono" tracks of Miles Davis "The Complete Birth of the Cool"; the 1998 edition, but taking only the first eleven tracks that appeared on the original Birth of the Cool LP (which apparently served as a master!). Here is what happens - the audio is available on request, but I cannot upload it here.
Sizes with --no-mid-side, 1.4.3, smallest to largest:
It should be noted that each of these settings improve over 1.3.4:
Allowing for stereo decorrelation, then -e works as should:
Curiously, for 1.2.1 (and 1.1.4), -p did misbehave (with or without --no-mid-side). -4 to -6:
The uncompressed CDDA .wav is 345320684 bytes. Extracting a channel to a mono file and compressing it, works like --no-mid-side. Indeed, that is how I discovered it. |
Maybe I misunderstood your naming scheme, but the files with |
Embarrassing mistake, and you are right. Did it over again with that particular short signal.
Tab-separated file: exact and inexact builds -e and -p impact.txt |
A few more tests on the "Miles tracks 1 to 11" set confirms that the exact-rice "fixes it": With that build, -e always improves, and same for -p. I got only one instance (or two) where -p worsens: -5r6 -l1 with/without -e. Leaving -p aside and focusing on -e: I ran
and varying the following parameters (yeah there was a --lax always):
With the inexact-rice build and --no-mid-side, -e makes worse for all runs except "-l0" and "-l1" in the "varying -l" section. Attaching some results (the cases with "undesired impact" are farthest down) even if the cause is kinda found. |
Is this going to eventually be merged? |
There is nothing to be merged, this has been in the code for many years, it is just disabled by default. |
How can I enable it? Building it with cmake spams stuff and it's not good for my use. EDIT: I edited |
Usual reservation: I do not know whether
-e
is even supposed to handle this, and even if it is, I am not saying it is worth the effort of "fixing" it. Rather, I am reporting it because it could be symptom of a bug with bigger consequences. (At "worst", waking-e
up from the dead ...)But the situation is, sometimes I encounter signals where
-e
even makes for bigger encode. I found a near-silent file where it happened, and got it down to the first 16384 samples, mono. That is most manageable, so I ran it through -l <0 to 32>, -b <1024, 2048, 4096, 8192, 16384> -r <n,n for n=0 to 9> and then with/without -p and -e; that is 33510*4 = 6600 files. Or 3300 pairs "-e or not".I think 256 of them did worse with -e. That's more than 7.5 percent. (For a further 196 pairs, they were the same size. I didn't check whether those were bit-identical.)
And it seems that when -e does worse, the "no-e" uses prediction order 1 while -e uses more.
Surely there are a lot of duplicates among those 3300; fewer than you might think because I used
-r n,n
forcing partition order, rather than-r n
. The filenames indicate setting used, and the duplicates after the equals sign. Examples:16384samples_-b2048_-l02_-r¨09.flac=-l03.flac means it was encoded with -b2048 -l2 -r9,9 and is bit-identical to the file encoded with -b2048 -l02 -r9,9
16384samples_-b1024_-l04_-r¨00-e.flac=-l_up_to_32.flac means it was encoded with -b1024 -l4 -r0,0, and is bit-identical to all files with -l up to 32 and everything else equal.
where_-e_loses.zip
All done with a recent compile from git. Discovered it with 1.4.x.
The text was updated successfully, but these errors were encountered: