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
5eeba07e
Commit
5eeba07e
authored
Apr 17, 2008
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Factorize more code.
Originally committed as revision 12874 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
5a5a27c5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
20 deletions
+12
-20
alac.c
libavcodec/alac.c
+12
-20
No files found.
libavcodec/alac.c
View file @
5eeba07e
...
@@ -146,7 +146,14 @@ static inline int count_leading_zeros(int32_t input)
...
@@ -146,7 +146,14 @@ static inline int count_leading_zeros(int32_t input)
}
}
static
inline
int
decode_postfix
(
GetBitContext
*
gb
,
int
x
,
int
k
,
int
limit
){
static
inline
int
decode_scalar
(
GetBitContext
*
gb
,
int
k
,
int
limit
,
int
readsamplesize
){
/* read x - number of 1s before 0 represent the rice */
int
x
=
get_unary_0_9
(
gb
);
if
(
x
>
8
)
{
/* RICE THRESHOLD */
/* use alternative encoding */
x
=
get_bits
(
gb
,
readsamplesize
);
}
else
{
if
(
k
>=
limit
)
if
(
k
>=
limit
)
k
=
limit
;
k
=
limit
;
...
@@ -162,6 +169,7 @@ static inline int decode_postfix(GetBitContext *gb, int x, int k, int limit){
...
@@ -162,6 +169,7 @@ static inline int decode_postfix(GetBitContext *gb, int x, int k, int limit){
}
else
}
else
skip_bits
(
gb
,
k
-
1
);
skip_bits
(
gb
,
k
-
1
);
}
}
}
return
x
;
return
x
;
}
}
...
@@ -184,20 +192,12 @@ static void bastardized_rice_decompress(ALACContext *alac,
...
@@ -184,20 +192,12 @@ static void bastardized_rice_decompress(ALACContext *alac,
int32_t
x_modified
;
int32_t
x_modified
;
int32_t
final_val
;
int32_t
final_val
;
/* read x - number of 1s before 0 represent the rice */
x
=
get_unary_0_9
(
&
alac
->
gb
);
if
(
x
>
8
)
{
/* RICE THRESHOLD */
/* use alternative encoding */
x
=
get_bits
(
&
alac
->
gb
,
readsamplesize
);
}
else
{
/* standard rice encoding */
/* standard rice encoding */
int
k
;
/* size of extra bits */
int
k
;
/* size of extra bits */
/* read k, that is bits as is */
/* read k, that is bits as is */
k
=
31
-
count_leading_zeros
((
history
>>
9
)
+
3
);
k
=
31
-
count_leading_zeros
((
history
>>
9
)
+
3
);
x
=
decode_postfix
(
&
alac
->
gb
,
x
,
k
,
rice_kmodifier
);
x
=
decode_scalar
(
&
alac
->
gb
,
k
,
rice_kmodifier
,
readsamplesize
);
}
x_modified
=
sign_modifier
+
x
;
x_modified
=
sign_modifier
+
x
;
final_val
=
(
x_modified
+
1
)
/
2
;
final_val
=
(
x_modified
+
1
)
/
2
;
...
@@ -216,21 +216,13 @@ static void bastardized_rice_decompress(ALACContext *alac,
...
@@ -216,21 +216,13 @@ static void bastardized_rice_decompress(ALACContext *alac,
/* special case: there may be compressed blocks of 0 */
/* special case: there may be compressed blocks of 0 */
if
((
history
<
128
)
&&
(
output_count
+
1
<
output_size
))
{
if
((
history
<
128
)
&&
(
output_count
+
1
<
output_size
))
{
int
block_size
;
int
block_size
,
k
;
sign_modifier
=
1
;
sign_modifier
=
1
;
x
=
get_unary_0_9
(
&
alac
->
gb
);
if
(
x
>
8
)
{
block_size
=
get_bits
(
&
alac
->
gb
,
16
);
}
else
{
int
k
;
k
=
count_leading_zeros
(
history
)
+
((
history
+
16
)
>>
6
/* / 64 */
)
-
24
;
k
=
count_leading_zeros
(
history
)
+
((
history
+
16
)
>>
6
/* / 64 */
)
-
24
;
block_size
=
decode_postfix
(
&
alac
->
gb
,
x
,
k
,
rice_kmodifier
);
block_size
=
decode_scalar
(
&
alac
->
gb
,
k
,
rice_kmodifier
,
16
);
}
if
(
block_size
>
0
)
{
if
(
block_size
>
0
)
{
memset
(
&
output_buffer
[
output_count
+
1
],
0
,
block_size
*
4
);
memset
(
&
output_buffer
[
output_count
+
1
],
0
,
block_size
*
4
);
...
...
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