summaryrefslogtreecommitdiff
path: root/libavutil/intreadwrite.h
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-10-24 14:01:29 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-10-24 14:01:36 +0200
commit5555d2075a26fc778fb8145473100e94d80a00c8 (patch)
tree95d4f5649f7c2410d814b18c7bbe868c82b83cbe /libavutil/intreadwrite.h
parentf3b8096bc0e7df9e45db1023d6e6e7bff177d0c4 (diff)
parentceb754d041f5f6327fd9195a5f43575af9516daa (diff)
downloadffmpeg-5555d2075a26fc778fb8145473100e94d80a00c8.tar.gz
Merge commit 'ceb754d041f5f6327fd9195a5f43575af9516daa'
* commit 'ceb754d041f5f6327fd9195a5f43575af9516daa': lzo: Use AV_COPY*U macros where appropriate prepare 9_beta2 release dsputil: Replace AV_WNxx(AV_RNxx()) combinations by AV_COPYxxU intreadwrite: Add AV_COPYxxU macros for copying to/from unaligned addresses dxtory: Replace AV_WN16A(AV_RN16A()) combination by AV_COPY16 mp3: properly forward mp_decode_frame errors Conflicts: RELEASE libavcodec/mpegaudiodec.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/intreadwrite.h')
-rw-r--r--libavutil/intreadwrite.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/libavutil/intreadwrite.h b/libavutil/intreadwrite.h
index 7c68ead92d..34e21d42fa 100644
--- a/libavutil/intreadwrite.h
+++ b/libavutil/intreadwrite.h
@@ -468,6 +468,33 @@ union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias;
# define AV_WN64A(p, v) AV_WNA(64, p, v)
#endif
+/*
+ * The AV_COPYxxU macros are suitable for copying data to/from unaligned
+ * memory locations.
+ */
+
+#define AV_COPYU(n, d, s) AV_WN##n(d, AV_RN##n(s));
+
+#ifndef AV_COPY16U
+# define AV_COPY16U(d, s) AV_COPYU(16, d, s)
+#endif
+
+#ifndef AV_COPY32U
+# define AV_COPY32U(d, s) AV_COPYU(32, d, s)
+#endif
+
+#ifndef AV_COPY64U
+# define AV_COPY64U(d, s) AV_COPYU(64, d, s)
+#endif
+
+#ifndef AV_COPY128U
+# define AV_COPY128U(d, s) \
+ do { \
+ AV_COPY64U(d, s); \
+ AV_COPY64U((char *)(d) + 8, (const char *)(s) + 8); \
+ } while(0)
+#endif
+
/* Parameters for AV_COPY*, AV_SWAP*, AV_ZERO* must be
* naturally aligned. They may be implemented using MMX,
* so emms_c() must be called before using any float code