aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/intreadwrite.h
diff options
context:
space:
mode:
authorPeter Ross <pross@xvid.org>2019-01-07 22:12:13 +1100
committerPeter Ross <pross@xvid.org>2019-01-11 23:43:37 +1100
commitb4e6d1f597a3d299176cebb42f1cf60e891a259a (patch)
tree6c18bf6e35565ebf24f1b9e72ffff342c757e9f3 /libavutil/intreadwrite.h
parentc563513fdf7281e2a348fc18c58c51ad5608ed6a (diff)
downloadffmpeg-b4e6d1f597a3d299176cebb42f1cf60e891a259a.tar.gz
intreadwrite: add AV_RL64A, AV_WL64A
macros for reading and writing 64-bit aligned little-endian values. these macros are used by the DST decoder and give a performance boost on platforms that where the compiler must guard against unaligned memory access.
Diffstat (limited to 'libavutil/intreadwrite.h')
-rw-r--r--libavutil/intreadwrite.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/libavutil/intreadwrite.h b/libavutil/intreadwrite.h
index 67c763b135..4c8413a536 100644
--- a/libavutil/intreadwrite.h
+++ b/libavutil/intreadwrite.h
@@ -542,6 +542,21 @@ union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias;
# define AV_WN64A(p, v) AV_WNA(64, p, v)
#endif
+#if AV_HAVE_BIGENDIAN
+# define AV_RLA(s, p) av_bswap##s(AV_RN##s##A(p))
+# define AV_WLA(s, p, v) AV_WN##s##A(p, av_bswap##s(v))
+#else
+# define AV_RLA(s, p) AV_RN##s##A(p)
+# define AV_WLA(s, p, v) AV_WN##s##A(p, v)
+#endif
+
+#ifndef AV_RL64A
+# define AV_RL64A(p) AV_RLA(64, p)
+#endif
+#ifndef AV_WL64A
+# define AV_WL64A(p, v) AV_WLA(64, p, v)
+#endif
+
/*
* The AV_COPYxxU macros are suitable for copying data to/from unaligned
* memory locations.