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
aa498fef
Commit
aa498fef
authored
Oct 09, 2011
by
Mans Rullgard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mpeg124: use sign_extend() function
Signed-off-by:
Mans Rullgard
<
mans@mansr.com
>
parent
633ddb85
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
10 deletions
+6
-10
ituh263dec.c
libavcodec/ituh263dec.c
+2
-3
ituh263enc.c
libavcodec/ituh263enc.c
+2
-3
mpeg12.c
libavcodec/mpeg12.c
+2
-4
No files found.
libavcodec/ituh263dec.c
View file @
aa498fef
...
@@ -271,7 +271,7 @@ int ff_h263_resync(MpegEncContext *s){
...
@@ -271,7 +271,7 @@ int ff_h263_resync(MpegEncContext *s){
int
h263_decode_motion
(
MpegEncContext
*
s
,
int
pred
,
int
f_code
)
int
h263_decode_motion
(
MpegEncContext
*
s
,
int
pred
,
int
f_code
)
{
{
int
code
,
val
,
sign
,
shift
,
l
;
int
code
,
val
,
sign
,
shift
;
code
=
get_vlc2
(
&
s
->
gb
,
mv_vlc
.
table
,
MV_VLC_BITS
,
2
);
code
=
get_vlc2
(
&
s
->
gb
,
mv_vlc
.
table
,
MV_VLC_BITS
,
2
);
if
(
code
==
0
)
if
(
code
==
0
)
...
@@ -293,8 +293,7 @@ int h263_decode_motion(MpegEncContext * s, int pred, int f_code)
...
@@ -293,8 +293,7 @@ int h263_decode_motion(MpegEncContext * s, int pred, int f_code)
/* modulo decoding */
/* modulo decoding */
if
(
!
s
->
h263_long_vectors
)
{
if
(
!
s
->
h263_long_vectors
)
{
l
=
INT_BIT
-
5
-
f_code
;
val
=
sign_extend
(
val
,
5
+
f_code
);
val
=
(
val
<<
l
)
>>
l
;
}
else
{
}
else
{
/* horrible h263 long vector mode */
/* horrible h263 long vector mode */
if
(
pred
<
-
31
&&
val
<
-
63
)
if
(
pred
<
-
31
&&
val
<
-
63
)
...
...
libavcodec/ituh263enc.c
View file @
aa498fef
...
@@ -657,7 +657,7 @@ void h263_encode_mb(MpegEncContext * s,
...
@@ -657,7 +657,7 @@ void h263_encode_mb(MpegEncContext * s,
void
ff_h263_encode_motion
(
MpegEncContext
*
s
,
int
val
,
int
f_code
)
void
ff_h263_encode_motion
(
MpegEncContext
*
s
,
int
val
,
int
f_code
)
{
{
int
range
,
l
,
bit_size
,
sign
,
code
,
bits
;
int
range
,
bit_size
,
sign
,
code
,
bits
;
if
(
val
==
0
)
{
if
(
val
==
0
)
{
/* zero vector */
/* zero vector */
...
@@ -667,8 +667,7 @@ void ff_h263_encode_motion(MpegEncContext * s, int val, int f_code)
...
@@ -667,8 +667,7 @@ void ff_h263_encode_motion(MpegEncContext * s, int val, int f_code)
bit_size
=
f_code
-
1
;
bit_size
=
f_code
-
1
;
range
=
1
<<
bit_size
;
range
=
1
<<
bit_size
;
/* modulo encoding */
/* modulo encoding */
l
=
INT_BIT
-
6
-
bit_size
;
val
=
sign_extend
(
val
,
6
+
bit_size
);
val
=
(
val
<<
l
)
>>
l
;
sign
=
val
>>
31
;
sign
=
val
>>
31
;
val
=
(
val
^
sign
)
-
sign
;
val
=
(
val
^
sign
)
-
sign
;
sign
&=
1
;
sign
&=
1
;
...
...
libavcodec/mpeg12.c
View file @
aa498fef
...
@@ -54,7 +54,7 @@ static VLC mv_vlc;
...
@@ -54,7 +54,7 @@ static VLC mv_vlc;
/* as H.263, but only 17 codes */
/* as H.263, but only 17 codes */
static
int
mpeg_decode_motion
(
MpegEncContext
*
s
,
int
fcode
,
int
pred
)
static
int
mpeg_decode_motion
(
MpegEncContext
*
s
,
int
fcode
,
int
pred
)
{
{
int
code
,
sign
,
val
,
l
,
shift
;
int
code
,
sign
,
val
,
shift
;
code
=
get_vlc2
(
&
s
->
gb
,
mv_vlc
.
table
,
MV_VLC_BITS
,
2
);
code
=
get_vlc2
(
&
s
->
gb
,
mv_vlc
.
table
,
MV_VLC_BITS
,
2
);
if
(
code
==
0
)
{
if
(
code
==
0
)
{
...
@@ -77,9 +77,7 @@ static int mpeg_decode_motion(MpegEncContext *s, int fcode, int pred)
...
@@ -77,9 +77,7 @@ static int mpeg_decode_motion(MpegEncContext *s, int fcode, int pred)
val
+=
pred
;
val
+=
pred
;
/* modulo decoding */
/* modulo decoding */
l
=
INT_BIT
-
5
-
shift
;
return
sign_extend
(
val
,
5
+
shift
);
val
=
(
val
<<
l
)
>>
l
;
return
val
;
}
}
static
inline
int
mpeg1_decode_block_intra
(
MpegEncContext
*
s
,
DCTELEM
*
block
,
int
n
)
static
inline
int
mpeg1_decode_block_intra
(
MpegEncContext
*
s
,
DCTELEM
*
block
,
int
n
)
...
...
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