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
64f34e6e
Commit
64f34e6e
authored
Oct 10, 2013
by
Erik de Castro Lopo
Browse files
libFLAC/stream_encoder.c : Fix MSVS profiler hot spot.
Patch-from: vqcl <lvqcl.mail@gmail.com>
parent
55049aad
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/libFLAC/stream_encoder.c
View file @
64f34e6e
...
...
@@ -4077,8 +4077,35 @@ FLAC__bool set_partitioned_rice_(
* in the partition, so the actual mean is
* mean/partition_samples
*/
#if 0 /* old simple code */
for(rice_parameter = 0, k = partition_samples; k < mean; rice_parameter++, k <<= 1)
;
#else
#if defined FLAC__CPU_X86_64
/* and other 64-bit arch, too */
if
(
mean
<=
0x80000000
/
512
)
{
/* 512: more or less optimal for both 16- and 24-bit input */
#else
if
(
mean
<=
0x80000000
/
8
)
{
/* 32-bit arch: use 32-bit math if possible */
#endif
FLAC__uint32
k2
,
mean2
=
(
FLAC__uint32
)
mean
;
rice_parameter
=
0
;
k2
=
partition_samples
;
while
(
k2
*
8
<
mean2
)
{
/* requires: mean <= (2^31)/8 */
rice_parameter
+=
4
;
k2
<<=
4
;
/* tuned for 16-bit input */
}
while
(
k2
<
mean2
)
{
/* requires: mean <= 2^31 */
rice_parameter
++
;
k2
<<=
1
;
}
}
else
{
rice_parameter
=
0
;
k
=
partition_samples
;
if
(
mean
<=
FLAC__U64L
(
0x8000000000000000
)
/
128
)
/* usually mean is _much_ smaller than this value */
while
(
k
*
128
<
mean
)
{
/* requires: mean <= (2^63)/128 */
rice_parameter
+=
8
;
k
<<=
8
;
/* tuned for 24-bit input */
}
while
(
k
<
mean
)
{
/* requires: mean <= 2^63 */
rice_parameter
++
;
k
<<=
1
;
}
}
#endif
if
(
rice_parameter
>=
rice_parameter_limit
)
{
#ifdef DEBUG_VERBOSE
fprintf
(
stderr
,
"clipping rice_parameter (%u -> %u) @6
\n
"
,
rice_parameter
,
rice_parameter_limit
-
1
);
...
...
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