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
b6fcb2bb
Commit
b6fcb2bb
authored
May 17, 2015
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/flacdec: Attempt to auto-detect old buggy flac
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
83356cf6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
+29
-0
flacdec.c
libavcodec/flacdec.c
+29
-0
No files found.
libavcodec/flacdec.c
View file @
b6fcb2bb
...
...
@@ -315,6 +315,33 @@ static int decode_subframe_fixed(FLACContext *s, int32_t *decoded,
return
0
;
}
static
void
lpc_analyze_remodulate
(
int32_t
*
decoded
,
const
int
coeffs
[
32
],
int
order
,
int
qlevel
,
int
len
,
int
bps
)
{
int
i
,
j
;
int
ebps
=
1
<<
(
bps
-
1
);
unsigned
sigma
=
0
;
for
(
i
=
order
;
i
<
len
;
i
++
)
sigma
|=
decoded
[
i
]
+
ebps
;
if
(
sigma
<
2
*
ebps
)
return
;
for
(
i
=
len
-
1
;
i
>=
order
;
i
--
)
{
int64_t
p
=
0
;
for
(
j
=
0
;
j
<
order
;
j
++
)
p
+=
coeffs
[
j
]
*
(
int64_t
)
decoded
[
i
-
order
+
j
];
decoded
[
i
]
-=
p
>>
qlevel
;
}
for
(
i
=
order
;
i
<
len
;
i
++
,
decoded
++
)
{
int32_t
p
=
0
;
for
(
j
=
0
;
j
<
order
;
j
++
)
p
+=
coeffs
[
j
]
*
(
uint32_t
)
decoded
[
j
];
decoded
[
j
]
+=
p
>>
qlevel
;
}
}
static
int
decode_subframe_lpc
(
FLACContext
*
s
,
int32_t
*
decoded
,
int
pred_order
,
int
bps
)
{
...
...
@@ -352,6 +379,8 @@ static int decode_subframe_lpc(FLACContext *s, int32_t *decoded, int pred_order,
s
->
dsp
.
lpc16
(
decoded
,
coeffs
,
pred_order
,
qlevel
,
s
->
blocksize
);
}
else
{
s
->
dsp
.
lpc32
(
decoded
,
coeffs
,
pred_order
,
qlevel
,
s
->
blocksize
);
if
(
s
->
flac_stream_info
.
bps
<=
16
)
lpc_analyze_remodulate
(
decoded
,
coeffs
,
pred_order
,
qlevel
,
s
->
blocksize
,
bps
);
}
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