summaryrefslogtreecommitdiff
path: root/libavutil/lzo.c
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/lzo.c
parentf3b8096bc0e7df9e45db1023d6e6e7bff177d0c4 (diff)
parentceb754d041f5f6327fd9195a5f43575af9516daa (diff)
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/lzo.c')
-rw-r--r--libavutil/lzo.c28
1 files changed, 8 insertions, 20 deletions
diff --git a/libavutil/lzo.c b/libavutil/lzo.c
index 79b1ce23ce..c76d9a86d3 100644
--- a/libavutil/lzo.c
+++ b/libavutil/lzo.c
@@ -23,6 +23,7 @@
#include "avutil.h"
#include "common.h"
+#include "intreadwrite.h"
#include "lzo.h"
/// Define if we may write up to 12 bytes beyond the output buffer.
@@ -71,19 +72,6 @@ static inline int get_len(LZOContext *c, int x, int mask)
return cnt;
}
-//#define UNALIGNED_LOADSTORE
-#define BUILTIN_MEMCPY
-#ifdef UNALIGNED_LOADSTORE
-#define COPY2(d, s) *(uint16_t *)(d) = *(uint16_t *)(s);
-#define COPY4(d, s) *(uint32_t *)(d) = *(uint32_t *)(s);
-#elif defined(BUILTIN_MEMCPY)
-#define COPY2(d, s) memcpy(d, s, 2);
-#define COPY4(d, s) memcpy(d, s, 4);
-#else
-#define COPY2(d, s) (d)[0] = (s)[0]; (d)[1] = (s)[1];
-#define COPY4(d, s) (d)[0] = (s)[0]; (d)[1] = (s)[1]; (d)[2] = (s)[2]; (d)[3] = (s)[3];
-#endif
-
/**
* @brief Copies bytes from input to output buffer with checking.
* @param cnt number of bytes to copy, must be >= 0
@@ -101,7 +89,7 @@ static inline void copy(LZOContext *c, int cnt)
c->error |= AV_LZO_OUTPUT_FULL;
}
#if defined(INBUF_PADDED) && defined(OUTBUF_PADDED)
- COPY4(dst, src);
+ AV_COPY32U(dst, src);
src += 4;
dst += 4;
cnt -= 4;
@@ -145,16 +133,16 @@ static inline void memcpy_backptr(uint8_t *dst, int back, int cnt)
memset(dst, *src, cnt);
} else {
#ifdef OUTBUF_PADDED
- COPY2(dst, src);
- COPY2(dst + 2, src + 2);
+ AV_COPY16U(dst, src);
+ AV_COPY16U(dst + 2, src + 2);
src += 4;
dst += 4;
cnt -= 4;
if (cnt > 0) {
- COPY2(dst, src);
- COPY2(dst + 2, src + 2);
- COPY2(dst + 4, src + 4);
- COPY2(dst + 6, src + 6);
+ AV_COPY16U(dst, src);
+ AV_COPY16U(dst + 2, src + 2);
+ AV_COPY16U(dst + 4, src + 4);
+ AV_COPY16U(dst + 6, src + 6);
src += 8;
dst += 8;
cnt -= 8;