precomp-cpp icon indicating copy to clipboard operation
precomp-cpp copied to clipboard

Wave file audio compression

Open schnaader opened this issue 7 years ago • 5 comments

Currently wave files (.wav) aren't detected or processed. LZMA filters can help for 16-bit or 16-bit stereo audio files, but this doesn't work for embedded files. The lossless audio compressor wavpack can be used to compress audio data in this case and achieves much better ratios.

schnaader avatar Sep 19 '18 05:09 schnaader

So, this issue involves two parts, right? (a). Detection of .wav files, and then (b). Compression of .wav files. It sounds like wavpack can be used for (b), but does it help us with (a)?

Also, if I am understanding this correctly, that means that the output stream will be partially compressed with LZMA, and partially compressed with wavpack. Is that okay? Does the .pcf format have support for that?

andrew-epstein avatar Mar 01 '19 15:03 andrew-epstein

There's some rudimental parsing code in wavpack, but I don't know if I'll use it yet. Luckily, part (a) is not very complicated as RIFF WAVE is easy to parse (although there's some ambiguousness, e.g. in the order of chunks). My current plan is to do the default first (WAVE-PCM), a bit of additional verification and to check additional nice-to-haves in later versions. I already have a proof-of-concept project for (b), so the implementation of this isn't as far away as it might seem.

The output stream situation is similar for JPG streams (packJPG) and zLib streams (preflate) - these both use an arithmetic coder, so their output is compressed. LZMA receives everything as one big output stream without knowing these details. That's not optimal since the compressed output will most likely get a bit larger. On the other hand, this gives LZMA the chance to de-duplicate in case of identical compressed output.

schnaader avatar Mar 01 '19 16:03 schnaader

@schnaader Any news on this?

M-Gonzalo avatar Feb 21 '20 16:02 M-Gonzalo

I'll start a branch where I will integrate my proof-of-concept in March.

schnaader avatar Feb 25 '20 08:02 schnaader

Thanks! Looking forward to it

M-Gonzalo avatar Feb 28 '20 02:02 M-Gonzalo