Skip to content

Optimize bDelayPan and divisions#3706

Open
ann0see wants to merge 1 commit into
jamulussoftware:mainfrom
ann0see:opt1/mixencodetx
Open

Optimize bDelayPan and divisions#3706
ann0see wants to merge 1 commit into
jamulussoftware:mainfrom
ann0see:opt1/mixencodetx

Conversation

@ann0see
Copy link
Copy Markdown
Member

@ann0see ann0see commented May 20, 2026

Short description of changes

Moves delay pan checking slightly out of loop as this setting does not change often.
Moreover replaces some divisions with *0.5 and remove some modulo computations

CHANGELOG: Server: Optimize mixing

Context: Fixes an issue?

Related to: #3662

Does this change need documentation? What needs to be documented and how?

No

Status of this Pull Request

Ready for review

What is missing until this pull request can be merged?

Tested and it seems to work, I still would like an external test.

Checklist

  • I've verified that this Pull Request follows the general code principles
  • I tested my code and it does what I want
  • My code follows the style guide
  • I waited some time after this Pull Request was opened and all GitHub checks completed without errors.
  • I've filled all the content above

Comment thread src/server.cpp
Comment on lines -1120 to -1129
if ( ( i & 1 ) == 0 )
{
// if even : left channel
vecfIntermProcBuf[i] += vecsData[i] * fGainL;
}
else
{
// if odd : right channel
vecfIntermProcBuf[i] += vecsData[i] * fGainR;
}
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got rid of modulo computation

@ann0see ann0see requested review from pljones and softins May 20, 2026 20:38
@ann0see ann0see added this to Tracking May 20, 2026
@github-project-automation github-project-automation Bot moved this to Triage in Tracking May 20, 2026
@ann0see ann0see moved this from Triage to Waiting on Team in Tracking May 20, 2026
@ann0see ann0see force-pushed the opt1/mixencodetx branch 2 times, most recently from c6038cc to ccd6f5e Compare May 20, 2026 20:45
Copy link
Copy Markdown
Member Author

@ann0see ann0see left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function is still way too complex imo.

@ann0see ann0see force-pushed the opt1/mixencodetx branch from ccd6f5e to 62a6218 Compare May 20, 2026 20:47
@ann0see
Copy link
Copy Markdown
Member Author

ann0see commented May 20, 2026

To avoid having the clipping to short twice, we may want someting like

    // convert from double to short with clipping
    for ( i = 0; i < ( ( bTargetIsMono ? 1 : 2 ) * iServerFrameSizeSamples ); i++ )
    {
        vecsSendData[i] = Float2Short ( vecfIntermProcBuf[i] );
    }

Maybe...

@ann0see ann0see force-pushed the opt1/mixencodetx branch from 62a6218 to d6372fb Compare May 20, 2026 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Waiting on Team

Development

Successfully merging this pull request may close these issues.

1 participant