PortAudio
2.0
|
Functions for generating dither noise. More...
#include "pa_types.h"
Go to the source code of this file.
Data Structures | |
struct | PaUtilTriangularDitherGenerator |
State needed to generate a dither signal. More... | |
Typedefs | |
typedef struct PaUtilTriangularDitherGenerator | PaUtilTriangularDitherGenerator |
State needed to generate a dither signal. More... | |
Functions | |
void | PaUtil_InitializeTriangularDitherState (PaUtilTriangularDitherGenerator *ditherState) |
Initialize dither state. More... | |
PaInt32 | 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: More... | |
float | PaUtil_GenerateFloatTriangularDither (PaUtilTriangularDitherGenerator *ditherState) |
Calculate 2 LSB dither signal with a triangular distribution. Ranged for adding to a pre-scaled float. More... | |
Functions for generating dither noise.
typedef struct PaUtilTriangularDitherGenerator PaUtilTriangularDitherGenerator |
State needed to generate a dither signal.
PaInt32 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 main(), and PaUtil_InitializeBufferProcessor().