1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-09-17 16:50:26 +02:00

Partially revert R12560.

Changing the way interleaving was handled by Dither was not the right thing to do.  The actual fix for the original issue was fixed with the changes to Mix.cpp.
This commit is contained in:
lllucius 2013-09-18 04:49:52 +00:00
parent 294202593b
commit 4b23eb342d

View File

@ -186,7 +186,7 @@ const float Dither::SHAPED_BS[] = { 2.033f, -2.165f, 1.959f, -1.590f, 0.6149f };
int x; \ int x; \
for (d = (char*)dst, s = (char*)src, i = 0; \ for (d = (char*)dst, s = (char*)src, i = 0; \
i < len; \ i < len; \
i++, d += SAMPLE_SIZE(dstFormat) * stride, \ i++, d += SAMPLE_SIZE(dstFormat), \
s += SAMPLE_SIZE(srcFormat) * stride) \ s += SAMPLE_SIZE(srcFormat) * stride) \
DITHER_STEP(dither, store, load, d, s); \ DITHER_STEP(dither, store, load, d, s); \
} while (0) } while (0)
@ -264,7 +264,7 @@ void Dither::Apply(enum DitherType ditherType,
{ {
memcpy(d, s, srcBytes); memcpy(d, s, srcBytes);
s += stride * srcBytes; s += stride * srcBytes;
d += stride * srcBytes; d += srcBytes;
} }
} }
@ -278,13 +278,13 @@ void Dither::Apply(enum DitherType ditherType,
if (sourceFormat == int16Sample) if (sourceFormat == int16Sample)
{ {
short* s = (short*)source; short* s = (short*)source;
for (i = 0; i < len; i++, d += stride, s += stride) for (i = 0; i < len; i++, d++, s+= stride)
*d = FROM_INT16(s); *d = FROM_INT16(s);
} else } else
if (sourceFormat == int24Sample) if (sourceFormat == int24Sample)
{ {
int* s = (int*)source; int* s = (int*)source;
for (i = 0; i < len; i++, d += stride, s += stride) for (i = 0; i < len; i++, d++, s+= stride)
*d = FROM_INT24(s); *d = FROM_INT24(s);
} else { } else {
wxASSERT(false); // source format unknown wxASSERT(false); // source format unknown
@ -299,7 +299,7 @@ void Dither::Apply(enum DitherType ditherType,
{ {
*d = ((int)*s) << 8; *d = ((int)*s) << 8;
s += stride; s += stride;
d += stride; d++;
} }
} else } else
{ {
@ -313,11 +313,11 @@ void Dither::Apply(enum DitherType ditherType,
DITHER(RectangleDither, dest, destFormat, source, sourceFormat, len, stride); DITHER(RectangleDither, dest, destFormat, source, sourceFormat, len, stride);
break; break;
case triangle: case triangle:
Reset(); // Reset dither filter for this new conversion. Reset(); // reset dither filter for this new conversion
DITHER(TriangleDither, dest, destFormat, source, sourceFormat, len, stride); DITHER(TriangleDither, dest, destFormat, source, sourceFormat, len, stride);
break; break;
case shaped: case shaped:
Reset(); // Reset dither filter for this new conversion. Reset(); // reset dither filter for this new conversion
DITHER(ShapedDither, dest, destFormat, source, sourceFormat, len, stride); DITHER(ShapedDither, dest, destFormat, source, sourceFormat, len, stride);
break; break;
default: default: