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
0ff93477
Commit
0ff93477
authored
Jun 25, 2004
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
optimization
Originally committed as revision 3249 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
4c99f2cd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
32 deletions
+17
-32
common.h
libavcodec/common.h
+8
-0
h263.c
libavcodec/h263.c
+4
-22
mpeg12.c
libavcodec/mpeg12.c
+5
-10
No files found.
libavcodec/common.h
View file @
0ff93477
...
...
@@ -129,6 +129,14 @@ typedef unsigned int uint_fast16_t;
typedef
unsigned
int
uint_fast32_t
;
#endif
#ifndef INT_BIT
# if INT_MAX == INT64_MAX
# define INT_BIT 64
# else
# define INT_BIT 32
# endif
#endif
#if defined(CONFIG_OS2) || defined(CONFIG_SUNOS)
static
inline
float
floorf
(
float
f
)
{
return
floor
(
f
);
...
...
libavcodec/h263.c
View file @
0ff93477
...
...
@@ -1630,30 +1630,12 @@ void ff_h263_encode_motion(MpegEncContext * s, int val, int f_code)
bit_size
=
f_code
-
1
;
range
=
1
<<
bit_size
;
/* modulo encoding */
l
=
range
*
32
;
#if 1
val
+=
l
;
val
&=
2
*
l
-
1
;
val
-=
l
;
l
=
INT_BIT
-
6
-
bit_size
;
val
=
(
val
<<
l
)
>>
l
;
sign
=
val
>>
31
;
val
=
(
val
^
sign
)
-
sign
;
sign
&=
1
;
#else
if
(
val
<
-
l
)
{
val
+=
2
*
l
;
}
else
if
(
val
>=
l
)
{
val
-=
2
*
l
;
}
assert
(
val
>=-
l
&&
val
<
l
);
if
(
val
>=
0
)
{
sign
=
0
;
}
else
{
val
=
-
val
;
sign
=
1
;
}
#endif
val
--
;
code
=
(
val
>>
bit_size
)
+
1
;
bits
=
val
&
(
range
-
1
);
...
...
@@ -4375,8 +4357,8 @@ static int h263_decode_motion(MpegEncContext * s, int pred, int f_code)
/* modulo decoding */
if
(
!
s
->
h263_long_vectors
)
{
l
=
1
<<
(
f_code
+
4
)
;
val
=
(
(
val
+
l
)
&
(
l
*
2
-
1
))
-
l
;
l
=
INT_BIT
-
5
-
f_code
;
val
=
(
val
<<
l
)
>>
l
;
}
else
{
/* horrible h263 long vector mode */
if
(
pred
<
-
31
&&
val
<
-
63
)
...
...
libavcodec/mpeg12.c
View file @
0ff93477
...
...
@@ -696,7 +696,7 @@ void mpeg1_encode_mb(MpegEncContext *s,
// RAL: Parameter added: f_or_b_code
static
void
mpeg1_encode_motion
(
MpegEncContext
*
s
,
int
val
,
int
f_or_b_code
)
{
int
code
,
bit_size
,
l
,
m
,
bits
,
range
,
sign
;
int
code
,
bit_size
,
l
,
bits
,
range
,
sign
;
if
(
val
==
0
)
{
/* zero vector */
...
...
@@ -708,13 +708,8 @@ static void mpeg1_encode_motion(MpegEncContext *s, int val, int f_or_b_code)
bit_size
=
f_or_b_code
-
1
;
range
=
1
<<
bit_size
;
/* modulo encoding */
l
=
16
*
range
;
m
=
2
*
l
;
if
(
val
<
-
l
)
{
val
+=
m
;
}
else
if
(
val
>=
l
)
{
val
-=
m
;
}
l
=
INT_BIT
-
5
-
bit_size
;
val
=
(
val
<<
l
)
>>
l
;
if
(
val
>=
0
)
{
val
--
;
...
...
@@ -1411,8 +1406,8 @@ static int mpeg_decode_motion(MpegEncContext *s, int fcode, int pred)
val
+=
pred
;
/* modulo decoding */
l
=
1
<<
(
shift
+
4
)
;
val
=
(
(
val
+
l
)
&
(
l
*
2
-
1
))
-
l
;
l
=
INT_BIT
-
5
-
shift
;
val
=
(
val
<<
l
)
>>
l
;
return
val
;
}
...
...
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