Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dav1d
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Xuefeng Jiang
dav1d
Commits
b4e6377a
Commit
b4e6377a
authored
Feb 08, 2019
by
Vittorio Giovara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get_bits: Factor out leb parsing to dav1d_get_uleb128()
parent
c45f6b37
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
10 deletions
+24
-10
src/getbits.c
src/getbits.c
+21
-0
src/getbits.h
src/getbits.h
+1
-0
src/obu.c
src/obu.c
+2
-10
No files found.
src/getbits.c
View file @
b4e6377a
...
...
@@ -79,6 +79,27 @@ int dav1d_get_sbits(GetBits *const c, const unsigned n) {
return
res
>>
shift
;
}
unsigned
dav1d_get_uleb128
(
GetBits
*
c
)
{
unsigned
val
=
0
,
more
,
i
=
0
;
do
{
more
=
dav1d_get_bits
(
c
,
1
);
unsigned
bits
=
dav1d_get_bits
(
c
,
7
);
if
(
i
<=
3
||
(
i
==
4
&&
bits
<
(
1
<<
4
)))
val
|=
bits
<<
(
i
*
7
);
else
if
(
bits
)
{
c
->
error
=
1
;
return
0
;
}
if
(
more
&&
++
i
==
8
)
{
c
->
error
=
1
;
return
0
;
}
}
while
(
more
);
return
val
;
}
unsigned
dav1d_get_uniform
(
GetBits
*
const
c
,
const
unsigned
max
)
{
// Output in range [0..max-1]
// max must be > 1, or else nothing is read from the bitstream
...
...
src/getbits.h
View file @
b4e6377a
...
...
@@ -41,6 +41,7 @@ typedef struct GetBits {
void
dav1d_init_get_bits
(
GetBits
*
c
,
const
uint8_t
*
data
,
size_t
sz
);
unsigned
dav1d_get_bits
(
GetBits
*
c
,
unsigned
n
);
int
dav1d_get_sbits
(
GetBits
*
c
,
unsigned
n
);
unsigned
dav1d_get_uleb128
(
GetBits
*
c
);
// Output in range 0..max-1
unsigned
dav1d_get_uniform
(
GetBits
*
c
,
unsigned
max
);
...
...
src/obu.c
View file @
b4e6377a
...
...
@@ -1187,17 +1187,9 @@ int dav1d_parse_obus(Dav1dContext *const c, Dav1dData *const in, int global) {
}
// obu length field
unsigned
len
=
0
,
more
,
i
=
0
;
unsigned
len
=
0
;
if
(
has_length_field
)
do
{
more
=
dav1d_get_bits
(
&
gb
,
1
);
unsigned
bits
=
dav1d_get_bits
(
&
gb
,
7
);
if
(
i
<=
3
||
(
i
==
4
&&
bits
<
(
1
<<
4
)))
len
|=
bits
<<
(
i
*
7
);
else
if
(
bits
)
goto
error
;
if
(
more
&&
++
i
==
8
)
goto
error
;
}
while
(
more
);
len
=
dav1d_get_uleb128
(
&
gb
);
else
len
=
(
int
)
in
->
sz
-
1
-
has_extension
;
if
(
gb
.
error
)
goto
error
;
...
...
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