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
2ab5feaf
Commit
2ab5feaf
authored
Jan 29, 2012
by
Reimar Döffinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
huffman: use a simple assignment instead of FFSWAP.
Signed-off-by:
Reimar Döffinger
<
Reimar.Doeffinger@gmx.de
>
parent
6166bf3c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
huffman.c
libavcodec/huffman.c
+6
-4
No files found.
libavcodec/huffman.c
View file @
2ab5feaf
...
@@ -91,16 +91,18 @@ int ff_huff_build_tree(AVCodecContext *avctx, VLC *vlc, int nb_codes,
...
@@ -91,16 +91,18 @@ int ff_huff_build_tree(AVCodecContext *avctx, VLC *vlc, int nb_codes,
nodes
[
nb_codes
*
2
-
1
].
count
=
0
;
nodes
[
nb_codes
*
2
-
1
].
count
=
0
;
for
(
i
=
0
;
i
<
nb_codes
*
2
-
1
;
i
+=
2
){
for
(
i
=
0
;
i
<
nb_codes
*
2
-
1
;
i
+=
2
){
uint32_t
cur_count
=
nodes
[
i
].
count
+
nodes
[
i
+
1
].
count
;
uint32_t
cur_count
=
nodes
[
i
].
count
+
nodes
[
i
+
1
].
count
;
nodes
[
cur_node
].
sym
=
HNODE
;
// find correct place to insert new node, and
nodes
[
cur_node
].
count
=
cur_count
;
// make space for the new node while at it
nodes
[
cur_node
].
n0
=
i
;
for
(
j
=
cur_node
;
j
>
i
+
2
;
j
--
){
for
(
j
=
cur_node
;
j
>
i
+
2
;
j
--
){
if
(
cur_count
>
nodes
[
j
-
1
].
count
||
if
(
cur_count
>
nodes
[
j
-
1
].
count
||
(
cur_count
==
nodes
[
j
-
1
].
count
&&
(
cur_count
==
nodes
[
j
-
1
].
count
&&
!
(
flags
&
FF_HUFFMAN_FLAG_HNODE_FIRST
)))
!
(
flags
&
FF_HUFFMAN_FLAG_HNODE_FIRST
)))
break
;
break
;
FFSWAP
(
Node
,
nodes
[
j
],
nodes
[
j
-
1
])
;
nodes
[
j
]
=
nodes
[
j
-
1
]
;
}
}
nodes
[
j
].
sym
=
HNODE
;
nodes
[
j
].
count
=
cur_count
;
nodes
[
j
].
n0
=
i
;
cur_node
++
;
cur_node
++
;
}
}
if
(
build_huff_tree
(
vlc
,
nodes
,
nb_codes
*
2
-
2
,
flags
)
<
0
){
if
(
build_huff_tree
(
vlc
,
nodes
,
nb_codes
*
2
-
2
,
flags
)
<
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