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
1db8c21c
Commit
1db8c21c
authored
Jan 31, 2007
by
Reimar Döffinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimize LZO copy operations
Originally committed as revision 7784 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
ff3dac65
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
16 deletions
+20
-16
lzo.c
libavcodec/lzo.c
+20
-16
No files found.
libavcodec/lzo.c
View file @
1db8c21c
...
@@ -66,6 +66,19 @@ static inline int get_len(LZOContext *c, int x, int mask) {
...
@@ -66,6 +66,19 @@ static inline int get_len(LZOContext *c, int x, int mask) {
return
cnt
;
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 copy bytes from input to output buffer with checking
* \brief copy bytes from input to output buffer with checking
* \param cnt number of bytes to copy, must be > 0
* \param cnt number of bytes to copy, must be > 0
...
@@ -82,10 +95,7 @@ static inline void copy(LZOContext *c, int cnt) {
...
@@ -82,10 +95,7 @@ static inline void copy(LZOContext *c, int cnt) {
c
->
error
|=
LZO_OUTPUT_FULL
;
c
->
error
|=
LZO_OUTPUT_FULL
;
}
}
#if defined(INBUF_PADDED) && defined(OUTBUF_PADDED)
#if defined(INBUF_PADDED) && defined(OUTBUF_PADDED)
dst
[
0
]
=
src
[
0
];
COPY4
(
dst
,
src
);
dst
[
1
]
=
src
[
1
];
dst
[
2
]
=
src
[
2
];
dst
[
3
]
=
src
[
3
];
src
+=
4
;
src
+=
4
;
dst
+=
4
;
dst
+=
4
;
cnt
-=
4
;
cnt
-=
4
;
...
@@ -120,22 +130,16 @@ static inline void copy_backptr(LZOContext *c, int back, int cnt) {
...
@@ -120,22 +130,16 @@ static inline void copy_backptr(LZOContext *c, int back, int cnt) {
dst
+=
cnt
;
dst
+=
cnt
;
}
else
{
}
else
{
#ifdef OUTBUF_PADDED
#ifdef OUTBUF_PADDED
dst
[
0
]
=
src
[
0
];
COPY2
(
dst
,
src
);
dst
[
1
]
=
src
[
1
];
COPY2
(
dst
+
2
,
src
+
2
);
dst
[
2
]
=
src
[
2
];
dst
[
3
]
=
src
[
3
];
src
+=
4
;
src
+=
4
;
dst
+=
4
;
dst
+=
4
;
cnt
-=
4
;
cnt
-=
4
;
if
(
cnt
>
0
)
{
if
(
cnt
>
0
)
{
dst
[
0
]
=
src
[
0
];
COPY2
(
dst
,
src
);
dst
[
1
]
=
src
[
1
];
COPY2
(
dst
+
2
,
src
+
2
);
dst
[
2
]
=
src
[
2
];
COPY2
(
dst
+
4
,
src
+
4
);
dst
[
3
]
=
src
[
3
];
COPY2
(
dst
+
6
,
src
+
6
);
dst
[
4
]
=
src
[
4
];
dst
[
5
]
=
src
[
5
];
dst
[
6
]
=
src
[
6
];
dst
[
7
]
=
src
[
7
];
src
+=
8
;
src
+=
8
;
dst
+=
8
;
dst
+=
8
;
cnt
-=
8
;
cnt
-=
8
;
...
...
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