mirror of
https://gitee.com/openharmony/third_party_libsnd
synced 2024-11-27 03:50:29 +00:00
FLAC: fix clipping of negative values
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
This commit is contained in:
parent
e6c42ff027
commit
b9e544328e
12
src/flac.c
12
src/flac.c
@ -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) ;
|
||||
|
Loading…
Reference in New Issue
Block a user