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
cddd15ba
Commit
cddd15ba
authored
Nov 15, 2013
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat/matroska: simplify signed int access code
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
d03eea36
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
16 deletions
+4
-16
matroskadec.c
libavformat/matroskadec.c
+1
-5
matroskaenc.c
libavformat/matroskaenc.c
+3
-11
No files found.
libavformat/matroskadec.c
View file @
cddd15ba
...
...
@@ -773,11 +773,7 @@ static int ebml_read_sint(AVIOContext *pb, int size, int64_t *num)
if
(
size
==
0
)
{
*
num
=
0
;
}
else
{
*
num
=
avio_r8
(
pb
);
/* negative value */
if
(
*
num
&
0x80
)
{
*
num
=
(
-
1
<<
8
)
|
*
num
;
}
*
num
=
sign_extend
(
avio_r8
(
pb
),
8
);
/* big-endian ordering; build up number */
while
(
n
++
<
size
)
...
...
libavformat/matroskaenc.c
View file @
cddd15ba
...
...
@@ -205,22 +205,14 @@ static void put_ebml_uint(AVIOContext *pb, unsigned int elementid, uint64_t val)
static
void
put_ebml_sint
(
AVIOContext
*
pb
,
unsigned
int
elementid
,
int64_t
val
)
{
int
i
,
bytes
=
1
;
uint64_t
uval
=
(
val
<
0
?
(
-
val
-
1
)
<<
1
:
val
<<
1
);
while
(
uval
>>=
8
)
bytes
++
;
uint64_t
tmp
=
2
*
(
val
<
0
?
val
^-
1
:
val
);
/* make unsigned */
if
(
val
>=
0
)
{
uval
=
val
;
}
else
{
uval
=
0x80
<<
(
bytes
-
1
);
uval
+=
val
;
uval
|=
0x80
<<
(
bytes
-
1
);
}
while
(
tmp
>>=
8
)
bytes
++
;
put_ebml_id
(
pb
,
elementid
);
put_ebml_num
(
pb
,
bytes
,
0
);
for
(
i
=
bytes
-
1
;
i
>=
0
;
i
--
)
avio_w8
(
pb
,
(
uint8_t
)(
u
val
>>
i
*
8
));
avio_w8
(
pb
,
(
uint8_t
)(
val
>>
i
*
8
));
}
static
void
put_ebml_float
(
AVIOContext
*
pb
,
unsigned
int
elementid
,
double
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