Audacity 3.2.0
|
This class implements various functions for dithering and is derived from the dither code in the Ardour project, written by Steve Harris. More...
#include <Dither.h>
Public Member Functions | |
Dither () | |
Default constructor. More... | |
void | Reset () |
Reset state of the dither. More... | |
void | Apply (DitherType ditherType, constSamplePtr source, sampleFormat sourceFormat, samplePtr dest, sampleFormat destFormat, unsigned int len, unsigned int sourceStride=1, unsigned int destStride=1) |
Static Public Member Functions | |
static DitherType | FastDitherChoice () |
static DitherType | BestDitherChoice () |
Static Public Attributes | |
static EnumSetting< DitherType > | FastSetting |
static EnumSetting< DitherType > | BestSetting |
This class implements various functions for dithering and is derived from the dither code in the Ardour project, written by Steve Harris.
Dithering is only done if it really is necessary. Otherwise (e.g. when the source and destination format of the samples is the same), the samples are only copied or converted. However, copied samples are always checked for out-of-bounds values and possibly clipped accordingly.
These dither algorithms are currently implemented:
Dither class. You must construct an instance because it keeps state. Call Dither::Apply() to apply the dither. You can call Reset() between subsequent dithers to reset the dither state and get deterministic behaviour.
Dither::Dither | ( | ) |
Default constructor.
Definition at line 187 of file Dither.cpp.
References Reset().
void Dither::Apply | ( | DitherType | ditherType, |
constSamplePtr | source, | ||
sampleFormat | sourceFormat, | ||
samplePtr | dest, | ||
sampleFormat | destFormat, | ||
unsigned int | len, | ||
unsigned int | sourceStride = 1 , |
||
unsigned int | destStride = 1 |
||
) |
Apply the actual dithering. Expects the source sample in the 'source' variable, the destination sample in the 'dest' variable, and hints to the formats of the samples. Even if the sample formats are the same, samples are clipped, if necessary.
Definition at line 216 of file Dither.cpp.
References DITHER(), floatSample, FROM_INT16(), FROM_INT24(), int16Sample, int24Sample, mState, NoDither(), none, rectangle, RectangleDither(), Reset(), SAMPLE_SIZE, shaped, ShapedDither(), triangle, and TriangleDither().
Referenced by CopySamples().
|
static |
Definition at line 415 of file Dither.cpp.
References BestSetting, and EnumSetting< Enum >::ReadEnum().
Referenced by InitDitherers().
|
static |
Definition at line 410 of file Dither.cpp.
References FastSetting, and EnumSetting< Enum >::ReadEnum().
Referenced by InitDitherers().
void Dither::Reset | ( | ) |
Reset state of the dither.
Definition at line 193 of file Dither.cpp.
References BUF_SIZE, State::mBuffer, State::mPhase, mState, and State::mTriangleState.
Referenced by Apply(), and Dither().
|
static |
Definition at line 29 of file Dither.h.
Referenced by BestDitherChoice(), and QualityPrefs::PopulateOrExchange().
|
static |
Definition at line 28 of file Dither.h.
Referenced by FastDitherChoice(), and QualityPrefs::PopulateOrExchange().