Use mid-side processing in channels-together mode in R3; for a more stable stereo image, ensure transient bins are reset in mid whenever they are in side

This commit is contained in:
Chris Cannam
2023-03-17 13:19:18 +00:00
parent d3830870c0
commit e2611485d8
3 changed files with 13 additions and 6 deletions

View File

@@ -94,6 +94,7 @@ public:
const process_t *const *prevMag, const process_t *const *prevMag,
const Guide::Configuration &configuration, const Guide::Configuration &configuration,
const Guide::Guidance *const *guidance, const Guide::Guidance *const *guidance,
bool usingMidSide,
int inhop, int inhop,
int outhop) { int outhop) {
@@ -197,6 +198,9 @@ public:
process_t ph = 0.0; process_t ph = 0.0;
if (inRange(f, g->phaseReset) || inRange(f, g->kick)) { if (inRange(f, g->phaseReset) || inRange(f, g->kick)) {
ph = phase[c][i]; ph = phase[c][i];
} else if (usingMidSide && channels == 2 &&
c == 0 && inRange(f, guidance[1]->phaseReset)) {
ph = phase[c][i];
} else if (inhop == outhop) { } else if (inhop == outhop) {
ph = m_unlocked[c][i]; ph = m_unlocked[c][i];
} else if (inRange (f, g->highUnlocked)) { } else if (inRange (f, g->highUnlocked)) {

View File

@@ -819,9 +819,7 @@ R3Stretcher::retrieve(float *const *output, size_t samples) const
} }
} }
bool useMidSide = (m_parameters.channels == 2); //!!! if (useMidSide()) {
if (useMidSide) {
for (int i = 0; i < got; ++i) { for (int i = 0; i < got; ++i) {
float m = output[0][i]; float m = output[0][i];
float s = output[1][i]; float s = output[1][i];
@@ -838,9 +836,7 @@ R3Stretcher::retrieve(float *const *output, size_t samples) const
void void
R3Stretcher::prepareInput(const float *const *input, int ix, int n) R3Stretcher::prepareInput(const float *const *input, int ix, int n)
{ {
bool useMidSide = (m_parameters.channels == 2); //!!! if (useMidSide()) {
if (useMidSide) {
auto &c0 = m_channelData.at(0)->mixdown; auto &c0 = m_channelData.at(0)->mixdown;
auto &c1 = m_channelData.at(1)->mixdown; auto &c1 = m_channelData.at(1)->mixdown;
for (int i = 0; i < n; ++i) { for (int i = 0; i < n; ++i) {
@@ -971,6 +967,7 @@ R3Stretcher::consume()
m_channelAssembly.prevMag.data(), m_channelAssembly.prevMag.data(),
m_guideConfiguration, m_guideConfiguration,
m_channelAssembly.guidance.data(), m_channelAssembly.guidance.data(),
useMidSide(),
m_prevInhop, m_prevInhop,
m_prevOuthop); m_prevOuthop);
} }

View File

@@ -472,6 +472,12 @@ protected:
} }
} }
bool useMidSide() const {
return m_parameters.channels == 2 &&
(m_parameters.options &
RubberBandStretcher::OptionChannelsTogether);
}
bool isSingleWindowed() const { bool isSingleWindowed() const {
return m_parameters.options & return m_parameters.options &
RubberBandStretcher::OptionWindowShort; RubberBandStretcher::OptionWindowShort;