annotate libavutil/arm/bswap.h @ 8:6c1433f5a562

remove need for end_thread()
author Nina Engelhardt <nengel@mailbox.tu-berlin.de>
date Fri, 17 May 2013 17:50:05 +0200
parents
children
rev   line source
nengel@2 1 /*
nengel@2 2 * This file is part of FFmpeg.
nengel@2 3 *
nengel@2 4 * FFmpeg is free software; you can redistribute it and/or
nengel@2 5 * modify it under the terms of the GNU Lesser General Public
nengel@2 6 * License as published by the Free Software Foundation; either
nengel@2 7 * version 2.1 of the License, or (at your option) any later version.
nengel@2 8 *
nengel@2 9 * FFmpeg is distributed in the hope that it will be useful,
nengel@2 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
nengel@2 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
nengel@2 12 * Lesser General Public License for more details.
nengel@2 13 *
nengel@2 14 * You should have received a copy of the GNU Lesser General Public
nengel@2 15 * License along with FFmpeg; if not, write to the Free Software
nengel@2 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
nengel@2 17 */
nengel@2 18
nengel@2 19 #ifndef AVUTIL_ARM_BSWAP_H
nengel@2 20 #define AVUTIL_ARM_BSWAP_H
nengel@2 21
nengel@2 22 #include <stdint.h>
nengel@2 23 #include "config.h"
nengel@2 24 #include "libavutil/attributes.h"
nengel@2 25
nengel@2 26 #ifdef __ARMCC_VERSION
nengel@2 27
nengel@2 28 #if HAVE_ARMV6
nengel@2 29 #define bswap_16 bswap_16
nengel@2 30 static av_always_inline av_const unsigned bswap_16(unsigned x)
nengel@2 31 {
nengel@2 32 __asm { rev16 x, x }
nengel@2 33 return x;
nengel@2 34 }
nengel@2 35
nengel@2 36 #define bswap_32 bswap_32
nengel@2 37 static av_always_inline av_const uint32_t bswap_32(uint32_t x)
nengel@2 38 {
nengel@2 39 return __rev(x);
nengel@2 40 }
nengel@2 41 #endif /* HAVE_ARMV6 */
nengel@2 42
nengel@2 43 #elif HAVE_INLINE_ASM
nengel@2 44
nengel@2 45 #if HAVE_ARMV6
nengel@2 46 #define bswap_16 bswap_16
nengel@2 47 static av_always_inline av_const unsigned bswap_16(unsigned x)
nengel@2 48 {
nengel@2 49 __asm__("rev16 %0, %0" : "+r"(x));
nengel@2 50 return x;
nengel@2 51 }
nengel@2 52 #endif
nengel@2 53
nengel@2 54 #define bswap_32 bswap_32
nengel@2 55 static av_always_inline av_const uint32_t bswap_32(uint32_t x)
nengel@2 56 {
nengel@2 57 #if HAVE_ARMV6
nengel@2 58 __asm__("rev %0, %0" : "+r"(x));
nengel@2 59 #else
nengel@2 60 uint32_t t;
nengel@2 61 __asm__ ("eor %1, %0, %0, ror #16 \n\t"
nengel@2 62 "bic %1, %1, #0xFF0000 \n\t"
nengel@2 63 "mov %0, %0, ror #8 \n\t"
nengel@2 64 "eor %0, %0, %1, lsr #8 \n\t"
nengel@2 65 : "+r"(x), "=&r"(t));
nengel@2 66 #endif /* HAVE_ARMV6 */
nengel@2 67 return x;
nengel@2 68 }
nengel@2 69
nengel@2 70 #endif /* __ARMCC_VERSION */
nengel@2 71
nengel@2 72 #endif /* AVUTIL_ARM_BSWAP_H */