Mercurial > libavutil.hg
annotate arm/intreadwrite.h @ 1028:5dbb12a37c3d libavutil tip
Move av_set_options_string() from libavfilter to libavutil.
| author | stefano |
|---|---|
| date | Mon, 27 Sep 2010 22:09:53 +0000 |
| parents | 0a18c400e946 |
| children |
| rev | line source |
|---|---|
| 728 | 1 /* |
| 2 * This file is part of FFmpeg. | |
| 3 * | |
| 4 * FFmpeg is free software; you can redistribute it and/or | |
| 5 * modify it under the terms of the GNU Lesser General Public | |
| 6 * License as published by the Free Software Foundation; either | |
| 7 * version 2.1 of the License, or (at your option) any later version. | |
| 8 * | |
| 9 * FFmpeg is distributed in the hope that it will be useful, | |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 12 * Lesser General Public License for more details. | |
| 13 * | |
| 14 * You should have received a copy of the GNU Lesser General Public | |
| 15 * License along with FFmpeg; if not, write to the Free Software | |
| 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
| 17 */ | |
| 18 | |
| 19 #ifndef AVUTIL_ARM_INTREADWRITE_H | |
| 20 #define AVUTIL_ARM_INTREADWRITE_H | |
| 21 | |
| 22 #include <stdint.h> | |
| 23 #include "config.h" | |
| 24 | |
| 25 #if HAVE_FAST_UNALIGNED && HAVE_INLINE_ASM | |
| 26 | |
| 27 #define AV_RN16 AV_RN16 | |
| 1023 | 28 static av_always_inline unsigned AV_RN16(const void *p) |
| 728 | 29 { |
| 1023 | 30 unsigned v; |
| 728 | 31 __asm__ ("ldrh %0, %1" : "=r"(v) : "m"(*(const uint16_t *)p)); |
| 32 return v; | |
| 33 } | |
| 34 | |
| 35 #define AV_WN16 AV_WN16 | |
| 812 | 36 static av_always_inline void AV_WN16(void *p, uint16_t v) |
| 728 | 37 { |
| 38 __asm__ ("strh %1, %0" : "=m"(*(uint16_t *)p) : "r"(v)); | |
| 39 } | |
| 40 | |
| 41 #define AV_RN32 AV_RN32 | |
| 812 | 42 static av_always_inline uint32_t AV_RN32(const void *p) |
| 728 | 43 { |
| 44 uint32_t v; | |
| 45 __asm__ ("ldr %0, %1" : "=r"(v) : "m"(*(const uint32_t *)p)); | |
| 46 return v; | |
| 47 } | |
| 48 | |
| 49 #define AV_WN32 AV_WN32 | |
| 812 | 50 static av_always_inline void AV_WN32(void *p, uint32_t v) |
| 728 | 51 { |
| 52 __asm__ ("str %1, %0" : "=m"(*(uint32_t *)p) : "r"(v)); | |
| 53 } | |
| 54 | |
| 55 #define AV_RN64 AV_RN64 | |
| 812 | 56 static av_always_inline uint64_t AV_RN64(const void *p) |
| 728 | 57 { |
| 58 union { uint64_t v; uint32_t hl[2]; } v; | |
| 59 __asm__ ("ldr %0, %2 \n\t" | |
| 60 "ldr %1, %3 \n\t" | |
|
765
2d52bcf3e4e6
ARM: first value loaded in AV_RN64 needs to be early-clobber
mru
parents:
728
diff
changeset
|
61 : "=&r"(v.hl[0]), "=r"(v.hl[1]) |
| 728 | 62 : "m"(*(const uint32_t*)p), "m"(*((const uint32_t*)p+1))); |
| 63 return v.v; | |
| 64 } | |
| 65 | |
| 66 #define AV_WN64 AV_WN64 | |
| 812 | 67 static av_always_inline void AV_WN64(void *p, uint64_t v) |
| 728 | 68 { |
| 69 union { uint64_t v; uint32_t hl[2]; } vv = { v }; | |
| 70 __asm__ ("str %2, %0 \n\t" | |
| 71 "str %3, %1 \n\t" | |
| 72 : "=m"(*(uint32_t*)p), "=m"(*((uint32_t*)p+1)) | |
| 73 : "r"(vv.hl[0]), "r"(vv.hl[1])); | |
| 74 } | |
| 75 | |
| 76 #endif /* HAVE_INLINE_ASM */ | |
| 77 | |
| 78 #endif /* AVUTIL_ARM_INTREADWRITE_H */ |
