Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
5bac2d0c
Commit
5bac2d0c
authored
Oct 18, 2012
by
Diego Biurrun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avutil: Move memcpy_backptr() to mem.c
The function is used elsewhere and does not belong with the LZO code.
parent
a6e9d649
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
57 additions
and
63 deletions
+57
-63
dfa.c
libavcodec/dfa.c
+1
-1
eatgv.c
libavcodec/eatgv.c
+1
-1
g723_1.c
libavcodec/g723_1.c
+1
-1
lcldec.c
libavcodec/lcldec.c
+1
-1
wmavoice.c
libavcodec/wmavoice.c
+1
-1
xan.c
libavcodec/xan.c
+1
-2
xxan.c
libavcodec/xxan.c
+1
-2
lzo.c
libavutil/lzo.c
+1
-43
lzo.h
libavutil/lzo.h
+0
-11
mem.c
libavutil/mem.c
+37
-0
mem.h
libavutil/mem.h
+12
-0
No files found.
libavcodec/dfa.c
View file @
5bac2d0c
...
...
@@ -24,7 +24,7 @@
#include "bytestream.h"
#include "libavutil/imgutils.h"
#include "libavutil/
lzo.h" // for av_memcpy_backptr
#include "libavutil/
mem.h"
typedef
struct
DfaContext
{
AVFrame
pic
;
...
...
libavcodec/eatgv.c
View file @
5bac2d0c
...
...
@@ -31,8 +31,8 @@
#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')
...
...
libavcodec/g723_1.c
View file @
5bac2d0c
...
...
@@ -27,7 +27,7 @@
#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"
...
...
libavcodec/lcldec.c
View file @
5bac2d0c
...
...
@@ -41,10 +41,10 @@
#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>
...
...
libavcodec/wmavoice.c
View file @
5bac2d0c
...
...
@@ -29,6 +29,7 @@
#include <math.h>
#include "libavutil/mem.h"
#include "dsputil.h"
#include "avcodec.h"
#include "get_bits.h"
...
...
@@ -38,7 +39,6 @@
#include "acelp_vectors.h"
#include "acelp_filters.h"
#include "lsp.h"
#include "libavutil/lzo.h"
#include "dct.h"
#include "rdft.h"
#include "sinewin.h"
...
...
libavcodec/xan.c
View file @
5bac2d0c
...
...
@@ -33,12 +33,11 @@
#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
...
...
libavcodec/xxan.c
View file @
5bac2d0c
...
...
@@ -22,11 +22,10 @@
#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
;
...
...
libavutil/lzo.c
View file @
5bac2d0c
...
...
@@ -100,8 +100,6 @@ static inline void copy(LZOContext *c, int cnt)
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
...
...
@@ -122,50 +120,10 @@ static inline void copy_backptr(LZOContext *c, int back, int cnt)
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
;
...
...
libavutil/lzo.h
View file @
5bac2d0c
...
...
@@ -59,17 +59,6 @@
*/
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
);
/**
* @}
*/
...
...
libavutil/mem.c
View file @
5bac2d0c
...
...
@@ -27,6 +27,7 @@
#include "config.h"
#include <limits.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#if HAVE_MALLOC_H
...
...
@@ -34,6 +35,7 @@
#endif
#include "avutil.h"
#include "intreadwrite.h"
#include "mem.h"
/* here we can use OS-dependent allocation functions */
...
...
@@ -177,3 +179,38 @@ char *av_strdup(const char *s)
}
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
);
}
}
}
libavutil/mem.h
View file @
5bac2d0c
...
...
@@ -27,6 +27,7 @@
#define AVUTIL_MEM_H
#include <limits.h>
#include <stdint.h>
#include "attributes.h"
#include "avutil.h"
...
...
@@ -164,6 +165,17 @@ char *av_strdup(const char *s) av_malloc_attrib;
*/
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
);
/**
* @}
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment