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
c116dd84
Commit
c116dd84
authored
Feb 22, 2020
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/apedec: fix decoding 3800 version with 2000 compression level
parent
8e197a96
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
3 deletions
+18
-3
apedec.c
libavcodec/apedec.c
+18
-3
No files found.
libavcodec/apedec.c
View file @
c116dd84
...
...
@@ -586,6 +586,11 @@ static inline int ape_decode_value_3990(APEContext *ctx, APERice *rice)
return
((
x
>>
1
)
^
((
x
&
1
)
-
1
))
+
1
;
}
static
int
get_k
(
int
ksum
)
{
return
av_log2
(
ksum
)
+
!!
ksum
;
}
static
void
decode_array_0000
(
APEContext
*
ctx
,
GetBitContext
*
gb
,
int32_t
*
out
,
APERice
*
rice
,
int
blockstodecode
)
{
...
...
@@ -597,22 +602,31 @@ static void decode_array_0000(APEContext *ctx, GetBitContext *gb,
out
[
i
]
=
get_rice_ook
(
&
ctx
->
gb
,
10
);
rice
->
ksum
+=
out
[
i
];
}
rice
->
k
=
av_log2
(
rice
->
ksum
/
10
)
+
1
;
if
(
blockstodecode
<=
5
)
goto
end
;
rice
->
k
=
get_k
(
rice
->
ksum
/
10
);
if
(
rice
->
k
>=
24
)
return
;
for
(;
i
<
FFMIN
(
blockstodecode
,
64
);
i
++
)
{
out
[
i
]
=
get_rice_ook
(
&
ctx
->
gb
,
rice
->
k
);
rice
->
ksum
+=
out
[
i
];
rice
->
k
=
av_log2
(
rice
->
ksum
/
((
i
+
1
)
*
2
))
+
1
;
rice
->
k
=
get_k
(
rice
->
ksum
/
((
i
+
1
)
*
2
))
;
if
(
rice
->
k
>=
24
)
return
;
}
if
(
blockstodecode
<=
64
)
goto
end
;
rice
->
k
=
get_k
(
rice
->
ksum
>>
7
);
ksummax
=
1
<<
rice
->
k
+
7
;
ksummin
=
rice
->
k
?
(
1
<<
rice
->
k
+
6
)
:
0
;
for
(;
i
<
blockstodecode
;
i
++
)
{
if
(
get_bits_left
(
&
ctx
->
gb
)
<
1
)
{
ctx
->
error
=
1
;
return
;
return
;
}
out
[
i
]
=
get_rice_ook
(
&
ctx
->
gb
,
rice
->
k
);
rice
->
ksum
+=
out
[
i
]
-
(
unsigned
)
out
[
i
-
64
];
...
...
@@ -630,6 +644,7 @@ static void decode_array_0000(APEContext *ctx, GetBitContext *gb,
}
}
end:
for
(
i
=
0
;
i
<
blockstodecode
;
i
++
)
out
[
i
]
=
((
out
[
i
]
>>
1
)
^
((
out
[
i
]
&
1
)
-
1
))
+
1
;
}
...
...
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