[FFmpeg-devel] [PATCH] ARMv6 bswap

Måns Rullgård mans
Wed Sep 5 10:28:53 CEST 2007


Siarhei Siamashka <siarhei.siamashka at gmail.com> writes:

> Hello All,
>
> ARMv6 has instructions for swapping bytes, a patch for using them is
> attached.  A minor performance improvement can be observed on MP3
> decoding (benchmarked with mplayer).

[...]

> Except for 'flashsv' which fails to work with A32_BITSTREAM_READER properly,
> ffmpeg regression tests passed (using Nokia N800, chrooted into
> debian EABI rootfs) with this bswap patch applied and also with an older
> dsputil patch which would be also very nice to get committed:
> http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2007-April/028133.html
> http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2007-April/028153.html
>
> Index: libavutil/bswap.h
> ===================================================================
> --- libavutil/bswap.h	(revision 10281)
> +++ libavutil/bswap.h	(working copy)
> @@ -47,6 +47,8 @@
>          "0" (x));
>  #elif defined(ARCH_SH4)
>          __asm__("swap.b %0,%0":"=r"(x):"0"(x));
> +#elif defined(ARCH_ARM) && defined(HAVE_ARMV6)

HAVE_ARMV6 implies ARCH_ARM so only the former needs to be tested.

> +        __asm__("rev16 %0,%0":"=r"(x):"0"(x));
>  #else
>      x= (x>>8) | (x<<8);
>  #endif
> @@ -72,6 +74,8 @@
>          "swap.w %0,%0\n"
>          "swap.b %0,%0\n"
>          :"=r"(x):"0"(x));
> +#elif defined(ARCH_ARM) && defined(HAVE_ARMV6)
> +    __asm__("rev %0,%0":"=r"(x):"0"(x));
>  #elif defined(ARCH_ARM)
>      uint32_t t;
>      __asm__ (
>

Patch is OK as such.  However, I don't like the way inline assembler
is being sprinkled across various files.  I'd prefer we cleaned that
up before adding more of it.

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-devel mailing list