Welcome! » Log In » Create A New Profile

what is this math theory????

Posted by fancy 
what is this math theory????
June 27, 2003 06:29AM
Hello , Who Can tell me the theory of this codeing ????
thanks!

void CPP_EBSC_ApplyEQToBlock_Inplace(CPs_EqualiserModule* pModule, void* _pPCMBlock, const DWORD dwBlockSize)
{
CPs_EqualiserContext_Basic* pContext = (CPs_EqualiserContext_Basic*)pModule->m_pModuleCookie;
const int iNumSamples = dwBlockSize >> 2;
int* pSampleBase = (int*)_pPCMBlock;
int iSampleIDX, iPointIDX;
unsigned int iThisSample, iThisSample_EQ;
int iThisSample_left, iThisSample_right;
int aryCoefficient_left[9], aryCoefficient_right[9];
int iClips = 0;

// Skip EQ?
if(pContext->m_bStreamIsCapable == FALSE || pContext->m_bEnabled == FALSE)
return;

// Treat samples as ints; Hiword is right channel, Loword is left channel
for(iSampleIDX =0; iSampleIDX < iNumSamples; iSampleIDX++)
{
// Scroll the future sample into this sample
iThisSample = pContext->m_aryFuture[pContext->m_iCursor];
pContext->m_aryFuture[pContext->m_iCursor] = pSampleBase[iSampleIDX];

// Decode channels
iThisSample_left = CIC_DECODESAMPLE_LEFT(iThisSample);
iThisSample_right = CIC_DECODESAMPLE_RIGHT(iThisSample);

// Perform processing

// Add future offsets
for(iPointIDX =0; iPointIDX < 9; iPointIDX++)
{
pContext->m_arySum_left[iPointIDX] += CIC_DECODESAMPLE_LEFT(pContext->m_aryFuture[CIC_WRAPSAMPLE(pContext->m_iCursor+glb_iEQOffsets[iPointIDX])]);
pContext->m_arySum_right[iPointIDX] += CIC_DECODESAMPLE_RIGHT(pContext->m_aryFuture[CIC_WRAPSAMPLE(pContext->m_iCursor+glb_iEQOffsets[iPointIDX])]);
}

// Build scaled coefficients
for(iPointIDX =0; iPointIDX < 9; iPointIDX++)
{
aryCoefficient_left[iPointIDX] = pContext->m_arySum_left[iPointIDX] >> (iPointIDX+1);
aryCoefficient_right[iPointIDX] = pContext->m_arySum_right[iPointIDX] >> (iPointIDX+1);
}

// Perform convolution
iThisSample_left = CIC_FPMULTIPLY(iThisSample_left - aryCoefficient_left[0], pContext->m_aryLevels[0]);
iThisSample_right = CIC_FPMULTIPLY(iThisSample_right - aryCoefficient_right[0], pContext->m_aryLevels[0]);
for(iPointIDX =0; iPointIDX < 8; iPointIDX++)
{
iThisSample_left += CIC_FPMULTIPLY(aryCoefficient_left[iPointIDX] - aryCoefficient_left[iPointIDX+1], pContext->m_aryLevels[iPointIDX+1]);
iThisSample_right += CIC_FPMULTIPLY(aryCoefficient_right[iPointIDX] - aryCoefficient_right[iPointIDX+1], pContext->m_aryLevels[iPointIDX+1]);
}
iThisSample_left += CIC_FPMULTIPLY(aryCoefficient_left[8], pContext->m_aryLevels[9]);
iThisSample_right += CIC_FPMULTIPLY(aryCoefficient_right[8], pContext->m_aryLevels[9]);

// Update sums according to history
for(iPointIDX =0; iPointIDX < 9; iPointIDX++)
{
pContext->m_arySum_left[iPointIDX] -= CIC_DECODESAMPLE_LEFT(pContext->m_aryHistory[CIC_WRAPSAMPLE(pContext->m_iCursor+glb_iEQOffsets_his[iPointIDX])]);
pContext->m_arySum_right[iPointIDX] -= CIC_DECODESAMPLE_RIGHT(pContext->m_aryHistory[CIC_WRAPSAMPLE(pContext->m_iCursor+glb_iEQOffsets_his[iPointIDX])]);
}

// Encode sample
*(short*)&iThisSample_EQ = CIC_TRUNCATESHORT(iThisSample_left);
*((short*)&iThisSample_EQ + 1) = CIC_TRUNCATESHORT(iThisSample_right);

// Write this sample to the output buffer and history buffer
pSampleBase[iSampleIDX] = iThisSample_EQ;
pContext->m_aryHistory[pContext->m_iCursor] = iThisSample;

// Increment circular buffers
pContext->m_iCursor = CIC_WRAPSAMPLE(pContext->m_iCursor+1);
}
}
thanks!
June 30, 2003 04:25AM
thanks!
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically.
 **    **  ********  **     **  **     **  **     ** 
 ***   **     **     **     **  **     **  **     ** 
 ****  **     **     **     **  **     **  **     ** 
 ** ** **     **     *********  *********  **     ** 
 **  ****     **     **     **  **     **   **   **  
 **   ***     **     **     **  **     **    ** **   
 **    **     **     **     **  **     **     ***    
Message: