enzo1982 / freac

The fre:ac audio converter project
https://www.freac.org/
GNU General Public License v2.0
1.43k stars 75 forks source link

Add exhaustive-model-search option to FLAC presets #37

Open Juniorsnet opened 5 years ago

Juniorsnet commented 5 years ago

with flac cmd I get the best compression with -8e option (exhaustive-model-search). Can you add you enable this option when the user choose a preset? not only for custom settings?

Thx

enzo1982 commented 5 years ago

Thank you, I will consider adding this.

It's not straightforward, however. There is no 8e preset of its own in FLAC - the -8e option merely tells it to use preset 8 and in addition enable exhaustive model search. This concept is not easily transferable to a GUI application.

For example, I could add an "8 with exhaustive model search" preset, but then someone could come and want "8 with LPC quant optimization", "7 with exhaustive mode search" or "5 with a different window function". There would be endless combinations.

On the other hand, allowing all options to be changed even when a preset is selected has its own challenges. How to indicate that a value has been changed from the preset's default? How to go back to the preset's default? What happens with your overridden options when switching between different presets?

Not sure if this is worth it. After all, you can just use custom settings and set the values of preset 8 according to the FLAC documentation plus enabling exhaustive model search: https://xiph.org/flac/api/group__flac__stream__encoder.html#gae49cf32f5256cb47eecd33779493ac85

Lee-Carre commented 1 year ago

… There would be endless combinations.

On the other hand, allowing all options to be changed even when a preset is selected has its own challenges. How to indicate that a value has been changed from the preset's default? How to go back to the preset's default? What happens with your overridden options when switching between different presets? …

I entirely sympathise & relate.

Besides development headaches, there are numerous implications for users/usability, as you allude to.

@enzo1982; a suggestion, then;

For context, just in case; in my siutation, I want FLAC to achieve the best compression ratio it can, even if that takes a while. Because I only want/need to encode once, yet decode many times. I'll gladly do other tasks, while the encoder is busy; I'm not sitting idle while waiting for it. While I'm sure that others have a larger music collection than I, mine is moderate, and so I want to be efficient with storage requirements (while preserving lossless compression with a libre codec). So, when telling the FLAC encoder that I want ‘best compression’ (level 8), I really mean it; including an exhaustive search, and possibly trying various window functions (I noticed some discussion on Hydrogen Audio, about different functions (and different parameters) achieving different results, depending on type of music/audio being encoded; different genres call for different functions/parameters).

I notice, hence my concern here if this isn't really the case, in the FLAC configuration dialogue box, that when level 8 is selected as the preset, and I view the Expert tab, that (while disabled and unchangeable) the checkbox for Exhaustive search model (and Optimize LPC quantization) is ticked. In terms of UI/usability, that strongly suggests that level 8 does use the exhaustive search model. Is this not so?

Is this not so?

After all, you can just use custom settings and set the values of preset 8 according to the FLAC documentation plus enabling exhaustive model search

Having now read the linked documentation (thankyou; I didn't know where to find the definitions of each preset, before), it seems that the answer to my own question is: no.

The relevant line being

[#] level | do mid-side stereo | loose mid-side stereo | apodization | max lpc order | qlp coeff precision | qlp coeff prec search | escape coding | exhaustive model search | min residual partition order | max residual partition order | rice parameter search dist
[…]
8 | true | false | subdivide_tukey(3) | 12 | 0 | false | false | false | 0 | 6 | 0

Ugh. I have a lot of re-encoding to do. I wish that this had been made clearer. At the least, instead of describing level 8 as “Best compression” (which it clearly isn't), perhaps more like “Optimised compression” or “High compression”. Preferably with a pointer to this GH issue, for those who really do want maximal compression.

I would also strongly request (separate ticket?) that the UI, such as the Expert tab, reflect the parameters used in the selected preset, as feedback to the user.

For future reference, and others diving into the rabbit-hole of FLAC encoder configuration, the FLAC manual page might be useful.