decoder/mad: use MAD_F_MIN and MAD_F_MAX
This commit is contained in:
parent
9d44a6d2ae
commit
f7ed7446ae
|
@ -79,14 +79,12 @@ static inline int32_t
|
||||||
mad_fixed_to_24_sample(mad_fixed_t sample)
|
mad_fixed_to_24_sample(mad_fixed_t sample)
|
||||||
{
|
{
|
||||||
static constexpr unsigned bits = 24;
|
static constexpr unsigned bits = 24;
|
||||||
static constexpr mad_fixed_t MIN = -MAD_F_ONE;
|
|
||||||
static constexpr mad_fixed_t MAX = MAD_F_ONE - 1;
|
|
||||||
|
|
||||||
/* round */
|
/* round */
|
||||||
sample = sample + (1L << (MAD_F_FRACBITS - bits));
|
sample = sample + (1L << (MAD_F_FRACBITS - bits));
|
||||||
|
|
||||||
/* quantize */
|
/* quantize */
|
||||||
return Clamp(sample, MIN, MAX)
|
return Clamp(sample, MAD_F_MIN, MAD_F_MAX)
|
||||||
>> (MAD_F_FRACBITS + 1 - bits);
|
>> (MAD_F_FRACBITS + 1 - bits);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue