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

Babic, Nedeljko nbabic at mips.com
Wed Jul 11 15:22:37 CEST 2012


>> >> >> 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.

________________________________________
From: ffmpeg-devel-bounces at ffmpeg.org [ffmpeg-devel-bounces at ffmpeg.org] on behalf of Michael Niedermayer [michaelni at gmx.at]
Sent: Wednesday, July 11, 2012 14:30
To: FFmpeg development discussions and patches
Subject: Re: [FFmpeg-devel] [PATCH 1/2] Optimization of AC3 floating    point   decoder for MIPS

On Wed, Jul 11, 2012 at 11:53:45AM +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 ?

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

What does censorship reveal? It reveals fear. -- Julian Assange


More information about the ffmpeg-devel mailing list