revert 11465, going back to the original solution for clipping to prevent bad exports
This commit is contained in:
parent
208aac6cc8
commit
de73791a79
|
@ -76,7 +76,13 @@ const float Dither::SHAPED_BS[] = { 2.033f, -2.165f, 1.959f, -1.590f, 0.6149f };
|
|||
// Dereference sample pointer and convert to float sample
|
||||
#define FROM_INT16(ptr) (*((short*)(ptr)) / CONVERT_DIV16)
|
||||
#define FROM_INT24(ptr) (*(( int*)(ptr)) / CONVERT_DIV24)
|
||||
#define FROM_FLOAT(ptr) (*((float*)(ptr)))
|
||||
|
||||
// For float, we internally allow values greater than 1.0, which
|
||||
// would blow up the dithering to int values. FROM_FLOAT is
|
||||
// only used to dither to int, so clip here.
|
||||
#define FROM_FLOAT(ptr) (*((float*)(ptr)) > 1.0 ? 1.0 : \
|
||||
*((float*)(ptr)) < -1.0 ? -1.0 : \
|
||||
*((float*)(ptr)))
|
||||
|
||||
// Promote sample to range of specified type, keep it float, though
|
||||
#define PROMOTE_TO_INT16(sample) ((sample) * CONVERT_DIV16)
|
||||
|
@ -292,7 +298,7 @@ inline float Dither::ShapedDither(float sample)
|
|||
|
||||
// Roll buffer and store last error
|
||||
mPhase = (mPhase + 1) & BUF_MASK;
|
||||
mBuffer[mPhase] = xe - llrintf(result);
|
||||
mBuffer[mPhase] = xe - lrintf(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user