Author: tkreuzer
Date: Wed Sep 6 21:09:25 2017
New Revision: 75779
URL:
http://svn.reactos.org/svn/reactos?rev=75779&view=rev
Log:
[WDMAUD.DRV/KMIXER] Replace a float mul/div/round operation with integer math.
Modified:
trunk/reactos/dll/win32/wdmaud.drv/mixer.c
trunk/reactos/drivers/wdm/audio/filters/kmixer/pin.c
Modified: trunk/reactos/dll/win32/wdmaud.drv/mixer.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wdmaud.drv/mixer…
==============================================================================
--- trunk/reactos/dll/win32/wdmaud.drv/mixer.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/wdmaud.drv/mixer.c [iso-8859-1] Wed Sep 6 21:09:25 2017
@@ -50,7 +50,7 @@
return ERROR_NOT_ENOUGH_MEMORY;
}
- NewSamples = lrintf(((FLOAT)NumSamples * ((FLOAT)NewRate / (FLOAT)OldRate))) + 2;
+ NewSamples = ((((ULONG64)NumSamples * NewRate) + (OldRate / 2)) / OldRate) + 2;
FloatOut = HeapAlloc(GetProcessHeap(), 0, NewSamples * NumChannels * sizeof(FLOAT));
if (!FloatOut)
Modified: trunk/reactos/drivers/wdm/audio/filters/kmixer/pin.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/filters/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/filters/kmixer/pin.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/filters/kmixer/pin.c [iso-8859-1] Wed Sep 6 21:09:25
2017
@@ -59,7 +59,7 @@
return STATUS_INSUFFICIENT_RESOURCES;
}
- NewSamples = lrintf(((FLOAT)NumSamples * ((FLOAT)NewRate / (FLOAT)OldRate))) + 2;
+ NewSamples = ((((ULONG64)NumSamples * NewRate) + (OldRate / 2)) / OldRate) + 2;
FloatOut = ExAllocatePool(NonPagedPool, NewSamples * NumChannels * sizeof(FLOAT));
if (!FloatOut)