FLAC: fix clipping of negative values

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
This commit is contained in:
Johannes Kroll 2017-09-08 19:28:36 +02:00 committed by Erik de Castro Lopo
parent e6c42ff027
commit b9e544328e

View File

@ -1183,7 +1183,7 @@ f2flac8_clip_array (const float *src, int32_t *dest, int count, int normalize)
continue ;
} ;
if (CPU_CLIPS_NEGATIVE == 0 && scaled_value <= (-8.0 * 0x10))
{ dest [count] = 0x80 ;
{ dest [count] = -0x80 ;
continue ;
} ;
dest [count] = lrintf (scaled_value) ;
@ -1205,7 +1205,7 @@ f2flac16_clip_array (const float *src, int32_t *dest, int count, int normalize)
continue ;
} ;
if (CPU_CLIPS_NEGATIVE == 0 && scaled_value <= (-8.0 * 0x1000))
{ dest [count] = 0x8000 ;
{ dest [count] = -0x8000 ;
continue ;
} ;
dest [count] = lrintf (scaled_value) ;
@ -1226,7 +1226,7 @@ f2flac24_clip_array (const float *src, int32_t *dest, int count, int normalize)
} ;
if (CPU_CLIPS_NEGATIVE == 0 && scaled_value <= (-8.0 * 0x100000))
{ dest [count] = 0x800000 ;
{ dest [count] = -0x800000 ;
continue ;
}
dest [count] = lrintf (scaled_value) ;
@ -1314,7 +1314,7 @@ d2flac8_clip_array (const double *src, int32_t *dest, int count, int normalize)
continue ;
} ;
if (CPU_CLIPS_NEGATIVE == 0 && scaled_value <= (-8.0 * 0x10))
{ dest [count] = 0x80 ;
{ dest [count] = -0x80 ;
continue ;
} ;
dest [count] = lrint (scaled_value) ;
@ -1336,7 +1336,7 @@ d2flac16_clip_array (const double *src, int32_t *dest, int count, int normalize)
continue ;
} ;
if (CPU_CLIPS_NEGATIVE == 0 && scaled_value <= (-8.0 * 0x1000))
{ dest [count] = 0x8000 ;
{ dest [count] = -0x8000 ;
continue ;
} ;
dest [count] = lrint (scaled_value) ;
@ -1358,7 +1358,7 @@ d2flac24_clip_array (const double *src, int32_t *dest, int count, int normalize)
continue ;
} ;
if (CPU_CLIPS_NEGATIVE == 0 && scaled_value <= (-8.0 * 0x100000))
{ dest [count] = 0x800000 ;
{ dest [count] = -0x800000 ;
continue ;
} ;
dest [count] = lrint (scaled_value) ;