Functions for generating dither noise. More...
Go to the source code of this file.
Data Structures | |
struct | PaUtilTriangularDitherGenerator |
State needed to generate a dither signal. More... | |
Functions | |
void | PaUtil_InitializeTriangularDitherState (PaUtilTriangularDitherGenerator *ditherState) |
Initialize dither state. | |
signed long | PaUtil_Generate16BitTriangularDither (PaUtilTriangularDitherGenerator *ditherState) |
Calculate 2 LSB dither signal with a triangular distribution. Ranged for adding to a 1 bit right-shifted 32 bit integer prior to >>15. eg:. | |
float | PaUtil_GenerateFloatTriangularDither (PaUtilTriangularDitherGenerator *ditherState) |
Calculate 2 LSB dither signal with a triangular distribution. Ranged for adding to a pre-scaled float. |
Functions for generating dither noise.
signed long PaUtil_Generate16BitTriangularDither | ( | PaUtilTriangularDitherGenerator * | ditherState | ) |
Calculate 2 LSB dither signal with a triangular distribution. Ranged for adding to a 1 bit right-shifted 32 bit integer prior to >>15. eg:.
signed long in = * signed long dither = PaUtil_Generate16BitTriangularDither( ditherState ); signed short out = (signed short)(((in>>1) + dither) >> 15);
References DITHER_SHIFT_, PaUtilTriangularDitherGenerator::previous, PaUtilTriangularDitherGenerator::randSeed1, and PaUtilTriangularDitherGenerator::randSeed2.
float PaUtil_GenerateFloatTriangularDither | ( | PaUtilTriangularDitherGenerator * | ditherState | ) |
Calculate 2 LSB dither signal with a triangular distribution. Ranged for adding to a pre-scaled float.
float in = * float dither = PaUtil_GenerateFloatTriangularDither( ditherState ); // use smaller scaler to prevent overflow when we add the dither signed short out = (signed short)(in*(32766.0f) + dither );
References DITHER_SHIFT_, PaUtilTriangularDitherGenerator::previous, PaUtilTriangularDitherGenerator::randSeed1, and PaUtilTriangularDitherGenerator::randSeed2.
void PaUtil_InitializeTriangularDitherState | ( | PaUtilTriangularDitherGenerator * | ditherState | ) |
Initialize dither state.
References PaUtilTriangularDitherGenerator::previous, PaUtilTriangularDitherGenerator::randSeed1, and PaUtilTriangularDitherGenerator::randSeed2.
Referenced by PaUtil_InitializeBufferProcessor().