Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Stefan Strogin
flac
Commits
187e596e
Commit
187e596e
authored
Aug 02, 2013
by
Erik de Castro Lopo
Browse files
stream_encoder.c : Improve fix for arithmetic overflow.
Only use the 32 bit accumulator if the input data is 16 bits or less.
parent
b01e5686
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/libFLAC/stream_encoder.c
View file @
187e596e
...
...
@@ -3772,7 +3772,7 @@ void precompute_partition_info_sums_(
#if defined(FLAC__CPU_IA32) && !defined FLAC__NO_ASM && defined FLAC__HAS_NASM
/* slightly pessimistic but still catches all common cases */
/* WATCHOUT: "+ bps" is an assumption that the average residual magnitude will not be more than "bps" bits */
if
(
bps
<
24
&&
FLAC__bitmath_ilog2
(
default_partition_samples
)
+
bps
<
32
)
{
if
(
bps
<
=
16
)
{
precompute_partition_info_sums_32bit_asm_ia32_
(
residual
,
abs_residual_partition_sums
,
residual_samples
+
predictor_order
,
predictor_order
,
min_partition_order
,
max_partition_order
);
return
;
}
...
...
@@ -3783,7 +3783,7 @@ void precompute_partition_info_sums_(
unsigned
partition
,
residual_sample
,
end
=
(
unsigned
)(
-
(
int
)
predictor_order
);
/* slightly pessimistic but still catches all common cases */
/* WATCHOUT: "+ bps" is an assumption that the average residual magnitude will not be more than "bps" bits */
if
(
bps
<
24
&&
FLAC__bitmath_ilog2
(
default_partition_samples
)
+
bps
<
32
)
{
if
(
bps
<
=
16
)
{
FLAC__uint32
abs_residual_partition_sum
;
for
(
partition
=
residual_sample
=
0
;
partition
<
partitions
;
partition
++
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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