Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
f36db5df
Commit
f36db5df
authored
Aug 22, 2002
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
faster ff_sqrt()
Originally committed as revision 859 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
1fb4890b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletion
+12
-1
common.c
libavcodec/common.c
+7
-0
common.h
libavcodec/common.h
+5
-1
No files found.
libavcodec/common.c
View file @
f36db5df
...
@@ -20,6 +20,13 @@
...
@@ -20,6 +20,13 @@
*/
*/
#include "avcodec.h"
#include "avcodec.h"
const
UINT8
ff_sqrt_tab
[
128
]
=
{
0
,
1
,
1
,
1
,
2
,
2
,
2
,
2
,
2
,
3
,
3
,
3
,
3
,
3
,
3
,
3
,
4
,
4
,
4
,
4
,
4
,
4
,
4
,
4
,
4
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
5
,
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
,
8
,
8
,
8
,
8
,
8
,
8
,
8
,
8
,
8
,
8
,
8
,
8
,
8
,
8
,
8
,
8
,
8
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
9
,
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
};
void
init_put_bits
(
PutBitContext
*
s
,
void
init_put_bits
(
PutBitContext
*
s
,
UINT8
*
buffer
,
int
buffer_size
,
UINT8
*
buffer
,
int
buffer_size
,
void
*
opaque
,
void
*
opaque
,
...
...
libavcodec/common.h
View file @
f36db5df
...
@@ -901,6 +901,8 @@ static inline int clip(int a, int amin, int amax)
...
@@ -901,6 +901,8 @@ static inline int clip(int a, int amin, int amax)
}
}
/* math */
/* math */
extern
const
UINT8
ff_sqrt_tab
[
128
];
int
ff_gcd
(
int
a
,
int
b
);
int
ff_gcd
(
int
a
,
int
b
);
static
inline
int
ff_sqrt
(
int
a
)
static
inline
int
ff_sqrt
(
int
a
)
...
@@ -908,7 +910,9 @@ static inline int ff_sqrt(int a)
...
@@ -908,7 +910,9 @@ static inline int ff_sqrt(int a)
int
ret
=
0
;
int
ret
=
0
;
int
s
;
int
s
;
int
ret_sq
=
0
;
int
ret_sq
=
0
;
if
(
a
<
128
)
return
ff_sqrt_tab
[
a
];
for
(
s
=
15
;
s
>=
0
;
s
--
){
for
(
s
=
15
;
s
>=
0
;
s
--
){
int
b
=
ret_sq
+
(
1
<<
(
s
*
2
))
+
(
ret
<<
s
)
*
2
;
int
b
=
ret_sq
+
(
1
<<
(
s
*
2
))
+
(
ret
<<
s
)
*
2
;
if
(
b
<=
a
){
if
(
b
<=
a
){
...
...
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