[FFmpeg-devel] [PATCH] dsputil: add bswap16_buf()
Reimar Döffinger
Reimar.Doeffinger
Fri Mar 11 18:43:51 CET 2011
On Fri, Mar 11, 2011 at 12:12:29AM +0000, Mans Rullgard wrote:
> There several places where a buffer is byte-swapped in 16-bit units.
> This allows them to share code which can be optimised for various
> architectures.
>
> Signed-off-by: Mans Rullgard <mans at mansr.com>
> ---
> libavcodec/dsputil.c | 7 +++++++
> libavcodec/dsputil.h | 1 +
> 2 files changed, 8 insertions(+), 0 deletions(-)
>
> diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c
> index 1f7bd4c..b293642 100644
> --- a/libavcodec/dsputil.c
> +++ b/libavcodec/dsputil.c
> @@ -222,6 +222,12 @@ static void bswap_buf(uint32_t *dst, const uint32_t *src, int w){
> }
> }
>
> +static void bswap16_buf(uint16_t *dst, const uint16_t *src, int len)
> +{
> + while (len--)
> + *dst++ = av_bswap16(*src++);
> +}
Shouldn't this be unrolled like bswap_buf, for consistency at least if nothing else?
More information about the ffmpeg-devel
mailing list