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
9af1ec8e
Commit
9af1ec8e
authored
Oct 23, 2004
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup of decode_cabac_residual()
Originally committed as revision 3626 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
d6b0c1bb
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
60 deletions
+41
-60
h264.c
libavcodec/h264.c
+41
-60
No files found.
libavcodec/h264.c
View file @
9af1ec8e
...
@@ -4264,15 +4264,13 @@ static int decode_cabac_residual( H264Context *h, DCTELEM *block, int cat, int n
...
@@ -4264,15 +4264,13 @@ static int decode_cabac_residual( H264Context *h, DCTELEM *block, int cat, int n
const
int
mb_xy
=
h
->
s
.
mb_x
+
h
->
s
.
mb_y
*
h
->
s
.
mb_stride
;
const
int
mb_xy
=
h
->
s
.
mb_x
+
h
->
s
.
mb_y
*
h
->
s
.
mb_stride
;
const
uint16_t
*
qmul
=
dequant_coeff
[
qp
];
const
uint16_t
*
qmul
=
dequant_coeff
[
qp
];
static
const
int
significant_coeff_flag_offset
[
5
]
=
{
0
,
15
,
29
,
44
,
47
};
static
const
int
significant_coeff_flag_offset
[
5
]
=
{
0
,
15
,
29
,
44
,
47
};
static
const
int
last_significant_coeff_flag_offset
[
5
]
=
{
0
,
15
,
29
,
44
,
47
};
static
const
int
coeff_abs_level_m1_offset
[
5
]
=
{
227
+
0
,
227
+
10
,
227
+
20
,
227
+
30
,
227
+
39
};
static
const
int
coeff_abs_level_m1_offset
[
5
]
=
{
0
,
10
,
20
,
30
,
39
};
int
coeff
[
16
];
int
coeff
[
16
];
int
index
[
16
];
int
last
=
0
;
int
i
,
last
;
int
coeff_count
=
0
;
int
coeff_count
=
0
;
int
nz
[
16
]
=
{
0
};
int
i
;
int
abslevel1
=
0
;
int
abslevel1
=
0
;
int
abslevelgt1
=
0
;
int
abslevelgt1
=
0
;
...
@@ -4294,26 +4292,17 @@ static int decode_cabac_residual( H264Context *h, DCTELEM *block, int cat, int n
...
@@ -4294,26 +4292,17 @@ static int decode_cabac_residual( H264Context *h, DCTELEM *block, int cat, int n
return
0
;
return
0
;
}
}
while
(
last
<
max_coeff
-
1
)
{
for
(
last
=
0
;
last
<
max_coeff
-
1
;
last
++
)
{
int
ctx
=
FFMIN
(
last
,
max_coeff
-
2
);
if
(
get_cabac
(
&
h
->
cabac
,
&
h
->
cabac_state
[
105
+
significant_coeff_flag_offset
[
cat
]
+
last
]
))
{
index
[
coeff_count
++
]
=
last
;
if
(
get_cabac
(
&
h
->
cabac
,
&
h
->
cabac_state
[
105
+
significant_coeff_flag_offset
[
cat
]
+
ctx
]
)
==
0
)
{
if
(
get_cabac
(
&
h
->
cabac
,
&
h
->
cabac_state
[
166
+
significant_coeff_flag_offset
[
cat
]
+
last
]
)
)
{
nz
[
last
++
]
=
0
;
last
=
max_coeff
;
}
else
{
nz
[
last
++
]
=
1
;
coeff_count
++
;
if
(
get_cabac
(
&
h
->
cabac
,
&
h
->
cabac_state
[
166
+
last_significant_coeff_flag_offset
[
cat
]
+
ctx
]
)
)
{
while
(
last
<
max_coeff
)
{
nz
[
last
++
]
=
0
;
}
break
;
break
;
}
}
}
}
}
}
if
(
last
==
max_coeff
-
1
)
{
if
(
last
==
max_coeff
-
1
)
{
nz
[
last
++
]
=
1
;
index
[
coeff_count
++
]
=
last
;
coeff_count
++
;
}
}
if
(
cat
==
0
&&
coeff_count
>
0
)
if
(
cat
==
0
&&
coeff_count
>
0
)
...
@@ -4326,61 +4315,53 @@ static int decode_cabac_residual( H264Context *h, DCTELEM *block, int cat, int n
...
@@ -4326,61 +4315,53 @@ static int decode_cabac_residual( H264Context *h, DCTELEM *block, int cat, int n
h
->
non_zero_count_cache
[
scan8
[
16
+
n
]]
=
coeff_count
;
h
->
non_zero_count_cache
[
scan8
[
16
+
n
]]
=
coeff_count
;
for
(
i
=
coeff_count
-
1
;
i
>=
0
;
i
--
)
{
for
(
i
=
coeff_count
-
1
;
i
>=
0
;
i
--
)
{
int
coeff_abs_m1
;
int
ctx
=
(
abslevelgt1
!=
0
?
0
:
FFMIN
(
4
,
abslevel1
+
1
))
+
coeff_abs_level_m1_offset
[
cat
];
int
ctx
=
(
abslevelgt1
!=
0
?
0
:
FFMIN
(
4
,
abslevel1
+
1
))
+
coeff_abs_level_m1_offset
[
cat
];
if
(
get_cabac
(
&
h
->
cabac
,
&
h
->
cabac_state
[
227
+
ctx
]
)
==
0
)
{
if
(
get_cabac
(
&
h
->
cabac
,
&
h
->
cabac_state
[
ctx
]
)
==
0
)
{
coeff_abs_m1
=
0
;
if
(
get_cabac_bypass
(
&
h
->
cabac
)
)
coeff
[
i
]
=
-
1
;
else
coeff
[
i
]
=
1
;
abslevel1
++
;
}
else
{
}
else
{
coeff_abs_m1
=
1
;
int
coeff_abs
=
2
;
ctx
=
5
+
FFMIN
(
4
,
abslevelgt1
)
+
coeff_abs_level_m1_offset
[
cat
];
ctx
=
5
+
FFMIN
(
4
,
abslevelgt1
)
+
coeff_abs_level_m1_offset
[
cat
];
while
(
coeff_abs_m1
<
14
&&
get_cabac
(
&
h
->
cabac
,
&
h
->
cabac_state
[
227
+
ctx
]
)
)
{
while
(
coeff_abs
<
15
&&
get_cabac
(
&
h
->
cabac
,
&
h
->
cabac_state
[
ctx
]
)
)
{
coeff_abs_m1
++
;
coeff_abs
++
;
}
}
}
if
(
coeff_abs_m1
>=
14
)
{
if
(
coeff_abs
>=
15
)
{
int
j
=
0
;
int
j
=
0
;
while
(
get_cabac_bypass
(
&
h
->
cabac
)
)
{
while
(
get_cabac_bypass
(
&
h
->
cabac
)
)
{
coeff_abs_m1
+=
1
<<
j
;
coeff_abs
+=
1
<<
j
;
j
++
;
j
++
;
}
}
while
(
j
--
)
{
while
(
j
--
)
{
if
(
get_cabac_bypass
(
&
h
->
cabac
)
)
if
(
get_cabac_bypass
(
&
h
->
cabac
)
)
coeff_abs_m1
+=
1
<<
j
;
coeff_abs
+=
1
<<
j
;
}
}
}
}
if
(
get_cabac_bypass
(
&
h
->
cabac
)
)
if
(
get_cabac_bypass
(
&
h
->
cabac
)
)
coeff
[
i
]
=
-
1
*
(
coeff_abs_m1
+
1
)
;
coeff
[
i
]
=
-
coeff_abs
;
else
else
coeff
[
i
]
=
coeff_abs_m1
+
1
;
coeff
[
i
]
=
coeff_abs
;
if
(
coeff_abs_m1
==
0
)
abslevel1
++
;
else
abslevelgt1
++
;
abslevelgt1
++
;
}
}
}
if
(
cat
==
0
||
cat
==
3
)
{
/* DC */
if
(
cat
==
0
||
cat
==
3
)
{
/* DC */
int
j
;
for
(
i
=
0
;
i
<
coeff_count
;
i
++
)
{
for
(
i
=
0
,
j
=
0
;
j
<
coeff_count
;
i
++
)
{
block
[
scantable
[
index
[
i
]
]]
=
coeff
[
i
];
if
(
nz
[
i
]
)
{
block
[
scantable
[
i
]]
=
coeff
[
j
];
j
++
;
}
}
}
}
else
{
/* AC */
}
else
{
/* AC */
int
j
;
for
(
i
=
0
;
i
<
coeff_count
;
i
++
)
{
for
(
i
=
0
,
j
=
0
;
j
<
coeff_count
;
i
++
)
{
int
j
=
scantable
[
index
[
i
]];
if
(
nz
[
i
]
)
{
block
[
j
]
=
coeff
[
i
]
*
qmul
[
j
];
block
[
scantable
[
i
]]
=
coeff
[
j
]
*
qmul
[
scantable
[
i
]];
j
++
;
}
}
}
}
}
return
0
;
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