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
2b834a06
Commit
2b834a06
authored
Sep 28, 2013
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/huffman: Allow specifying nb_bits to ff_huff_build_tree()
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
a63b479d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
7 deletions
+9
-7
fraps.c
libavcodec/fraps.c
+2
-1
huffman.c
libavcodec/huffman.c
+4
-4
huffman.h
libavcodec/huffman.h
+1
-1
vp6.c
libavcodec/vp6.c
+2
-1
No files found.
libavcodec/fraps.c
View file @
2b834a06
...
...
@@ -94,7 +94,8 @@ static int fraps2_decode_plane(FrapsContext *s, uint8_t *dst, int stride, int w,
for
(
i
=
0
;
i
<
256
;
i
++
)
nodes
[
i
].
count
=
bytestream_get_le32
(
&
src
);
size
-=
1024
;
if
((
ret
=
ff_huff_build_tree
(
s
->
avctx
,
&
vlc
,
256
,
nodes
,
huff_cmp
,
if
((
ret
=
ff_huff_build_tree
(
s
->
avctx
,
&
vlc
,
256
,
FF_HUFFMAN_BITS
,
nodes
,
huff_cmp
,
FF_HUFFMAN_FLAG_ZERO_COUNT
))
<
0
)
return
ret
;
/* we have built Huffman table and are ready to decode plane */
...
...
libavcodec/huffman.c
View file @
2b834a06
...
...
@@ -112,7 +112,7 @@ static void get_tree_codes(uint32_t *bits, int16_t *lens, uint8_t *xlat,
}
}
static
int
build_huff_tree
(
VLC
*
vlc
,
Node
*
nodes
,
int
head
,
int
flags
)
static
int
build_huff_tree
(
VLC
*
vlc
,
Node
*
nodes
,
int
head
,
int
flags
,
int
nb_bits
)
{
int
no_zero_count
=
!
(
flags
&
FF_HUFFMAN_FLAG_ZERO_COUNT
);
uint32_t
bits
[
256
];
...
...
@@ -122,7 +122,7 @@ static int build_huff_tree(VLC *vlc, Node *nodes, int head, int flags)
get_tree_codes
(
bits
,
lens
,
xlat
,
nodes
,
head
,
0
,
0
,
&
pos
,
no_zero_count
);
return
ff_init_vlc_sparse
(
vlc
,
FF_HUFFMAN_BITS
,
pos
,
lens
,
2
,
2
,
bits
,
4
,
4
,
xlat
,
1
,
1
,
0
);
return
ff_init_vlc_sparse
(
vlc
,
nb_bits
,
pos
,
lens
,
2
,
2
,
bits
,
4
,
4
,
xlat
,
1
,
1
,
0
);
}
...
...
@@ -130,7 +130,7 @@ static int build_huff_tree(VLC *vlc, Node *nodes, int head, int flags)
* nodes size must be 2*nb_codes
* first nb_codes nodes.count must be set
*/
int
ff_huff_build_tree
(
AVCodecContext
*
avctx
,
VLC
*
vlc
,
int
nb_codes
,
int
ff_huff_build_tree
(
AVCodecContext
*
avctx
,
VLC
*
vlc
,
int
nb_codes
,
int
nb_bits
,
Node
*
nodes
,
HuffCmp
cmp
,
int
flags
)
{
int
i
,
j
;
...
...
@@ -168,7 +168,7 @@ int ff_huff_build_tree(AVCodecContext *avctx, VLC *vlc, int nb_codes,
nodes
[
j
].
n0
=
i
;
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
,
nb_bits
)
<
0
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Error building tree
\n
"
);
return
-
1
;
}
...
...
libavcodec/huffman.h
View file @
2b834a06
...
...
@@ -40,7 +40,7 @@ typedef struct Node {
#define FF_HUFFMAN_BITS 10
typedef
int
(
*
HuffCmp
)(
const
void
*
va
,
const
void
*
vb
);
int
ff_huff_build_tree
(
AVCodecContext
*
avctx
,
VLC
*
vlc
,
int
nb_codes
,
int
ff_huff_build_tree
(
AVCodecContext
*
avctx
,
VLC
*
vlc
,
int
nb_codes
,
int
nb_bits
,
Node
*
nodes
,
HuffCmp
cmp
,
int
flags
);
void
ff_huff_gen_len_table
(
uint8_t
*
dst
,
const
uint64_t
*
stats
);
...
...
libavcodec/vp6.c
View file @
2b834a06
...
...
@@ -238,7 +238,8 @@ static int vp6_build_huff_tree(VP56Context *s, uint8_t coeff_model[],
ff_free_vlc
(
vlc
);
/* then build the huffman tree according to probabilities */
return
ff_huff_build_tree
(
s
->
avctx
,
vlc
,
size
,
nodes
,
vp6_huff_cmp
,
return
ff_huff_build_tree
(
s
->
avctx
,
vlc
,
size
,
FF_HUFFMAN_BITS
,
nodes
,
vp6_huff_cmp
,
FF_HUFFMAN_FLAG_HNODE_FIRST
);
}
...
...
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