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
c81f0349
Commit
c81f0349
authored
Jan 27, 2003
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
optimizing av_log2
Originally committed as revision 1515 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
425ed6e2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
11 deletions
+29
-11
common.c
libavcodec/common.c
+11
-0
common.h
libavcodec/common.h
+18
-11
No files found.
libavcodec/common.c
View file @
c81f0349
...
...
@@ -27,6 +27,17 @@ const UINT8 ff_sqrt_tab[128]={
9
,
9
,
9
,
9
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
10
,
11
,
11
,
11
,
11
,
11
,
11
,
11
};
const
uint8_t
ff_log2_tab
[
256
]
=
{
0
,
0
,
1
,
1
,
2
,
2
,
2
,
2
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
4
,
4
,
4
,
4
,
4
,
4
,
4
,
4
,
4
,
4
,
4
,
4
,
4
,
4
,
4
,
4
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
6
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
,
7
};
void
init_put_bits
(
PutBitContext
*
s
,
UINT8
*
buffer
,
int
buffer_size
,
void
*
opaque
,
...
...
libavcodec/common.h
View file @
c81f0349
...
...
@@ -804,6 +804,7 @@ void print_stats(void);
#endif
/* misc math functions */
extern
const
uint8_t
ff_log2_tab
[
256
];
static
inline
int
av_log2
(
unsigned
int
v
)
{
...
...
@@ -818,20 +819,26 @@ static inline int av_log2(unsigned int v)
v
>>=
8
;
n
+=
8
;
}
if
(
v
&
0xf0
)
{
v
>>=
4
;
n
+=
4
;
}
if
(
v
&
0xc
)
{
v
>>=
2
;
n
+=
2
;
}
if
(
v
&
0x2
)
{
n
++
;
n
+=
ff_log2_tab
[
v
];
return
n
;
}
static
inline
int
av_log2_16bit
(
unsigned
int
v
)
{
int
n
;
n
=
0
;
if
(
v
&
0xff00
)
{
v
>>=
8
;
n
+=
8
;
}
n
+=
ff_log2_tab
[
v
];
return
n
;
}
/* median of 3 */
static
inline
int
mid_pred
(
int
a
,
int
b
,
int
c
)
{
...
...
@@ -861,7 +868,7 @@ static inline int clip(int a, int amin, int amax)
}
/* math */
extern
const
UINT8
ff_sqrt_tab
[
128
];
extern
const
uint8_t
ff_sqrt_tab
[
128
];
int
ff_gcd
(
int
a
,
int
b
);
...
...
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