[FFmpeg-devel] [PATCH 1/6] truehd: add hand-scheduled ARM asm version of mlp_filter_channel.

Michael Niedermayer michaelni at gmx.at
Wed Mar 19 18:50:33 CET 2014


On Wed, Mar 19, 2014 at 05:26:16PM +0000, Ben Avison wrote:
> Profiling results for overall audio decode and the mlp_filter_channel(_arm)
> function in particular are as follows:
> 
>               Before          After
>               Mean   StdDev   Mean   StdDev  Confidence  Change
> 6:2 total     380.4  22.0     370.8  17.0    87.4%       +2.6%  (insignificant)
> 6:2 function  60.7   7.2      36.6   8.1     100.0%      +65.8%
> 8:2 total     357.0  17.5     343.2  19.0    97.8%       +4.0%  (insignificant)
> 8:2 function  60.3   8.8      37.3   3.8     100.0%      +61.8%
> 6:6 total     717.2  23.2     658.4  15.7    100.0%      +8.9%
> 6:6 function  140.4  12.9     81.5   9.2     100.0%      +72.4%
> 8:8 total     981.9  16.2     896.2  24.5    100.0%      +9.6%
> 8:8 function  193.4  15.0     103.3  11.5    100.0%      +87.2%
> 
> Experiments with adding preload instructions to this function yielded no
> useful benefit, so these have not been included.
> 
> The assembly version has also been tested with a fuzz tester to ensure that
> any combinations of inputs not exercised by my available test streams still
> generate mathematically identical results to the C version.
> ---
>  libavcodec/arm/Makefile          |    4 +
>  libavcodec/arm/mlpdsp_arm.S      |  431 ++++++++++++++++++++++++++++++++++++++
>  libavcodec/arm/mlpdsp_init_arm.c |   36 ++++
>  libavcodec/mlpdsp.c              |    2 +
>  libavcodec/mlpdsp.h              |    1 +
>  5 files changed, 474 insertions(+), 0 deletions(-)
>  create mode 100644 libavcodec/arm/mlpdsp_arm.S
>  create mode 100644 libavcodec/arm/mlpdsp_init_arm.c
> 
> diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile
> index a8446b2..220c5d4 100644
> --- a/libavcodec/arm/Makefile
> +++ b/libavcodec/arm/Makefile
> @@ -22,9 +22,13 @@ OBJS-$(CONFIG_H264PRED)                += arm/h264pred_init_arm.o
>  OBJS-$(CONFIG_H264QPEL)                += arm/h264qpel_init_arm.o
>  OBJS-$(CONFIG_HPELDSP)                 += arm/hpeldsp_init_arm.o        \
>                                            arm/hpeldsp_arm.o
> +OBJS-$(CONFIG_MLP_DECODER)             += arm/mlpdsp_init_arm.o         \
> +                                          arm/mlpdsp_arm.o
>  OBJS-$(CONFIG_MPEGAUDIODSP)            += arm/mpegaudiodsp_init_arm.o
>  OBJS-$(CONFIG_MPEGVIDEO)               += arm/mpegvideo_arm.o
>  OBJS-$(CONFIG_NEON_CLOBBER_TEST)       += arm/neontest.o
> +OBJS-$(CONFIG_TRUEHD_DECODER)          += arm/mlpdsp_init_arm.o         \
> +                                          arm/mlpdsp_arm.o
>  OBJS-$(CONFIG_VC1_DECODER)             += arm/vc1dsp_init_arm.o
>  OBJS-$(CONFIG_VORBIS_DECODER)          += arm/vorbisdsp_init_arm.o
>  OBJS-$(CONFIG_VP3DSP)                  += arm/vp3dsp_init_arm.o
> diff --git a/libavcodec/arm/mlpdsp_arm.S b/libavcodec/arm/mlpdsp_arm.S
> new file mode 100644
> index 0000000..e0aeb3c
> --- /dev/null
> +++ b/libavcodec/arm/mlpdsp_arm.S
> @@ -0,0 +1,431 @@
> +/*
> + * Copyright (c) 2014 RISC OS Open Ltd
> + * Author: Ben Avison <bavison at riscosopen.org>
> + *
> + * 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
> + */
> +

> +// This code uses too many ARM-only tricks to easily assemble as Thumb
> +.arm
> +#undef CONFIG_THUMB
> +#define CONFIG_THUMB 0

this results in a warning when config.h is included later

In file included from fmpeg/libavutil/arm/asm.S:21:0,
                 from fmpeg/libavcodec/arm/mlpdsp_arm.S:27:
./config.h:462:0: warning: "CONFIG_THUMB" redefined
fmpeg/libavcodec/arm/mlpdsp_arm.S:25:0: note: this is the location of the previous definition


also compilation fails with:

ffmpeg/libavcodec/arm/mlpdsp_arm.S:405: Error: cannot use register index with PC-relative addressing -- `ldr pc,[pc,a4,LSL#2]'
ffmpeg/libavcodec/arm/mlpdsp_arm.S:405: Error: cannot use register index with PC-relative addressing -- `ldr pc,[pc,a3,LSL#2]'
CC      libavcodec/diracdsp.o
ffmpeg/libavcodec/arm/mlpdsp_arm.S:405: Error: cannot use register index with PC-relative addressing -- `ldr pc,[pc,a3,LSL#2]'
ffmpeg/libavcodec/arm/mlpdsp_arm.S:405: Error: cannot use register index with PC-relative addressing -- `ldr pc,[pc,a3,LSL#2]'
ffmpeg/libavcodec/arm/mlpdsp_arm.S:405: Error: cannot use register index with PC-relative addressing -- `ldr pc,[pc,a3,LSL#2]'
ffmpeg/libavcodec/arm/mlpdsp_arm.S:406: Error: cannot use register index with PC-relative addressing -- `ldr pc,[pc,a4,LSL#2]'
ffmpeg/libavcodec/arm/mlpdsp_arm.S:406: Error: cannot use register index with PC-relative addressing -- `ldr pc,[pc,a3,LSL#2]'
ffmpeg/libavcodec/arm/mlpdsp_arm.S:406: Error: cannot use register index with PC-relative addressing -- `ldr pc,[pc,a3,LSL#2]'
ffmpeg/libavcodec/arm/mlpdsp_arm.S:406: Error: cannot use register index with PC-relative addressing -- `ldr pc,[pc,a3,LSL#2]'
ffmpeg/libavcodec/arm/mlpdsp_arm.S:406: Error: cannot use register index with PC-relative addressing -- `ldr pc,[pc,a3,LSL#2]'
ffmpeg/libavcodec/arm/mlpdsp_arm.S:407: Error: cannot use register index with PC-relative addressing -- `ldr pc,[pc,a4,LSL#2]'
ffmpeg/libavcodec/arm/mlpdsp_arm.S:407: Error: cannot use register index with PC-relative addressing -- `ldr pc,[pc,a3,LSL#2]'
ffmpeg/libavcodec/arm/mlpdsp_arm.S:407: Error: shift must be constant -- `orr AC0,AC0,AC1,lsl ST3'
ffmpeg/libavcodec/arm/mlpdsp_arm.S:407: Error: shift must be constant -- `orr AC0,AC0,AC1,lsl ST3'
ffmpeg/libavcodec/arm/mlpdsp_arm.S:407: Error: shift must be constant -- `orr AC0,AC0,AC1,lsl ST3'
ffmpeg/libavcodec/arm/mlpdsp_arm.S:407: Error: shift must be constant -- `orr AC0,AC0,AC1,lsl ST3'
...

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

It is dangerous to be right in matters on which the established authorities
are wrong. -- Voltaire
-------------- 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/20140319/0cff2754/attachment.asc>


More information about the ffmpeg-devel mailing list