Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Guillaume Martres
aom-rav1e
Commits
3cecce91
Commit
3cecce91
authored
Dec 12, 2014
by
hkuang
Browse files
Optimize bit_read_buffer.
Change-Id: Iee43c34909deec9787b29c1c33672213b9f049df
parent
f925e5ce
Changes
1
Hide whitespace changes
Inline
Side-by-side
vp9/decoder/vp9_read_bit_buffer.c
View file @
3cecce91
...
...
@@ -10,20 +10,20 @@
#include "vp9/decoder/vp9_read_bit_buffer.h"
size_t
vp9_rb_bytes_read
(
struct
vp9_read_bit_buffer
*
rb
)
{
return
(
rb
->
bit_offset
+
CHAR_BIT
-
1
)
/
CHAR_BIT
;
return
(
rb
->
bit_offset
+
7
)
>>
3
;
}
int
vp9_rb_read_bit
(
struct
vp9_read_bit_buffer
*
rb
)
{
const
size_t
off
=
rb
->
bit_offset
;
const
size_t
p
=
off
/
CHAR_BIT
;
const
int
q
=
CHAR_BIT
-
1
-
(
int
)
off
%
CHAR_BIT
;
if
(
rb
->
bit_buffer
+
p
>=
rb
->
bit_buffer_end
)
{
rb
->
error_handler
(
rb
->
error_handler_data
);
return
0
;
}
else
{
const
int
bit
=
(
rb
->
bit_buffer
[
p
]
&
(
1
<<
q
))
>>
q
;
const
size_t
p
=
off
>>
3
;
const
int
q
=
7
-
(
int
)(
off
&
0x7
);
if
(
rb
->
bit_buffer
+
p
<
rb
->
bit_buffer_end
)
{
const
int
bit
=
(
rb
->
bit_buffer
[
p
]
>>
q
)
&
1
;
rb
->
bit_offset
=
off
+
1
;
return
bit
;
}
else
{
rb
->
error_handler
(
rb
->
error_handler_data
);
return
0
;
}
}
...
...
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