MCPcopy Create free account
hub / github.com/audacity/audacity / DITHER_LOOP

Function DITHER_LOOP

libraries/lib-math/Dither.cpp:143–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141// Implement a dithering loop
142template<typename srcType, typename dstType>
143static inline void DITHER_LOOP( Ditherer dither, State &state,
144 void (*store)(Ditherer, State &, dstType *, float),
145 float (*load)(const srcType *),
146 samplePtr dst, sampleFormat dstFormat, size_t dstStride,
147 constSamplePtr src, sampleFormat srcFormat, size_t srcStride, size_t len)
148{
149 char *d;
150 const char *s;
151 unsigned int ii;
152 for (d = (char*)dst, s = (char*)src, ii = 0;
153 ii < len;
154 ii++, d += SAMPLE_SIZE(dstFormat) * dstStride,
155 s += SAMPLE_SIZE(srcFormat) * srcStride) {
156 store(dither, state, reinterpret_cast<dstType *>(d), load(reinterpret_cast<const srcType *>(s)));
157 }
158}
159
160// Implement a dither. There are only 3 cases where we must dither,
161// in all other cases, no dithering is necessary.

Callers

nothing calls this directly

Calls 2

loadFunction · 0.85
storeFunction · 0.50

Tested by

no test coverage detected