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
f6f36ca8
Commit
f6f36ca8
authored
Jul 03, 2013
by
Luca Barbato
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
indeo: Refactor ff_ivi_dec_huff_desc
Spare an indentation level.
parent
e6d8acf6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
30 deletions
+32
-30
ivi_common.c
libavcodec/ivi_common.c
+32
-30
No files found.
libavcodec/ivi_common.c
View file @
f6f36ca8
...
@@ -156,41 +156,43 @@ int ff_ivi_dec_huff_desc(GetBitContext *gb, int desc_coded, int which_tab,
...
@@ -156,41 +156,43 @@ int ff_ivi_dec_huff_desc(GetBitContext *gb, int desc_coded, int which_tab,
if
(
!
desc_coded
)
{
if
(
!
desc_coded
)
{
/* select default table */
/* select default table */
huff_tab
->
tab
=
(
which_tab
)
?
&
ivi_blk_vlc_tabs
[
7
]
huff_tab
->
tab
=
(
which_tab
)
?
&
ivi_blk_vlc_tabs
[
7
]
:
&
ivi_mb_vlc_tabs
[
7
];
:
&
ivi_mb_vlc_tabs
[
7
];
}
else
{
return
0
;
huff_tab
->
tab_sel
=
get_bits
(
gb
,
3
);
}
if
(
huff_tab
->
tab_sel
==
7
)
{
/* custom huffman table (explicitly encoded) */
new_huff
.
num_rows
=
get_bits
(
gb
,
4
);
if
(
!
new_huff
.
num_rows
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Empty custom Huffman table!
\n
"
);
return
AVERROR_INVALIDDATA
;
}
for
(
i
=
0
;
i
<
new_huff
.
num_rows
;
i
++
)
huff_tab
->
tab_sel
=
get_bits
(
gb
,
3
);
new_huff
.
xbits
[
i
]
=
get_bits
(
gb
,
4
);
if
(
huff_tab
->
tab_sel
==
7
)
{
/* custom huffman table (explicitly encoded) */
new_huff
.
num_rows
=
get_bits
(
gb
,
4
);
if
(
!
new_huff
.
num_rows
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Empty custom Huffman table!
\n
"
);
return
AVERROR_INVALIDDATA
;
}
/* Have we got the same custom table? Rebuild if not. */
for
(
i
=
0
;
i
<
new_huff
.
num_rows
;
i
++
)
if
(
ivi_huff_desc_cmp
(
&
new_huff
,
&
huff_tab
->
cust_desc
))
{
new_huff
.
xbits
[
i
]
=
get_bits
(
gb
,
4
);
ivi_huff_desc_copy
(
&
huff_tab
->
cust_desc
,
&
new_huff
);
if
(
huff_tab
->
cust_tab
.
table
)
/* Have we got the same custom table? Rebuild if not. */
ff_free_vlc
(
&
huff_tab
->
cust_tab
);
if
(
ivi_huff_desc_cmp
(
&
new_huff
,
&
huff_tab
->
cust_desc
))
{
result
=
ivi_create_huff_from_desc
(
&
huff_tab
->
cust_desc
,
ivi_huff_desc_copy
(
&
huff_tab
->
cust_desc
,
&
new_huff
);
&
huff_tab
->
cust_tab
,
0
);
if
(
result
)
{
if
(
huff_tab
->
cust_tab
.
table
)
huff_tab
->
cust_desc
.
num_rows
=
0
;
// reset faulty description
ff_free_vlc
(
&
huff_tab
->
cust_tab
);
av_log
(
avctx
,
AV_LOG_ERROR
,
result
=
ivi_create_huff_from_desc
(
&
huff_tab
->
cust_desc
,
"Error while initializing custom vlc table!
\n
"
);
&
huff_tab
->
cust_tab
,
0
);
return
result
;
if
(
result
)
{
}
// reset faulty description
huff_tab
->
cust_desc
.
num_rows
=
0
;
av_log
(
avctx
,
AV_LOG_ERROR
,
"Error while initializing custom vlc table!
\n
"
);
return
result
;
}
}
huff_tab
->
tab
=
&
huff_tab
->
cust_tab
;
}
else
{
/* select one of predefined tables */
huff_tab
->
tab
=
(
which_tab
)
?
&
ivi_blk_vlc_tabs
[
huff_tab
->
tab_sel
]
:
&
ivi_mb_vlc_tabs
[
huff_tab
->
tab_sel
];
}
}
huff_tab
->
tab
=
&
huff_tab
->
cust_tab
;
}
else
{
/* select one of predefined tables */
huff_tab
->
tab
=
(
which_tab
)
?
&
ivi_blk_vlc_tabs
[
huff_tab
->
tab_sel
]
:
&
ivi_mb_vlc_tabs
[
huff_tab
->
tab_sel
];
}
}
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