disable dither conversion when host input format is 32 bit and user format is 24 bit. the converter for this is unimplemented anyway, and the host won't ever be sending us better than 24 bit data, so no need to dither it.

This commit is contained in:
rossb 2010-12-26 06:43:58 +00:00
commit ce6c4dfba6

View file

@ -137,6 +137,7 @@ PaError PaUtil_InitializeBufferProcessor( PaUtilBufferProcessor* bp,
PaError result = paNoError;
PaError bytesPerSample;
unsigned long tempInputBufferSize, tempOutputBufferSize;
PaStreamFlags tempInputStreamFlags;
if( streamFlags & paNeverDropInput )
{
@ -257,8 +258,20 @@ PaError PaUtil_InitializeBufferProcessor( PaUtilBufferProcessor* bp,
goto error;
}
/* Under the assumption that no ADC in existence delivers better than 24bits resoultion,
we disable dithering when host input format is paInt32 and user format is paInt24,
since the host samples will just be padded with zeros anyway. */
tempInputStreamFlags = streamFlags;
if( !(tempInputStreamFlags & paDitherOff) /* dither is on */
&& (hostInputSampleFormat & paInt32) /* host input format is int32 */
&& (userInputSampleFormat & paInt24) /* user requested format is int24 */ ){
tempInputStreamFlags = tempInputStreamFlags | paDitherOff;
}
bp->inputConverter =
PaUtil_SelectConverter( hostInputSampleFormat, userInputSampleFormat, streamFlags );
PaUtil_SelectConverter( hostInputSampleFormat, userInputSampleFormat, tempInputStreamFlags );
bp->inputZeroer = PaUtil_SelectZeroer( hostInputSampleFormat );