[FFmpeg-devel] [PATCH 2/5] truehd: break out part of rematrix_channels into platform-specific callback.

Michael Niedermayer michaelni at gmx.at
Thu Mar 20 03:07:42 CET 2014


On Thu, Mar 20, 2014 at 02:43:36AM +0100, Michael Niedermayer wrote:
> On Thu, Mar 20, 2014 at 12:47:20AM +0000, Ben Avison wrote:
> > Verified with profiling that this doesn't have a measurable effect upon
> > overall performance.
> > ---
> >  libavcodec/mlpdec.c |   37 ++++++++++++-------------------------
> >  libavcodec/mlpdsp.c |   33 +++++++++++++++++++++++++++++++++
> >  libavcodec/mlpdsp.h |   23 +++++++++++++++++++++++
> >  3 files changed, 68 insertions(+), 25 deletions(-)
> > 
> > diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
> > index 93ed552..90f04e5 100644
> > --- a/libavcodec/mlpdec.c
> > +++ b/libavcodec/mlpdec.c
> > @@ -1017,7 +1017,7 @@ static void fill_noise_buffer(MLPDecodeContext *m, unsigned int substr)
> >  static void rematrix_channels(MLPDecodeContext *m, unsigned int substr)
> >  {
> >      SubStream *s = &m->substream[substr];
> > -    unsigned int mat, src_ch, i;
> > +    unsigned int mat;
> >      unsigned int maxchan;
> >  
> >      maxchan = s->max_matrix_channel;
> > @@ -1029,31 +1029,18 @@ static void rematrix_channels(MLPDecodeContext *m, unsigned int substr)
> >      }
> >  
> >      for (mat = 0; mat < s->num_primitive_matrices; mat++) {
> > -        int matrix_noise_shift = s->matrix_noise_shift[mat];
> >          unsigned int dest_ch = s->matrix_out_ch[mat];
> > -        int32_t mask = MSB_MASK(s->quant_step_size[dest_ch]);
> > -        int32_t *coeffs = s->matrix_coeff[mat];
> > -        int index  = s->num_primitive_matrices - mat;
> > -        int index2 = 2 * index + 1;
> > -
> > -        /* TODO: DSPContext? */
> > -
> > -        for (i = 0; i < s->blockpos; i++) {
> > -            int32_t bypassed_lsb = m->bypassed_lsbs[i][mat];
> > -            int32_t *samples = m->sample_buffer[i];
> > -            int64_t accum = 0;
> > -
> > -            for (src_ch = 0; src_ch <= maxchan; src_ch++)
> > -                accum += (int64_t) samples[src_ch] * coeffs[src_ch];
> > -
> > -            if (matrix_noise_shift) {
> > -                index &= m->access_unit_size_pow2 - 1;
> > -                accum += m->noise_buffer[index] << (matrix_noise_shift + 7);
> > -                index += index2;
> > -            }
> > -
> > -            samples[dest_ch] = ((accum >> 14) & mask) + bypassed_lsb;
> > -        }
> > +        m->dsp.mlp_rematrix_channel(&m->sample_buffer[0][0],
> > +                                    s->matrix_coeff[mat],
> 
> i think matrix_coeff is guranteed to fit in int16_t, this would allow
> simplifying the code

that is using int16 though maybe its not helpfull on arm

also the matrix_coeffs are trivial values for the file i looked at
like 0x3000 or 0x4000
so optimizing for such special cases might be worth it

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If a bugfix only changes things apparently unrelated to the bug with no
further explanation, that is a good sign that the bugfix is wrong.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140320/5300e092/attachment.asc>


More information about the ffmpeg-devel mailing list