[FFmpeg-devel] [PATCH] Add 32 bit-per-sample capability to FLAC encoder

Martijn van Beurden mvanb1 at gmail.com
Fri Dec 17 22:08:30 EET 2021


Op vr 17 dec. 2021 om 12:43 schreef Michael Niedermayer
<michael at niedermayer.cc>:
> > +                sub->coefs[i] = sub->coefs[i]*0.98;
>                                                  ^^^^
> This is ugly, the amount of actual overflow should be known at this point
> so no arbitrary downscale should be needed here


Many thanks for the suggestion, I didn't think of using a more
intelligent approach. I'll work something out.


> > +                if (!ff_flacdsp_lpc_encode_c_32_overflow_detect(res, smp, n, sub->order,
> > +                                                                sub->coefs, sub->shift)) {
> > +                    sub->type = sub->type_code = FLAC_SUBFRAME_VERBATIM;
> > +                    memcpy(res, smp, n * sizeof(int32_t));
> > +                    return subframe_count_exact(s, sub, 0);
>
> How often does this occur ?


Depends on the content. On low dynamic range, distorted, overdriven
sounds like certain kinds of metal, this happens on about half of the
subframes. On most popular music, up to about 5%. On classical music
never. For the intended use (archiving of tape recordings with ample
headroom) probably never as well. A more intelligent approach as
suggested could bring these numbers down.


More information about the ffmpeg-devel mailing list