mbox series

[FFmpeg-devel,v4,0/2] 32bps FLAC patches

Message ID 20220903092144.569716-1-mvanb1@gmail.com
Headers show
Series 32bps FLAC patches | expand

Message

Martijn van Beurden Sept. 3, 2022, 9:21 a.m. UTC
Recently libFLAC gained the ability (not in any released version yet
though) to create FLAC files containing 32-bit int PCM samples. To
keep complexity reasonable, the choice was made to limit residuals
to 32-bit integers, which the encoder must make sure of. In case
the encoder cannot find any predictor of which the residuals fit
this limit, it must default to using a verbatim subframe. Tests have
shown that this does not happen often (<0.1% of subframes on a
music corpus of various styles). See also discussion here:
https://github.com/ietf-wg-cellar/flac-specification/pull/148

These two patches implement decoding and encoding following this
format.

Changes since v1:
fix copy-paste error in encoder, several invocations of
lpc_encode_choose_datapath used wrong parameters, making FATE fail as
compression was less than it should be

Changes since v2:
Rebased decoder part as it didn't apply anymore

Changes since v3:
Moved put_golomb part to flacenc.c (as it is now quite specific to FLAC)
and renamed put_sbits64 to put_sbits63 (and changed assert accordingly)

Martijn van Beurden (2):
  libavcodec/flacdec: Implement decoding of 32 bit-per-sample PCM
  libavcodec/flacenc: Implement encoding of 32 bit-per-sample PCM

 libavcodec/flac.c       |   4 +-
 libavcodec/flacdec.c    | 248 +++++++++++++++++--
 libavcodec/flacenc.c    | 519 ++++++++++++++++++++++++++++++++--------
 libavcodec/get_bits.h   |  12 +
 libavcodec/mathops.h    |   9 +
 libavcodec/put_bits.h   |   7 +
 libavcodec/put_golomb.h |  14 --
 7 files changed, 674 insertions(+), 139 deletions(-)

Comments

Martijn van Beurden Sept. 10, 2022, 10:32 a.m. UTC | #1
Op za 3 sep. 2022 om 11:21 schreef Martijn van Beurden <mvanb1@gmail.com>:

> Recently libFLAC gained the ability (not in any released version yet
> though) to create FLAC files containing 32-bit int PCM samples. To
> keep complexity reasonable, the choice was made to limit residuals
> to 32-bit integers, which the encoder must make sure of. In case
> the encoder cannot find any predictor of which the residuals fit
> this limit, it must default to using a verbatim subframe. Tests have
> shown that this does not happen often (<0.1% of subframes on a
> music corpus of various styles). See also discussion here:
> https://github.com/ietf-wg-cellar/flac-specification/pull/148
>
> These two patches implement decoding and encoding following this
> format.
>
> Changes since v1:
> fix copy-paste error in encoder, several invocations of
> lpc_encode_choose_datapath used wrong parameters, making FATE fail as
> compression was less than it should be
>
> Changes since v2:
> Rebased decoder part as it didn't apply anymore
>
> Changes since v3:
> Moved put_golomb part to flacenc.c (as it is now quite specific to FLAC)
> and renamed put_sbits64 to put_sbits63 (and changed assert accordingly)
>
> Martijn van Beurden (2):
>   libavcodec/flacdec: Implement decoding of 32 bit-per-sample PCM
>   libavcodec/flacenc: Implement encoding of 32 bit-per-sample PCM
>
>  libavcodec/flac.c       |   4 +-
>  libavcodec/flacdec.c    | 248 +++++++++++++++++--
>  libavcodec/flacenc.c    | 519 ++++++++++++++++++++++++++++++++--------
>  libavcodec/get_bits.h   |  12 +
>  libavcodec/mathops.h    |   9 +
>  libavcodec/put_bits.h   |   7 +
>  libavcodec/put_golomb.h |  14 --
>  7 files changed, 674 insertions(+), 139 deletions(-)
>
> --
> 2.30.2
>
>
Perhaps a little early for a reminder, sorry about that. I'd just like to
add to the above email that the FLAC reference implementation, libFLAC, has
had a release yesterday including the functionality of these patches
(encoding/decoder of 32 bps audio).
Paul B Mahol Sept. 10, 2022, 1:22 p.m. UTC | #2
On Sat, Sep 10, 2022 at 12:33 PM Martijn van Beurden <mvanb1@gmail.com>
wrote:

> Op za 3 sep. 2022 om 11:21 schreef Martijn van Beurden <mvanb1@gmail.com>:
>
> > Recently libFLAC gained the ability (not in any released version yet
> > though) to create FLAC files containing 32-bit int PCM samples. To
> > keep complexity reasonable, the choice was made to limit residuals
> > to 32-bit integers, which the encoder must make sure of. In case
> > the encoder cannot find any predictor of which the residuals fit
> > this limit, it must default to using a verbatim subframe. Tests have
> > shown that this does not happen often (<0.1% of subframes on a
> > music corpus of various styles). See also discussion here:
> > https://github.com/ietf-wg-cellar/flac-specification/pull/148
> >
> > These two patches implement decoding and encoding following this
> > format.
> >
> > Changes since v1:
> > fix copy-paste error in encoder, several invocations of
> > lpc_encode_choose_datapath used wrong parameters, making FATE fail as
> > compression was less than it should be
> >
> > Changes since v2:
> > Rebased decoder part as it didn't apply anymore
> >
> > Changes since v3:
> > Moved put_golomb part to flacenc.c (as it is now quite specific to FLAC)
> > and renamed put_sbits64 to put_sbits63 (and changed assert accordingly)
> >
> > Martijn van Beurden (2):
> >   libavcodec/flacdec: Implement decoding of 32 bit-per-sample PCM
> >   libavcodec/flacenc: Implement encoding of 32 bit-per-sample PCM
> >
> >  libavcodec/flac.c       |   4 +-
> >  libavcodec/flacdec.c    | 248 +++++++++++++++++--
> >  libavcodec/flacenc.c    | 519 ++++++++++++++++++++++++++++++++--------
> >  libavcodec/get_bits.h   |  12 +
> >  libavcodec/mathops.h    |   9 +
> >  libavcodec/put_bits.h   |   7 +
> >  libavcodec/put_golomb.h |  14 --
> >  7 files changed, 674 insertions(+), 139 deletions(-)
> >
> > --
> > 2.30.2
> >
> >
> Perhaps a little early for a reminder, sorry about that. I'd just like to
> add to the above email that the FLAC reference implementation, libFLAC, has
> had a release yesterday including the functionality of these patches
> (encoding/decoder of 32 bps audio).
>

Great, it will be merged if there are no more objections.
Could add fate test so that it does not get broken.


> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>