Haaan
8th March 2004, 02:14
Hey, i'm writing a AC3 encoder filter to output 6 PCM channels on a SPDIF output.
Now I am including an option to resample 48Khz (for 44.1Khz or lower input) because it's compatible with all dolby digital decoders.
The problem is the result sounds crappy (even when I'm doing a 48Khz -> 48Khz "conversion").
Here is some of the usefull code
m_pReSampler = SSRC_create(m_wfxInput.nSamplesPerSec, m_nReSamplerSamplingRate,
m_wfxInput.wBitsPerSample, 16, m_wfxInput.nChannels, 1, 1, 0, 0);
HRESULT CDolbyOutFilter::Receive(IMediaSample *pIn)
{
...
m_pReSampler->Write(pbyInputBuffer, lInputBufferSize);
for ( ; ; )
{
unsigned int nSize;
m_pbyReceiveBuffer = (BYTE *)m_pReSampler->GetBuffer(&nSize);
if (nSize < (unsigned int)m_lReceiveBufferSize)
break;
m_pReSampler->Read(m_lReceiveBufferSize);
if (ReceiveFrame() != FALSE) // Outputs m_pbyReceiveBuffer contents
{
bResult = TRUE;
}
}
...
}
Now I am including an option to resample 48Khz (for 44.1Khz or lower input) because it's compatible with all dolby digital decoders.
The problem is the result sounds crappy (even when I'm doing a 48Khz -> 48Khz "conversion").
Here is some of the usefull code
m_pReSampler = SSRC_create(m_wfxInput.nSamplesPerSec, m_nReSamplerSamplingRate,
m_wfxInput.wBitsPerSample, 16, m_wfxInput.nChannels, 1, 1, 0, 0);
HRESULT CDolbyOutFilter::Receive(IMediaSample *pIn)
{
...
m_pReSampler->Write(pbyInputBuffer, lInputBufferSize);
for ( ; ; )
{
unsigned int nSize;
m_pbyReceiveBuffer = (BYTE *)m_pReSampler->GetBuffer(&nSize);
if (nSize < (unsigned int)m_lReceiveBufferSize)
break;
m_pReSampler->Read(m_lReceiveBufferSize);
if (ReceiveFrame() != FALSE) // Outputs m_pbyReceiveBuffer contents
{
bResult = TRUE;
}
}
...
}