1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-09-18 17:10:55 +02:00

Comments about dithering in SqliteSampleBlock

This commit is contained in:
Paul Licameli 2020-12-01 14:58:08 -05:00
parent 528b57ff8e
commit 4fcb8bffbf

View File

@ -593,6 +593,42 @@ size_t SqliteSampleBlock::GetBlob(void *dest,
srcoffset += 0;
}
/*
Will dithering happen in CopySamples? Answering this as of 3.0.3 by
examining all uses.
As this function is called from GetSummary, no, because destination format
is float.
There is only one other call to this function, in DoGetSamples. At one
call to that function, in DoGetMinMaxRMS, again format is float always.
There is only one other call to DoGetSamples, in SampleBlock::GetSamples().
In one call to that function, in WaveformView.cpp, again format is float.
That leaves two calls in Sequence.cpp. One of those can be proved to be
used only in copy and paste operations, always supplying the same sample
format as the samples were stored in, therefore no dither.
That leaves uses of Sequence::Read(). There are uses of Read() in internal
operations also easily shown to use only the saved format, and
GetWaveDisplay() always reads as float.
The remaining use of Sequence::Read() is in Sequence::Get(). That is used
by WaveClip::Resample(), always fetching float. It is also used in
WaveClip::GetSamples().
There is only one use of that function not always fetching float, in
WaveTrack::Get().
It can be shown that the only paths to WaveTrack::Get() not specifying
floatSample are in Benchmark, which is only a diagnostic test, and there
the sample format is the same as what the track was constructed with.
Therefore, no dithering even there!
*/
wxASSERT(destformat == floatSample || destformat == srcformat);
CopySamples(src + srcoffset,
srcformat,
(samplePtr) dest,