Skip to content

Commit ea7d85f

Browse files
committed
Small math optimizations for dsp::smooth_cubic_linear and dsp::smooth_cubic_log functions.
1 parent 9a9006a commit ea7d85f

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

CHANGELOG

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
*******************************************************************************
44

55
=== 1.0.11 ===
6-
6+
* Small math optimizations for dsp::smooth_cubic_linear and dsp::smooth_cubic_log
7+
functions.
78

89
=== 1.0.10 ===
910
* ARM NEON-optimized code compiles now only for at least ARMv6 architecture.

include/private/dsp/arch/generic/graphics/interpolation.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,28 +32,28 @@ namespace lsp
3232
{
3333
void smooth_cubic_linear(float *dst, float start, float stop, size_t count)
3434
{
35-
float dy = stop - start;
35+
float dy = 2.0f * (stop - start);
3636
float nx = 1.0f / (count + 1); // Normalizing x
3737

3838
for (size_t i=0; i<count; ++i)
3939
{
4040
float x = i * nx;
41-
*(dst++) = start + dy * x*x * (3.0f - 2.0f * x);
41+
*(dst++) = start + dy * x*x * (1.5f - x);
4242
}
4343
}
4444

4545
void smooth_cubic_log(float *dst, float start, float stop, size_t count)
4646
{
47-
float dy = logf(stop/start);
47+
float dy = 2.0f * logf(stop/start);
4848
float nx = 1.0f / (count + 1); // Normalizing x
4949

5050
for (size_t i=0; i<count; ++i)
5151
{
5252
float x = i * nx;
53-
*(dst++) = start * expf(dy * x*x * (3.0f - 2.0f * x));
53+
*(dst++) = start * expf(dy * x*x * (1.5f - x));
5454
}
5555
}
56-
}
57-
}
56+
} /* namespace generic */
57+
} /* namespace lsp */
5858

5959
#endif /* PRIVATE_DSP_ARCH_GENERIC_GRAPHICS_INTERPOLATION_H_ */

0 commit comments

Comments
 (0)