News for hackers. Stuff that matters.
Re:FLAC 1.3.4 by brnt on Wednesday February 23, 2022 @02:40AM (#30438673)
Shoutout to LossyWAV (formerly LossyFLAC) [1]. It's a preprocessor to lossless codecs shaping noise such that higher compression ratios can me reached. It works out much better than that sounds like.

1. https://wiki.hydrogenaud.io/index.php?title=LossyWAV

Re:FLAC 1.3.4 by edave64 on Wednesday February 23, 2022 @04:50AM (#30439459)
Reminds me of https://pngquant.org/

Same concept just for making images more efficient for PNG

Re:FLAC 1.3.4 by bmn__ on Wednesday February 23, 2022 @06:46AM (#30440076)
Re:FLAC 1.3.4 by adastra22 on Wednesday February 23, 2022 @03:56AM (#30439141)
> It's a preprocessor to lossless codecs shaping noise...

So it's a lossy compression? Why use FLAC then?

Re:FLAC 1.3.4 by erdewit on Wednesday February 23, 2022 @04:24AM (#30439283)
Other lossy compression methods generally happen in the frequency domain and, depending on the type of music, can introduce audible distortions.

This preprocessor on the other hand throws away some of least significant bits to save data. This increases the quantization noise but has no other sort of artifacts. The quantization noise can be dithered to fall in the higher frequencies (noise shaping) and is generally not perceptible.

Re:FLAC 1.3.4 by Dylan16807 on Wednesday February 23, 2022 @04:35AM (#30439346)
Doesn't 16 bit audio already require dithering to capture the full audible dynamic range? That makes me worry somewhat about cutting more bits and layering dithers on dithers.
Re:FLAC 1.3.4 by TonyTrapp on Wednesday February 23, 2022 @06:48AM (#30440088)
While it's good practice, a 16-bit recording is usually not exactly ruined by not dithering it. 96dB dynamic range is a lot.
Re:FLAC 1.3.4 by astrange on Wednesday February 23, 2022 @08:54PM (#30449365)
You always want dithering no matter the bit depth, but 16-bit is actually quite a lot - there's literally no point in better than CD-quality audio. (Except of course that real life is in surround not stereo.)

But yes, if you're doing it repeatedly you'd want an un-dithering filter. Noise reduction tends to do this by accident but it helps if you know what the dither shape was.

Re:FLAC 1.3.4 by namibj on Wednesday February 23, 2022 @04:07AM (#30439195)
Sounds more like trellis quantization in near-lossless H.264, explicitly trading coding cost of details against psychovisual impact of said details.
Re:FLAC 1.3.4 by astrange on Wednesday February 23, 2022 @04:26AM (#30439296)
That's psy-rd (in x264 terms).

Trellis quantization is just a more optimal way to divide numbers - think of it like rounding to nearest instead of down. "optimal" means "optimal rate-distortion tradeoff" and "distortion" means whatever you want it to, but usually it's difference between original and compressed pixels (absolute error/SAD/PSNR).

That can look blurry, because given all alternatives with the same SAD, blurry ones compress more. So psy-rd changes the definition of distortion to add a "has similar amount of noise" factor. That's very far from human optimal (if anything it's SSIM optimal) but it's free detail. Uses the same quantization to get there, though.

Re:FLAC 1.3.4 by astrange on Wednesday February 23, 2022 @04:07AM (#30439196)
It's just a hobby project, and the structure isn't too different from how other lossy codecs work. (Or lossless ones - you can construct one of those from any lossy one just by sticking the difference from the original on the end.)

Most codecs sacrifice transparency to reach a bitrate and this one does the opposite.

Re:FLAC 1.3.4 by ptx on Wednesday February 23, 2022 @05:24AM (#30439661)
> Most codecs sacrifice transparency to reach a bitrate and this one does the opposite.

That's what LAME's presets and the Ogg Vorbis quality settings do as well, isn't it?

Re:FLAC 1.3.4 by astrange on Wednesday February 23, 2022 @06:22AM (#30439966)
Yep, but codecs tend to have maximum bitrates either because of design tradeoffs or to work with hardware decoders. MP3's is too small to be perfectly transparent on some things, like cymbals.
Re:FLAC 1.3.4 by tjoff on Wednesday February 23, 2022 @03:39AM (#30439034)
It works out much better than that sounds like.

That... doesn't sound good ;)

Really cool idea, though more comparable to lossy compression I guess.

Re:FLAC 1.3.4 by sprash on Wednesday February 23, 2022 @03:42AM (#30439055)
This reduces the bitrate by about 3 times. Even at the lowest bitrate at about 300 kbps I can't even hear the slightest difference to the original. Impressive, but I wonder what it would sound like when you reduce the bitrate even further. Would it be competitive with mp3?
Re:FLAC 1.3.4 by Aachen on Wednesday February 23, 2022 @07:00AM (#30440151)
I mean, you don't need flac to have audio quality where people can't distinguish in double blind test. Something like 160kbps (iirc, ±30) Opus does the job as well.

(Mp3 is way less efficient and depending on the encoder it can have characteristic artifacts. Vorbis was already better, but opus blows that away. Software support for opus is nearly as good as mp3 since recently. We should either stop considering mp3 the default lossy format or hack it into a container format so audio files can have opus inside while carrying the familiar mp3 extension for the 90s folk to be happy about.)

Re:FLAC 1.3.4 by SSLy on Wednesday February 23, 2022 @07:09AM (#30440194)
Ogg was merely a (very bad) container, you're probably thinking about Vorbis.
Re:FLAC 1.3.4 by Aachen on Wednesday February 23, 2022 @07:10AM (#30440203)
Ah yes, I keep mixing those up. Edited, thanks.
Re:FLAC 1.3.4 by out_of_protocol on Wednesday February 23, 2022 @04:11AM (#30439216)
This at 300kbps vs opus 300kbps? mp3 is not a good comparison target
Re:FLAC 1.3.4 by sprash on Wednesday February 23, 2022 @04:25AM (#30439287)
Since the decoder complexity of flac is much lower than that of opus LossyWAV easily wins this competition at 300 kbps. I just wonder what the compression artifacts with LossyWAV would sound like if you push the bitrate down further (like e.g. 128 kbps). Sadly the command line tool does not allow that.
Re:FLAC 1.3.4 by out_of_protocol on Wednesday February 23, 2022 @04:45AM (#30439424)
Would be interesting. Unlikely to work out though. On other note, opus 128 kbps is transparent (in my tests i can distinguish 100kbps files at most), with safety margin 256 kbps should be enough for all practical purposes (except archiving).

There are other worser codecs around, e.g. LDAC (best Bluetooth codec) 660kbps vs 990kbps is very noticable (cant setup the same way to compare 990kbps LDAC vs 128kbps opus)

Re:FLAC 1.3.4 by edave64 on Wednesday February 23, 2022 @04:45AM (#30439431)
What are you doing with it that opus decoding complexity is any kind of barrier?