[FFmpeg-devel] A ppc patch to fix the fft bug in little endianenvironment for POWER

Michael Niedermayer michaelni at gmx.at
Tue Jun 17 16:43:51 CEST 2014


On Tue, Jun 17, 2014 at 04:49:00PM +0800, rongyan wrote:
> Hi,
>  I have corrected to the issues on:
> http://permalink.gmane.org/gmane.comp.video.ffmpeg.devel/178856
> 
>  And the patch is attached in this email.
>  Thanks.
>   
>  Rong Yan
>   
> 
>  
> 
>  ------------------ Original ------------------
>   From:  "michaelni";<michaelni at gmx.at>;
>  Date:  Wed, Jun 11, 2014 08:55 PM
>  To:  "FFmpeg development discussions and patches"<ffmpeg-devel at ffmpeg.org>; 
>  
>  Subject:  Re: [FFmpeg-devel] A ppc patch to fix the fft bug in little endianenvironment for POWER
> 
>  
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

>  configure                    |   26 +
>  libavcodec/ppc/Makefile      |    1 
>  libavcodec/ppc/fft_altivec.c |   12 
>  libavcodec/ppc/fft_vsx.c     |  228 +++++++++++
>  libavcodec/ppc/fft_vsx.h     |  830 +++++++++++++++++++++++++++++++++++++++++++
>  5 files changed, 1096 insertions(+), 1 deletion(-)
> cb2982b7f9c2e173ec7e94646400770b21888a37  0001-ppc-Fix-the-bug-of-fft-for-little-endian-environment.patch
> From abfa41c26694c4ec714c015bfe46d055fd214e0c Mon Sep 17 00:00:00 2001
> From: Rong Yan <rongyan236 at gmail.com>
> Date: Tue, 17 Jun 2014 04:37:31 -0400
> Subject: [PATCH] ppc: Fix the bug of fft for little endian environment on POWER7
> 
> ---
>  configure                    |   26 ++-
>  libavcodec/ppc/Makefile      |    1 +
>  libavcodec/ppc/fft_altivec.c |   12 +
>  libavcodec/ppc/fft_vsx.c     |  228 ++++++++++++
>  libavcodec/ppc/fft_vsx.h     |  830 ++++++++++++++++++++++++++++++++++++++++++
>  5 files changed, 1096 insertions(+), 1 deletions(-)
>  create mode 100644 libavcodec/ppc/fft_vsx.c
>  create mode 100644 libavcodec/ppc/fft_vsx.h
> 
> diff --git a/configure b/configure
> index 4f909a0..3dd7820 100755
> --- a/configure
> +++ b/configure
> @@ -1548,6 +1548,7 @@ ARCH_EXT_LIST_PPC="
>      dcbzl
>      ldbrx
>      ppc4xx
> +    vsx
>  "
>  
>  ARCH_EXT_LIST_X86="
> @@ -1933,6 +1934,7 @@ mipsdspr2_deps="mips"
>  
>  altivec_deps="ppc"
>  ppc4xx_deps="ppc"
> +vsx_deps="ppc"
>  
>  cpunop_deps="i686"
>  x86_64_select="i686"
> @@ -3691,6 +3693,7 @@ elif enabled mips; then
>  elif enabled ppc; then
>  
>      disable ldbrx
> +    disable vsx
>  
>      case $(tolower $cpu) in
>          601|ppc601|powerpc601)
> @@ -3718,9 +3721,22 @@ elif enabled ppc; then
>          g5|970|ppc970|powerpc970)
>              cpuflags="-mcpu=970"
>          ;;
> -        power[3-7]*)
> +        power[3-6]*)
>              cpuflags="-mcpu=$cpu"
>          ;;
> +        power7*)
> +        check_cc <<EOF || die "endian test failed"
> +unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
> +EOF
> +        od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable power_bigendian
> +
> +        cpuflags="-mcpu=$cpu"
> +        if enabled power_bigendian; then
> +            disable vsx
> +        else
> +            enable vsx
> +        fi
> +        ;;

please move the vsx code after the big endian test instead of
duplicating the test
also some compilers like clang can build for both big and little
endian so mcpu might theoretically be needed to be set before testing
for big endian


>          cell)
>              cpuflags="-mcpu=cell"
>              enable ldbrx
> @@ -4415,6 +4431,13 @@ EOF
>          enabled altivec || warn "Altivec disabled, possibly missing --cpu flag"
>      fi
>  
> +    if enabled vsx; then
> +        if ! enabled_any pic ppc64; then
> +            nogas=warn
> +        fi

> +        check_cflags -mvsx
> +        enabled vsx || warn "Vsx disabled, possibly missing --cpu flag"

i dont think this works
failure of the check_cflags wont disable vsx unless i miss something

Thanks

[...]

--
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: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140617/55f65425/attachment.asc>


More information about the ffmpeg-devel mailing list