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
bfe328ca
Commit
bfe328ca
authored
Aug 27, 2006
by
Loren Merritt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tweak cabac. 0.5% faster h264.
Originally committed as revision 6106 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
39b434c6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
10 deletions
+12
-10
cabac.h
libavcodec/cabac.h
+12
-10
No files found.
libavcodec/cabac.h
View file @
bfe328ca
...
...
@@ -295,28 +295,30 @@ static inline void renorm_cabac_decoder(CABACContext *c){
}
static
inline
void
renorm_cabac_decoder_once
(
CABACContext
*
c
){
int
mask
=
(
c
->
range
-
(
0x200
<<
CABAC_BITS
))
>>
31
;
c
->
range
+=
c
->
range
&
mask
;
c
->
low
+=
c
->
low
&
mask
;
int
shift
=
(
uint32_t
)
(
c
->
range
-
(
0x200
<<
CABAC_BITS
))
>>
31
;
c
->
range
<<=
shift
;
c
->
low
<<=
shift
;
if
(
!
(
c
->
low
&
CABAC_MASK
))
refill
(
c
);
}
static
inline
int
get_cabac
(
CABACContext
*
c
,
uint8_t
*
const
state
){
int
RangeLPS
=
c
->
lps_range
[
*
state
][
c
->
range
>>
(
CABAC_BITS
+
7
)]
<<
(
CABAC_BITS
+
1
);
//FIXME gcc generates duplicate load/stores for c->low and c->range
int
s
=
*
state
;
int
RangeLPS
=
c
->
lps_range
[
s
][
c
->
range
>>
(
CABAC_BITS
+
7
)]
<<
(
CABAC_BITS
+
1
);
int
bit
,
lps_mask
attribute_unused
;
c
->
range
-=
RangeLPS
;
#if 1
if
(
c
->
low
<
c
->
range
){
bit
=
(
*
state
)
&
1
;
*
state
=
c
->
mps_state
[
*
state
];
bit
=
s
&
1
;
*
state
=
c
->
mps_state
[
s
];
renorm_cabac_decoder_once
(
c
);
}
else
{
// int shift= ff_h264_norm_shift[RangeLPS>>17];
bit
=
(
(
*
state
)
&
1
)
^
1
;
bit
=
(
s
&
1
)
^
1
;
c
->
low
-=
c
->
range
;
*
state
=
c
->
lps_state
[
*
state
];
*
state
=
c
->
lps_state
[
s
];
c
->
range
=
RangeLPS
;
renorm_cabac_decoder
(
c
);
/* c->range = RangeLPS<<shift;
...
...
@@ -331,8 +333,8 @@ static inline int get_cabac(CABACContext *c, uint8_t * const state){
c
->
low
-=
c
->
range
&
lps_mask
;
c
->
range
+=
(
RangeLPS
-
c
->
range
)
&
lps_mask
;
bit
=
(
(
*
state
)
^
lps_mask
)
&
1
;
*
state
=
c
->
mps_state
[
(
*
state
)
-
(
128
&
lps_mask
)];
bit
=
(
s
^
lps_mask
)
&
1
;
*
state
=
c
->
mps_state
[
s
-
(
128
&
lps_mask
)];
lps_mask
=
ff_h264_norm_shift
[
c
->
range
>>
(
CABAC_BITS
+
2
)];
c
->
range
<<=
lps_mask
;
...
...
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