The function is used elsewhere and does not belong with the LZO code.
#include "bytestream.h"
#include "libavutil/imgutils.h"
-#include "libavutil/lzo.h" // for av_memcpy_backptr
+#include "libavutil/mem.h"
typedef struct DfaContext {
AVFrame pic;
#include "avcodec.h"
#define BITSTREAM_READER_LE
#include "get_bits.h"
-#include "libavutil/lzo.h"
#include "libavutil/imgutils.h"
+#include "libavutil/mem.h"
#define EA_PREAMBLE_SIZE 8
#define kVGT_TAG MKTAG('k', 'V', 'G', 'T')
#define BITSTREAM_READER_LE
#include "libavutil/audioconvert.h"
-#include "libavutil/lzo.h"
+#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "get_bits.h"
#include <stdio.h>
#include <stdlib.h>
+#include "libavutil/mem.h"
#include "avcodec.h"
#include "bytestream.h"
#include "lcl.h"
-#include "libavutil/lzo.h"
#if CONFIG_ZLIB_DECODER
#include <zlib.h>
#include <math.h>
+#include "libavutil/mem.h"
#include "dsputil.h"
#include "avcodec.h"
#include "get_bits.h"
#include "acelp_vectors.h"
#include "acelp_filters.h"
#include "lsp.h"
-#include "libavutil/lzo.h"
#include "dct.h"
#include "rdft.h"
#include "sinewin.h"
#include <string.h>
#include "libavutil/intreadwrite.h"
+#include "libavutil/mem.h"
#include "avcodec.h"
#include "bytestream.h"
#define BITSTREAM_READER_LE
#include "get_bits.h"
-// for av_memcpy_backptr
-#include "libavutil/lzo.h"
#define RUNTIME_GAMMA 0
#include "avcodec.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/mem.h"
#include "bytestream.h"
#define BITSTREAM_READER_LE
#include "get_bits.h"
-// for av_memcpy_backptr
-#include "libavutil/lzo.h"
typedef struct XanContext {
AVCodecContext *avctx;
c->out = dst + cnt;
}
-static inline void memcpy_backptr(uint8_t *dst, int back, int cnt);
-
/**
* @brief Copies previously decoded bytes to current position.
* @param back how many bytes back we start
cnt = FFMAX(c->out_end - dst, 0);
c->error |= AV_LZO_OUTPUT_FULL;
}
- memcpy_backptr(dst, back, cnt);
+ av_memcpy_backptr(dst, back, cnt);
c->out = dst + cnt;
}
-static inline void memcpy_backptr(uint8_t *dst, int back, int cnt)
-{
- const uint8_t *src = &dst[-back];
- if (back == 1) {
- memset(dst, *src, cnt);
- } else {
- 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);
- AV_COPY16U(dst + 6, src + 6);
- src += 8;
- dst += 8;
- cnt -= 8;
- }
- if (cnt > 0) {
- int blocklen = back;
- while (cnt > blocklen) {
- memcpy(dst, src, blocklen);
- dst += blocklen;
- cnt -= blocklen;
- blocklen <<= 1;
- }
- memcpy(dst, src, cnt);
- }
- }
-}
-
-void av_memcpy_backptr(uint8_t *dst, int back, int cnt)
-{
- memcpy_backptr(dst, back, cnt);
-}
-
int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen)
{
int state = 0;
*/
int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen);
-/**
- * @brief deliberately overlapping memcpy implementation
- * @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
- *
- * cnt > back is valid, this will copy the bytes we just copied,
- * thus creating a repeating pattern with a period length of back.
- */
-void av_memcpy_backptr(uint8_t *dst, int back, int cnt);
-
/**
* @}
*/
#include "config.h"
#include <limits.h>
+#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#if HAVE_MALLOC_H
#endif
#include "avutil.h"
+#include "intreadwrite.h"
#include "mem.h"
/* here we can use OS-dependent allocation functions */
}
return ptr;
}
+
+void av_memcpy_backptr(uint8_t *dst, int back, int cnt)
+{
+ const uint8_t *src = &dst[-back];
+ if (back == 1) {
+ memset(dst, *src, cnt);
+ } else {
+ 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);
+ AV_COPY16U(dst + 6, src + 6);
+ src += 8;
+ dst += 8;
+ cnt -= 8;
+ }
+ if (cnt > 0) {
+ int blocklen = back;
+ while (cnt > blocklen) {
+ memcpy(dst, src, blocklen);
+ dst += blocklen;
+ cnt -= blocklen;
+ blocklen <<= 1;
+ }
+ memcpy(dst, src, cnt);
+ }
+ }
+}
#define AVUTIL_MEM_H
#include <limits.h>
+#include <stdint.h>
#include "attributes.h"
#include "avutil.h"
*/
void av_freep(void *ptr);
+/**
+ * @brief deliberately overlapping memcpy implementation
+ * @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
+ *
+ * cnt > back is valid, this will copy the bytes we just copied,
+ * thus creating a repeating pattern with a period length of back.
+ */
+void av_memcpy_backptr(uint8_t *dst, int back, int cnt);
+
/**
* @}
*/