• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

libavutil/arm/bswap.h

Go to the documentation of this file.
00001 /*
00002  * This file is part of FFmpeg.
00003  *
00004  * FFmpeg is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2.1 of the License, or (at your option) any later version.
00008  *
00009  * FFmpeg is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public
00015  * License along with FFmpeg; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00017  */
00018 
00019 #ifndef AVUTIL_ARM_BSWAP_H
00020 #define AVUTIL_ARM_BSWAP_H
00021 
00022 #include <stdint.h>
00023 #include "config.h"
00024 #include "libavutil/common.h"
00025 
00026 #if HAVE_ARMV6
00027 #define bswap_16 bswap_16
00028 static av_always_inline av_const uint16_t bswap_16(uint16_t x)
00029 {
00030     __asm__("rev16 %0, %0" : "+r"(x));
00031     return x;
00032 }
00033 #endif
00034 
00035 #define bswap_32 bswap_32
00036 static av_always_inline av_const uint32_t bswap_32(uint32_t x)
00037 {
00038 #if HAVE_ARMV6
00039     __asm__("rev %0, %0" : "+r"(x));
00040 #else
00041     uint32_t t;
00042     __asm__ ("eor %1, %0, %0, ror #16 \n\t"
00043              "bic %1, %1, #0xFF0000   \n\t"
00044              "mov %0, %0, ror #8      \n\t"
00045              "eor %0, %0, %1, lsr #8  \n\t"
00046              : "+r"(x), "=&r"(t));
00047 #endif /* HAVE_ARMV6 */
00048     return x;
00049 }
00050 
00051 #endif /* AVUTIL_ARM_BSWAP_H */

Generated on Tue Nov 4 2014 12:59:24 for ffmpeg by  doxygen 1.7.1