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

Claudio Freire klaussfreire at gmail.com
Thu Jul 30 08:31:21 CEST 2015


On Wed, Jul 29, 2015 at 4:15 PM, Michael Niedermayer
<michael at niedermayer.cc> wrote:
> On Mon, Jul 27, 2015 at 07:28:35PM +0200, Michael Niedermayer wrote:
>> 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
>
> it seems this breaks mips-qemu


It does, I know what it is. I'll get a patch to fix it ASAP


More information about the ffmpeg-devel mailing list