[libav-commits] Remove need for padding in av_memcpy_backptr()

Mans Rullgard git at libav.org
Tue Oct 23 20:03:07 CEST 2012


Module: libav
Branch: master
Commit: d82f188504410fdfa446c5682c128c31bb5851a4

Author:    Mans Rullgard <mans at mansr.com>
Committer: Mans Rullgard <mans at mansr.com>
Date:      Tue Oct 23 18:05:45 2012 +0100

Remove need for padding in av_memcpy_backptr()

Signed-off-by: Mans Rullgard <mans at mansr.com>

---

 libavutil/lzo.c |   16 ++++++++--------
 libavutil/lzo.h |    2 +-
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/libavutil/lzo.c b/libavutil/lzo.c
index 101d4f4..c17d32f 100644
--- a/libavutil/lzo.c
+++ b/libavutil/lzo.c
@@ -132,13 +132,14 @@ static inline void memcpy_backptr(uint8_t *dst, int back, int cnt)
     if (back == 1) {
         memset(dst, *src, cnt);
     } else {
-#ifdef OUTBUF_PADDED
-        AV_COPY16U(dst,     src);
-        AV_COPY16U(dst + 2, src + 2);
-        src += 4;
-        dst += 4;
-        cnt -= 4;
-        if (cnt > 0) {
+        if (cnt >= 4) {
+            AV_COPY16U(dst,     src);
+            AV_COPY16U(dst + 2, src + 2);
+            src += 4;
+            dst += 4;
+            cnt -= 4;
+        }
+        if (cnt >= 8) {
             AV_COPY16U(dst,     src);
             AV_COPY16U(dst + 2, src + 2);
             AV_COPY16U(dst + 4, src + 4);
@@ -147,7 +148,6 @@ static inline void memcpy_backptr(uint8_t *dst, int back, int cnt)
             dst += 8;
             cnt -= 8;
         }
-#endif
         if (cnt > 0) {
             int blocklen = back;
             while (cnt > blocklen) {
diff --git a/libavutil/lzo.h b/libavutil/lzo.h
index e3c6c01..a84b9bd 100644
--- a/libavutil/lzo.h
+++ b/libavutil/lzo.h
@@ -61,7 +61,7 @@ int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen);
 
 /**
  * @brief deliberately overlapping memcpy implementation
- * @param dst destination buffer; must be padded with 12 additional bytes
+ * @param dst destination buffer
  * @param back how many bytes back we start (the initial size of the overlapping window)
  * @param cnt number of bytes to copy, must be >= 0
  *



More information about the libav-commits mailing list