[FFmpeg-devel] [PATCH] AAC Encoder: clipping avoidance

Michael Niedermayer michael at niedermayer.cc
Mon Jul 27 19:28:35 CEST 2015


On Mon, Jul 20, 2015 at 11:40:54PM -0300, Claudio Freire wrote:
> On Mon, Jul 20, 2015 at 11:39 PM, Claudio Freire <klaussfreire at gmail.com> wrote:
> > On Fri, Jul 17, 2015 at 8:42 PM, Michael Niedermayer
> > <michael at niedermayer.cc> wrote:
> >>> If you mean a transition in time, I don't think it makes any
> >>> difference. 0.95 is a ~0.5db change in intensity, which ought to be
> >>> inaudible, and windowing will already take care to make the transition
> >>> smooth. And the logic wouldn't be completely free either to ramp
> >>> gradually, as it would have to ramp fully to 0.95 by the time it
> >>> reaches the first window marked as clipping hazard, and it could very
> >>> well be the frist window.
> >>
> >> what i meant was that whatever condition is used to hard switch
> >> between 1.0 and 0.95 could be rather a soft transition that is
> >> for example
> >> insteda of
> >> if (x > 0.0) f = 0.95
> >>
> >> something like
> >> if (x > 0.0 && x<1.0) f = 1.0 + (0.95 - 1.0)*x
> >>
> >> so theres no discontinuity in the transition
> >
> > Attached is a patch with something like that.
> >
> > 1. It measures per-window minimum clip avoidance factor
> > 2. Computes a whole-frame factor (minimum of all)
> > 3. Applies the clip avoidance factor to the whole frame (to make it
> > smooth and almost linear, and avoid adding harmonic distortion).
> 
> 
> Sorry, that one had trailing whitespace again.
> 
> Attached.

>  libavcodec/aac.h      |    4 +
>  libavcodec/aaccoder.c |  108 ++++++++++++++++++++++++++++++++------------------
>  libavcodec/aacenc.c   |   38 +++++++++++++++++
>  libavcodec/aacenc.h   |    2 
>  libavcodec/aacpsy.c   |   30 +++++++++++++
>  libavcodec/psymodel.h |    1 
>  tests/fate/aac.mak    |    4 -
>  7 files changed, 145 insertions(+), 42 deletions(-)
> fb3816accbd479ea10b2be6c104e28eee81ce743  0001-AAC-Encoder-clipping-avoidance.patch
> From 57522de7c5fcdbef222c2425a4add6fa4528f0e7 Mon Sep 17 00:00:00 2001
> From: Claudio Freire <klaussfreire at gmail.com>
> Date: Mon, 20 Jul 2015 22:53:24 -0300
> Subject: [PATCH] AAC Encoder: clipping avoidance

applied

thanks

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Rewriting code that is poorly written but fully understood is good.
Rewriting code that one doesnt understand is a sign that one is less smart
then the original author, trying to rewrite it will not make it better.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150727/1e052f4b/attachment.sig>


More information about the ffmpeg-devel mailing list