PortAudio 2.0
paqa_dither.c File Reference

Tests the dither scaling and conversion accuracy in pa_converters.c. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "portaudio.h"
#include "pa_converters.h"
#include "pa_dither.h"
#include "pa_types.h"
#include "pa_endianness.h"
#include "paqa_macros.h"

Macros

#define PAQA_SHOW_CHARTS   0
 
#define NUM_BINS   32
 
#define NUM_SAMPLES   1024
 
#define LINEARITY_NUM_STEPS   41
 

Functions

int ShowDitherDistribution (void)
 
double CalculateRSquared (double *xa, double *ya, int numPoints)
 
void linearRegression (double *xa, double *ya, int numPoints, double *a, double *b)
 
int TestAllDitherScaling (void)
 
int TestAllDitherClipping (void)
 
int main (int argc, const char **argv)
 

Detailed Description

Tests the dither scaling and conversion accuracy in pa_converters.c.

Author
Phil Burk philb.nosp@m.urk@.nosp@m.mobil.nosp@m.eer..nosp@m.com

Link with pa_dither.c and pa_converters.c

Macro Definition Documentation

◆ LINEARITY_NUM_STEPS

#define LINEARITY_NUM_STEPS   41

◆ NUM_BINS

#define NUM_BINS   32

Referenced by ShowDitherDistribution().

◆ NUM_SAMPLES

#define NUM_SAMPLES   1024

◆ PAQA_SHOW_CHARTS

#define PAQA_SHOW_CHARTS   0

Function Documentation

◆ CalculateRSquared()

double CalculateRSquared ( double * xa,
double * ya,
int numPoints )

Calculate the Coefficient of Determination, "R-squared". You want a value as close to 1.0 as possible.

◆ linearRegression()

void linearRegression ( double * xa,
double * ya,
int numPoints,
double * a,
double * b )

◆ main()

int main ( int argc,
const char ** argv )

◆ ShowDitherDistribution()

int ShowDitherDistribution ( void )

Show a histogram of the dither values.

References NUM_BINS, PaUtil_Generate16BitTriangularDither(), and PaUtil_InitializeTriangularDitherState().

Referenced by main().

◆ TestAllDitherClipping()

int TestAllDitherClipping ( void )

References paFloat32, paInt16, paInt32, paInt8, and paUInt8.

Referenced by main().

◆ TestAllDitherScaling()

int TestAllDitherScaling ( void )

References paFloat32, paInt16, paInt32, and paInt8.

Referenced by main().