diff --git a/include/sst/basic-blocks/dsp/BlockInterpolators.h b/include/sst/basic-blocks/dsp/BlockInterpolators.h index 2e02f65..73671a8 100644 --- a/include/sst/basic-blocks/dsp/BlockInterpolators.h +++ b/include/sst/basic-blocks/dsp/BlockInterpolators.h @@ -227,6 +227,28 @@ template struct alignas(16) lip fade_block_to(src21, src22, dst2, bsQuad); } + void fade_blocks_inplace(float *__restrict inAOut, float *__restrict inB) const + { + for (int i = 0; i < numRegisters; ++i) + { + auto a = _mm_load_ps(inAOut + (i << 2)); + auto b = _mm_load_ps(inB + (i << 2)); + auto sa = _mm_mul_ps(a, _mm_sub_ps(one, line[i])); + auto sb = _mm_mul_ps(b, line[i]); + auto r = _mm_add_ps(sa, sb); + _mm_store_ps(inAOut + (i << 2), r); + } + } + + void fade_2_blocks_inplace(float *__restrict src11out, float *__restrict src12, + float *__restrict src21out, float *__restrict src22, + int bsQuad = -1) const + { + assert(bsQuad == -1 || bsQuad == numRegisters); + fade_blocks_inplace(src11out, src12); + fade_blocks_inplace(src21out, src22); + } + void store_block(float *__restrict out, int bsQuad = -1) const { assert(bsQuad == -1 || bsQuad == numRegisters); diff --git a/include/sst/basic-blocks/mechanics/block-ops.h b/include/sst/basic-blocks/mechanics/block-ops.h index 09cf53c..846da92 100644 --- a/include/sst/basic-blocks/mechanics/block-ops.h +++ b/include/sst/basic-blocks/mechanics/block-ops.h @@ -79,6 +79,15 @@ inline void add_block(const float *__restrict src1, const float *__restrict src2 } } +template +inline void add_block(float *__restrict srcdst, const float *__restrict src2) +{ + for (auto i = 0U; i < blocksize; ++i) + { + srcdst[i] = srcdst[i] + src2[i]; + } +} + template inline void mul_block(float *__restrict src1, float *src2, float *__restrict dst) { @@ -96,6 +105,23 @@ inline void mul_block(float *__restrict src1, float scalar, float *__restrict ds dst[i] = src1[i] * scalar; } } + +template inline void mul_block(float *__restrict srcDst, float *__restrict by) +{ + for (auto i = 0U; i < blockSize; ++i) + { + srcDst[i] = srcDst[i] * by[i]; + } +} + +template inline void mul_block(float *__restrict srcDst, float by) +{ + for (auto i = 0U; i < blockSize; ++i) + { + srcDst[i] = srcDst[i] * by; + } +} + template inline void scale_by(const float *__restrict scale, float *__restrict target) {