mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
audio-format: Use ORC for filling memory with silence samples
This commit is contained in:
parent
4aafc3d39f
commit
081f009e25
2 changed files with 54 additions and 2 deletions
|
@ -27,6 +27,12 @@
|
|||
|
||||
#include "gstaudiopack.h"
|
||||
|
||||
#ifdef HAVE_ORC
|
||||
#include <orc/orcfunctions.h>
|
||||
#else
|
||||
#define orc_memset memset
|
||||
#endif
|
||||
|
||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||
# define audio_orc_unpack_s16le audio_orc_unpack_s16
|
||||
# define audio_orc_unpack_s16be audio_orc_unpack_s16_swap
|
||||
|
@ -453,14 +459,41 @@ gst_audio_format_fill_silence (const GstAudioFormatInfo * info,
|
|||
if (info->flags & GST_AUDIO_FORMAT_FLAG_FLOAT ||
|
||||
info->flags & GST_AUDIO_FORMAT_FLAG_SIGNED) {
|
||||
/* float or signed always 0 */
|
||||
memset (dest, 0, length);
|
||||
orc_memset (dest, 0, length);
|
||||
} else {
|
||||
gint i, j, bps = info->width >> 3;
|
||||
|
||||
switch (bps) {
|
||||
case 1:
|
||||
memset (dest, info->silence[0], length);
|
||||
orc_memset (dest, info->silence[0], length);
|
||||
break;
|
||||
case 2:{
|
||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||
guint16 silence = GST_READ_UINT16_LE (info->silence);
|
||||
#else
|
||||
guint16 silence = GST_READ_UINT16_BE (info->silence);
|
||||
#endif
|
||||
audio_orc_splat_u16 (dest, silence, length / bps);
|
||||
break;
|
||||
}
|
||||
case 4:{
|
||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||
guint32 silence = GST_READ_UINT32_LE (info->silence);
|
||||
#else
|
||||
guint32 silence = GST_READ_UINT32_BE (info->silence);
|
||||
#endif
|
||||
audio_orc_splat_u32 (dest, silence, length / bps);
|
||||
break;
|
||||
}
|
||||
case 8:{
|
||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||
guint64 silence = GST_READ_UINT64_LE (info->silence);
|
||||
#else
|
||||
guint64 silence = GST_READ_UINT64_BE (info->silence);
|
||||
#endif
|
||||
audio_orc_splat_u64 (dest, silence, length / bps);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
for (i = 0; i < length; i += bps) {
|
||||
for (j = 0; j < bps; j++)
|
||||
|
|
|
@ -336,3 +336,22 @@ copyq d1, s1
|
|||
.source 8 s1 gdouble
|
||||
|
||||
swapq d1, s1
|
||||
|
||||
.function audio_orc_splat_u16
|
||||
.dest 2 d1 guint16
|
||||
.param 2 p1
|
||||
|
||||
copyw d1, p1
|
||||
|
||||
.function audio_orc_splat_u32
|
||||
.dest 4 d1 guint32
|
||||
.param 4 p1
|
||||
|
||||
copyl d1, p1
|
||||
|
||||
.function audio_orc_splat_u64
|
||||
.dest 8 d1 guint64
|
||||
.param 8 p1
|
||||
|
||||
copyq d1, p1
|
||||
|
||||
|
|
Loading…
Reference in a new issue