[FFmpeg-devel] [PATCH 3/3] aaccoder: Improve IS phase rejection

Rostislav Pehlivanov atomnuker at gmail.com
Sat Jul 18 03:32:50 CEST 2015


That previous idea discriminated way too many bands for it to be actually
useful. And it would require special cases for coefficients which 'blow up'
and have an insane value.

This method is naive but it handles spikes better since a single spike in
one channel will only cause a single phase to switch among a reasonably
sized number of coefficients summed over.



On 18 July 2015 at 00:32, Claudio Freire <klaussfreire at gmail.com> wrote:

> On Fri, Jul 17, 2015 at 6:20 PM, Rostislav Pehlivanov
> <atomnuker at gmail.com> wrote:
> > This commit adds a slightly more robust way of determining whether the
> phases
> > match or are too different for IS to be used.
> > ---
> >  libavcodec/aaccoder.c | 7 +++++--
> >  1 file changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
> > index 17b14d6..bd232f6 100644
> > --- a/libavcodec/aaccoder.c
> > +++ b/libavcodec/aaccoder.c
> > @@ -56,6 +56,9 @@
> >  /** Frequency in Hz for lower limit of intensity stereo   **/
> >  #define INT_STEREO_LOW_LIMIT 6100
> >
> > +/** If less than this fraction of coeff phases agree disable IS for
> that band **/
> > +#define IS_PHASE_DIFF_LIM 0.11
> > +
> >  /** Total number of usable codebooks **/
> >  #define CB_TOT 12
> >
> > @@ -1218,9 +1221,9 @@ static void search_for_is(AACEncContext *s,
> AVCodecContext *avctx, ChannelElemen
> >                          ener01 += (coef0 + coef1)*(coef0 + coef1);
> >                      }
> >                  }
> > -                if (!phase) { /* Too much phase difference between
> channels */
> > +                if
> (fabs(phase)/(sce0->ics.group_len[w]*sce0->ics.swb_sizes[g]) <
> IS_PHASE_DIFF_LIM) {
> >                      start += sce0->ics.swb_sizes[g];
> > -                    continue;
> > +                    continue; /* Too much phase difference */
> >                  }
> >                  phase = av_clip(phase, -1, 1);
> >                  for (w2 = 0; w2 < sce0->ics.group_len[w]; w2++) {
>
> What happened to the idea of comparing the energies of the addition
> and diferrence and deciding on that?
>
> It looked better at rejecting these cases than this one when we talked
> about it.
>


More information about the ffmpeg-devel mailing list