[FFmpeg-devel] [PATCH 1/2] Optimization of AC3 floating point decoder for MIPS

Michael Niedermayer michaelni at gmx.at
Thu Jul 12 02:49:37 CEST 2012


On Wed, Jul 11, 2012 at 01:22:37PM +0000, Babic, Nedeljko wrote:
> >> >> >> FFT in MIPS implementation is working iteratively instead
> >> >> >>  of "recursively" calling functions for smaller FFT sizes.
> >> >> >> Some of DSP and format convert utils functions are also optimized.
> >> >> >[...]
> >> >> >> diff --git a/libavcodec/mips/fmtconvert_mips.c b/libavcodec/mips/fmtconvert_mips.c
> >> >> >> new file mode 100644
> >> >> >> index 0000000..9e45ba1
> >> >> >> --- /dev/null
> >> >> >> +++ b/libavcodec/mips/fmtconvert_mips.c
> >> >> >> @@ -0,0 +1,336 @@
> >> >> >> +/*
> >> >> >> + * Format Conversion Utils for MIPS
> >> >> >> + *
> >> >> >> + * Copyright (c) 2012
> >> >> >> + *      MIPS Technologies, Inc., California.
> >> >> >> + *
> >> >> >> + * Redistribution and use in source and binary forms, with or without
> >> >> >> + * modification, are permitted provided that the following conditions
> >> >> >> + * are met:
> >> >> >> + * 1. Redistributions of source code must retain the above copyright
> >> >> >> + *    notice, this list of conditions and the following disclaimer.
> >> >> >> + * 2. Redistributions in binary form must reproduce the above copyright
> >> >> >> + *    notice, this list of conditions and the following disclaimer in the
> >> >> >> + *    documentation and/or other materials provided with the distribution.
> >> >> >> + * 3. Neither the name of the MIPS Technologies, Inc., nor the names of is
> >> >> >> + *    contributors may be used to endorse or promote products derived from
> >> >> >> + *    this software without specific prior written permission.
> >> >> >> + *
> >> >> >> + * THIS SOFTWARE IS PROVIDED BY THE MIPS TECHNOLOGIES, INC. ``AS IS'' AND
> >> >> >> + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> >> >> >> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> >> >> >> + * ARE DISCLAIMED.  IN NO EVENT SHALL THE MIPS TECHNOLOGIES, INC. BE LIABLE
> >> >> >> + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
> >> >> >> + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
> >> >> >> + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> >> >> >> + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
> >> >> >> + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
> >> >> >> + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> >> >> >> + * SUCH DAMAGE.
> >> >> >> + *
> >> >> >> + * Author:  Zoran Lukic (zoranl at mips.com)
> >> >> >> + * Author:  Nedeljko Babic (nbabic at mips.com)
> >> >> >> + *
> >> >> >> + * This file is part of FFmpeg.
> >> >> >> + *
> >> >> >> + * FFmpeg is free software; you can redistribute it and/or
> >> >> >> + * modify it under the terms of the GNU Lesser General Public
> >> >> >> + * License as published by the Free Software Foundation; either
> >> >> >> + * version 2.1 of the License, or (at your option) any later version.
> >> >> >> + *
> >> >> >> + * FFmpeg is distributed in the hope that it will be useful,
> >> >> >> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> >> >> >> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> >> >> >> + * Lesser General Public License for more details.
> >> >> >> + *
> >> >> >> + * You should have received a copy of the GNU Lesser General Public
> >> >> >> + * License along with FFmpeg; if not, write to the Free Software
> >> >> >> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> >> >> >> + */
> >> >> >> +#include "config.h"
> >> >> >> +#include "libavcodec/avcodec.h"
> >> >> >> +#include "libavcodec/fmtconvert.h"
> >> >> >> +
> >> >> >> +#if HAVE_INLINE_ASM
> >> >> >
> >> >> >if all code in the whole file depends on HAVE_INLINE_ASM then it
> >> >> >would be easiest to change the Makefile to only compile it in that
> >> >> >case instead of the #ifs
> >> >> >
> >> >> 
> >> >> To tell the truth, I am not sure how to do this in elegant way...
> >> >> Only place that something similar is done in ffmpeg is in optimizations for x86
> >> >> and there it is done in the same way as it is done here (file 
> >> >> libavcodec/x86/cavsdsp_mmx.c for example). 
> >> >> I am thinking of using ifeq in Makefile, but I am not sure this is a 
> >> >> right way of doing this...
> >> >> Is there a better way?
> >> >
> >> >the following should work:
> >> >MIPSFPU-OBJS-$(HAVE_INLINE_ASM)        += mips/fmtconvert_mips.o
> >> 
> >> Yes, but there is already:
> >> MIPSFPU-OBJS-$(CONFIG_AC3_DECODER)        += mips/fmtconvert_mips.o
> >
> >why is fmtconvert_mips conditional on AC3 ?
> 
> Since this optimization was done during optimization of AC3 decoder, it was 
> tested only on AC3 and hence it is conditional on it.
> 
> I will run fate tests with 
> MIPSFPU-OBJS-$(HAVE_INLINE_ASM)        += mips/fmtconvert_mips.o
> and if nothing brakes, I will add this change in next patch.

ok, thanks

btw, speaking about fate, the only mips fate client on fate.ffmpeg.org
that we have currently is a qemu emulation based one and qemu does
seem not to support the new optimiztaions.
I was wondering if there would be interrest from someone at mips to
run a fate client via cronjob or similar on real mips hardware.
That would ensure that any ffmpeg on mips breakages that might happen
in the future would be detected early (and would also be fixed early)
?

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

It is what and why we do it that matters, not just one of them.
-------------- 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/20120712/48244268/attachment.asc>


More information about the ffmpeg-devel mailing list