mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
audio: add orc enabled pack and unpack functions
This commit is contained in:
parent
8e393d898a
commit
3f8c5ea036
3 changed files with 630 additions and 89 deletions
|
@ -1,4 +1,7 @@
|
|||
# variables used for enum/marshal generation
|
||||
ORC_SOURCE=gstaudiopack
|
||||
include $(top_srcdir)/common/orc.mak
|
||||
|
||||
glib_enum_headers= \
|
||||
audio.h \
|
||||
audio-format.h \
|
||||
|
@ -12,7 +15,7 @@ glib_gen_basename = audio
|
|||
|
||||
built_sources = audio-enumtypes.c
|
||||
built_headers = audio-enumtypes.h
|
||||
BUILT_SOURCES = $(built_sources) $(built_headers)
|
||||
BUILT_SOURCES += $(built_sources) $(built_headers)
|
||||
|
||||
lib_LTLIBRARIES = \
|
||||
libgstaudio-@GST_API_VERSION@.la
|
||||
|
@ -63,10 +66,11 @@ libgstaudio_@GST_API_VERSION@include_HEADERS = \
|
|||
nodist_libgstaudio_@GST_API_VERSION@include_HEADERS = \
|
||||
audio-enumtypes.h
|
||||
|
||||
libgstaudio_@GST_API_VERSION@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
|
||||
libgstaudio_@GST_API_VERSION@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) \
|
||||
$(ORC_CFLAGS)
|
||||
libgstaudio_@GST_API_VERSION@_la_LIBADD = \
|
||||
$(top_builddir)/gst-libs/gst/tag/libgsttag-@GST_API_VERSION@.la \
|
||||
$(GST_BASE_LIBS) $(GST_LIBS) $(LIBM)
|
||||
$(GST_BASE_LIBS) $(GST_LIBS) $(LIBM) $(ORC_LIBS)
|
||||
libgstaudio_@GST_API_VERSION@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
|
||||
|
||||
include $(top_srcdir)/common/gst-glib-gen.mak
|
||||
|
|
|
@ -25,15 +25,186 @@
|
|||
|
||||
#include "audio-format.h"
|
||||
|
||||
#include "gstaudiopack.h"
|
||||
|
||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||
# define orc_unpack_s16le orc_unpack_s16
|
||||
# define orc_unpack_s16be orc_unpack_s16_swap
|
||||
# define orc_unpack_u16le orc_unpack_u16
|
||||
# define orc_unpack_u16be orc_unpack_u16_swap
|
||||
# define orc_unpack_s24_32le orc_unpack_s24_32
|
||||
# define orc_unpack_s24_32be orc_unpack_s24_32_swap
|
||||
# define orc_unpack_u24_32le orc_unpack_u24_32
|
||||
# define orc_unpack_u24_32be orc_unpack_u24_32_swap
|
||||
# define orc_unpack_s32le orc_unpack_s32
|
||||
# define orc_unpack_s32be orc_unpack_s32_swap
|
||||
# define orc_unpack_u32le orc_unpack_u32
|
||||
# define orc_unpack_u32be orc_unpack_u32_swap
|
||||
# define orc_unpack_f32le orc_unpack_f32
|
||||
# define orc_unpack_f32be orc_unpack_f32_swap
|
||||
# define orc_unpack_f64le orc_unpack_f64
|
||||
# define orc_unpack_f64be orc_unpack_f64_swap
|
||||
# define orc_pack_s16le orc_pack_s16
|
||||
# define orc_pack_s16be orc_pack_s16_swap
|
||||
# define orc_pack_u16le orc_pack_u16
|
||||
# define orc_pack_u16be orc_pack_u16_swap
|
||||
# define orc_pack_s24_32le orc_pack_s24_32
|
||||
# define orc_pack_s24_32be orc_pack_s24_32_swap
|
||||
# define orc_pack_u24_32le orc_pack_u24_32
|
||||
# define orc_pack_u24_32be orc_pack_u24_32_swap
|
||||
# define orc_pack_s32le orc_pack_s32
|
||||
# define orc_pack_s32be orc_pack_s32_swap
|
||||
# define orc_pack_u32le orc_pack_u32
|
||||
# define orc_pack_u32be orc_pack_u32_swap
|
||||
# define orc_pack_f32le orc_pack_f32
|
||||
# define orc_pack_f32be orc_pack_f32_swap
|
||||
# define orc_pack_f64le orc_pack_f64
|
||||
# define orc_pack_f64be orc_pack_f64_swap
|
||||
#else
|
||||
# define orc_unpack_s16le orc_unpack_s16_swap
|
||||
# define orc_unpack_s16be orc_unpack_s16
|
||||
# define orc_unpack_u16le orc_unpack_u16_swap
|
||||
# define orc_unpack_u16be orc_unpack_u16
|
||||
# define orc_unpack_s24_32le orc_unpack_s24_32_swap
|
||||
# define orc_unpack_s24_32be orc_unpack_s24_32
|
||||
# define orc_unpack_u24_32le orc_unpack_u24_32_swap
|
||||
# define orc_unpack_u24_32be orc_unpack_u24_32
|
||||
# define orc_unpack_s32le orc_unpack_s32_swap
|
||||
# define orc_unpack_s32be orc_unpack_s32
|
||||
# define orc_unpack_u32le orc_unpack_u32_swap
|
||||
# define orc_unpack_u32be orc_unpack_u32
|
||||
# define orc_unpack_f32le orc_unpack_f32_swap
|
||||
# define orc_unpack_f32be orc_unpack_f32
|
||||
# define orc_unpack_f64le orc_unpack_f64_swap
|
||||
# define orc_unpack_f64be orc_unpack_f64
|
||||
# define orc_pack_s16le orc_pack_s16_swap
|
||||
# define orc_pack_s16be orc_pack_s16
|
||||
# define orc_pack_u16le orc_pack_u16_swap
|
||||
# define orc_pack_u16be orc_pack_u16
|
||||
# define orc_pack_s24_32le orc_pack_s24_32_swap
|
||||
# define orc_pack_s24_32be orc_pack_s24_32
|
||||
# define orc_pack_u24_32le orc_pack_u24_32_swap
|
||||
# define orc_pack_u24_32be orc_pack_u24_32
|
||||
# define orc_pack_s32le orc_pack_s32_swap
|
||||
# define orc_pack_s32be orc_pack_s32
|
||||
# define orc_pack_u32le orc_pack_u32_swap
|
||||
# define orc_pack_u32be orc_pack_u32
|
||||
# define orc_pack_f32le orc_pack_f32_swap
|
||||
# define orc_pack_f32be orc_pack_f32
|
||||
# define orc_pack_f64le orc_pack_f64_swap
|
||||
# define orc_pack_f64be orc_pack_f64
|
||||
#endif
|
||||
|
||||
#define MAKE_ORC_PACK_UNPACK(fmt) \
|
||||
static void unpack_ ##fmt (const GstAudioFormatInfo *info, \
|
||||
GstAudioPackFlags flags, gpointer dest, \
|
||||
const gpointer data, gint length) { \
|
||||
orc_unpack_ ##fmt (dest, data, length); \
|
||||
} \
|
||||
static void pack_ ##fmt (const GstAudioFormatInfo *info, \
|
||||
GstAudioPackFlags flags, const gpointer src, \
|
||||
gpointer data, gint length) { \
|
||||
orc_pack_ ##fmt (data, src, length); \
|
||||
}
|
||||
|
||||
#define PACK_S8 GST_AUDIO_FORMAT_S32, unpack_s8, pack_s8
|
||||
MAKE_ORC_PACK_UNPACK (s8)
|
||||
#define PACK_U8 GST_AUDIO_FORMAT_S32, unpack_u8, pack_u8
|
||||
MAKE_ORC_PACK_UNPACK (u8)
|
||||
#define PACK_S16LE GST_AUDIO_FORMAT_S32, unpack_s16le, pack_s16le
|
||||
MAKE_ORC_PACK_UNPACK (s16le)
|
||||
#define PACK_S16BE GST_AUDIO_FORMAT_S32, unpack_s16be, pack_s16be
|
||||
MAKE_ORC_PACK_UNPACK (s16be)
|
||||
#define PACK_U16LE GST_AUDIO_FORMAT_S32, unpack_u16le, pack_u16le
|
||||
MAKE_ORC_PACK_UNPACK (u16le)
|
||||
#define PACK_U16BE GST_AUDIO_FORMAT_S32, unpack_u16be, pack_u16be
|
||||
MAKE_ORC_PACK_UNPACK (u16be)
|
||||
#define PACK_S24_32LE GST_AUDIO_FORMAT_S32, unpack_s24_32le, pack_s24_32le
|
||||
MAKE_ORC_PACK_UNPACK (s24_32le)
|
||||
#define PACK_S24_32BE GST_AUDIO_FORMAT_S32, unpack_s24_32be, pack_s24_32be
|
||||
MAKE_ORC_PACK_UNPACK (s24_32be)
|
||||
#define PACK_U24_32LE GST_AUDIO_FORMAT_S32, unpack_u24_32le, pack_u24_32le
|
||||
MAKE_ORC_PACK_UNPACK (u24_32le)
|
||||
#define PACK_U24_32BE GST_AUDIO_FORMAT_S32, unpack_u24_32be, pack_u24_32be
|
||||
MAKE_ORC_PACK_UNPACK (u24_32be)
|
||||
#define PACK_S32LE GST_AUDIO_FORMAT_S32, unpack_s32le, pack_s32le
|
||||
MAKE_ORC_PACK_UNPACK (s32le)
|
||||
#define PACK_S32BE GST_AUDIO_FORMAT_S32, unpack_s32be, pack_s32be
|
||||
MAKE_ORC_PACK_UNPACK (s32be)
|
||||
#define PACK_U32LE GST_AUDIO_FORMAT_S32, unpack_u32le, pack_u32le
|
||||
MAKE_ORC_PACK_UNPACK (u32le)
|
||||
#define PACK_U32BE GST_AUDIO_FORMAT_S32, unpack_u32be, pack_u32be
|
||||
MAKE_ORC_PACK_UNPACK (u32be)
|
||||
#define SIGNED (1U<<31)
|
||||
/* pack from signed integer 32 to integer */
|
||||
#define WRITE24_TO_LE(p,v) p[0] = v & 0xff; p[1] = (v >> 8) & 0xff; p[2] = (v >> 16) & 0xff
|
||||
#define WRITE24_TO_BE(p,v) p[2] = v & 0xff; p[1] = (v >> 8) & 0xff; p[0] = (v >> 16) & 0xff
|
||||
#define READ24_FROM_LE(p) (p[0] | (p[1] << 8) | (p[2] << 16))
|
||||
#define READ24_FROM_BE(p) (p[2] | (p[1] << 8) | (p[0] << 16))
|
||||
#define MAKE_PACK_UNPACK(name, stride, sign, scale, READ_FUNC, WRITE_FUNC) \
|
||||
static void unpack_ ##name (const GstAudioFormatInfo *info, \
|
||||
GstAudioPackFlags flags, gpointer dest, \
|
||||
const gpointer data, gint length) \
|
||||
{ \
|
||||
guint32 *d = dest; \
|
||||
guint8 *s = data; \
|
||||
for (;length; length--) { \
|
||||
*d++ = (((gint32) READ_FUNC (s)) << scale) ^ (sign); \
|
||||
s += stride; \
|
||||
} \
|
||||
} \
|
||||
static void pack_ ##name (const GstAudioFormatInfo *info, \
|
||||
GstAudioPackFlags flags, const gpointer src, \
|
||||
gpointer data, gint length) \
|
||||
{ \
|
||||
gint32 tmp; \
|
||||
guint32 *s = src; \
|
||||
guint8 *d = data; \
|
||||
for (;length; length--) { \
|
||||
tmp = (*s++ ^ (sign)) >> scale; \
|
||||
WRITE_FUNC (d, tmp); \
|
||||
d += stride; \
|
||||
} \
|
||||
}
|
||||
#define PACK_S24LE GST_AUDIO_FORMAT_S32, unpack_s24le, pack_s24le
|
||||
MAKE_PACK_UNPACK (s24le, 3, 0, 8, READ24_FROM_LE, WRITE24_TO_LE)
|
||||
#define PACK_U24LE GST_AUDIO_FORMAT_S32, unpack_u24le, pack_u24le
|
||||
MAKE_PACK_UNPACK (u24le, 3, SIGNED, 8, READ24_FROM_LE, WRITE24_TO_LE)
|
||||
#define PACK_S24BE GST_AUDIO_FORMAT_S32, unpack_s24be, pack_s24be
|
||||
MAKE_PACK_UNPACK (s24be, 3, 0, 8, READ24_FROM_BE, WRITE24_TO_BE)
|
||||
#define PACK_U24BE GST_AUDIO_FORMAT_S32, unpack_u24be, pack_u24be
|
||||
MAKE_PACK_UNPACK (u24be, 3, SIGNED, 8, READ24_FROM_BE, WRITE24_TO_BE)
|
||||
#define PACK_S20LE GST_AUDIO_FORMAT_S32, unpack_s20le, pack_s20le
|
||||
MAKE_PACK_UNPACK (s20le, 3, 0, 12, READ24_FROM_LE, WRITE24_TO_LE)
|
||||
#define PACK_U20LE GST_AUDIO_FORMAT_S32, unpack_u20le, pack_u20le
|
||||
MAKE_PACK_UNPACK (u20le, 3, SIGNED, 12, READ24_FROM_LE, WRITE24_TO_LE)
|
||||
#define PACK_S20BE GST_AUDIO_FORMAT_S32, unpack_s20be, pack_s20be
|
||||
MAKE_PACK_UNPACK (s20be, 3, 0, 12, READ24_FROM_BE, WRITE24_TO_BE)
|
||||
#define PACK_U20BE GST_AUDIO_FORMAT_S32, unpack_u20be, pack_u20be
|
||||
MAKE_PACK_UNPACK (u20be, 3, SIGNED, 12, READ24_FROM_BE, WRITE24_TO_BE)
|
||||
#define PACK_S18LE GST_AUDIO_FORMAT_S32, unpack_s18le, pack_s18le
|
||||
MAKE_PACK_UNPACK (s18le, 3, 0, 12, READ24_FROM_LE, WRITE24_TO_LE)
|
||||
#define PACK_U18LE GST_AUDIO_FORMAT_S32, unpack_u18le, pack_u18le
|
||||
MAKE_PACK_UNPACK (u18le, 3, SIGNED, 12, READ24_FROM_LE, WRITE24_TO_LE)
|
||||
#define PACK_S18BE GST_AUDIO_FORMAT_S32, unpack_s18be, pack_s18be
|
||||
MAKE_PACK_UNPACK (s18be, 3, 0, 12, READ24_FROM_BE, WRITE24_TO_BE)
|
||||
#define PACK_U18BE GST_AUDIO_FORMAT_S32, unpack_u18be, pack_u18be
|
||||
MAKE_PACK_UNPACK (u18be, 3, SIGNED, 12, READ24_FROM_BE, WRITE24_TO_BE)
|
||||
#define PACK_F32LE GST_AUDIO_FORMAT_F64, unpack_f32le, pack_f32le
|
||||
MAKE_ORC_PACK_UNPACK (f32le)
|
||||
#define PACK_F32BE GST_AUDIO_FORMAT_F64, unpack_f32be, pack_f32be
|
||||
MAKE_ORC_PACK_UNPACK (f32be)
|
||||
#define PACK_F64LE GST_AUDIO_FORMAT_F64, unpack_f64le, pack_f64le
|
||||
MAKE_ORC_PACK_UNPACK (f64le)
|
||||
#define PACK_F64BE GST_AUDIO_FORMAT_F64, unpack_f64be, pack_f64be
|
||||
MAKE_ORC_PACK_UNPACK (f64be)
|
||||
#define SINT (GST_AUDIO_FORMAT_FLAG_INTEGER | GST_AUDIO_FORMAT_FLAG_SIGNED)
|
||||
#define SINT_PACK (SINT | GST_AUDIO_FORMAT_FLAG_UNPACK)
|
||||
#define UINT (GST_AUDIO_FORMAT_FLAG_INTEGER)
|
||||
#define FLOAT (GST_AUDIO_FORMAT_FLAG_FLOAT)
|
||||
#define FLOAT_PACK (FLOAT | GST_AUDIO_FORMAT_FLAG_UNPACK)
|
||||
|
||||
#define MAKE_FORMAT(str,desc,flags,end,width,depth,silent) \
|
||||
{ GST_AUDIO_FORMAT_ ##str, G_STRINGIFY(str), desc, flags, end, width, depth, silent }
|
||||
|
||||
#define MAKE_FORMAT(str,desc,flags,end,width,depth,silent, pack) \
|
||||
{ GST_AUDIO_FORMAT_ ##str, G_STRINGIFY(str), desc, flags, end, width, depth, silent, pack }
|
||||
#define SILENT_0 { 0, 0, 0, 0, 0, 0, 0, 0 }
|
||||
#define SILENT_U8 { 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 }
|
||||
#define SILENT_U16LE { 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80 }
|
||||
|
@ -48,94 +219,122 @@
|
|||
#define SILENT_U20BE { 0x08, 0x00, 0x00, 0x08, 0x00, 0x00 }
|
||||
#define SILENT_U18LE { 0x00, 0x00, 0x02, 0x00, 0x00, 0x02 }
|
||||
#define SILENT_U18BE { 0x02, 0x00, 0x00, 0x02, 0x00, 0x00 }
|
||||
|
||||
static GstAudioFormatInfo formats[] = {
|
||||
static GstAudioFormatInfo formats[] = {
|
||||
{GST_AUDIO_FORMAT_UNKNOWN, "UNKNOWN", "Unknown audio", 0, 0, 0, 0},
|
||||
{GST_AUDIO_FORMAT_ENCODED, "ENCODED", "Encoded audio",
|
||||
GST_AUDIO_FORMAT_FLAG_COMPLEX, 0, 0, 0},
|
||||
/* 8 bit */
|
||||
MAKE_FORMAT (S8, "8-bit signed PCM audio", SINT, 0, 8, 8, SILENT_0),
|
||||
MAKE_FORMAT (U8, "8-bit unsigned PCM audio", UINT, 0, 8, 8, SILENT_U8),
|
||||
MAKE_FORMAT (S8, "8-bit signed PCM audio", SINT, 0, 8, 8, SILENT_0,
|
||||
PACK_S8),
|
||||
MAKE_FORMAT (U8, "8-bit unsigned PCM audio", UINT, 0, 8, 8, SILENT_U8,
|
||||
PACK_U8),
|
||||
/* 16 bit */
|
||||
MAKE_FORMAT (S16LE, "16-bit signed PCM audio", SINT, G_LITTLE_ENDIAN, 16, 16,
|
||||
SILENT_0),
|
||||
MAKE_FORMAT (S16BE, "16-bit signed PCM audio", SINT, G_BIG_ENDIAN, 16, 16,
|
||||
SILENT_0),
|
||||
MAKE_FORMAT (U16LE, "16-bit unsigned PCM audio", UINT, G_LITTLE_ENDIAN, 16,
|
||||
16, SILENT_U16LE),
|
||||
MAKE_FORMAT (U16BE, "16-bit unsigned PCM audio", UINT, G_BIG_ENDIAN, 16, 16,
|
||||
SILENT_U16BE),
|
||||
MAKE_FORMAT (S16LE, "16-bit signed PCM audio", SINT, G_LITTLE_ENDIAN, 16,
|
||||
16,
|
||||
SILENT_0, PACK_S16LE),
|
||||
MAKE_FORMAT (S16BE, "16-bit signed PCM audio", SINT, G_BIG_ENDIAN, 16,
|
||||
16,
|
||||
SILENT_0, PACK_S16BE),
|
||||
MAKE_FORMAT (U16LE, "16-bit unsigned PCM audio", UINT, G_LITTLE_ENDIAN,
|
||||
16,
|
||||
16, SILENT_U16LE, PACK_U16LE),
|
||||
MAKE_FORMAT (U16BE, "16-bit unsigned PCM audio", UINT, G_BIG_ENDIAN, 16,
|
||||
16,
|
||||
SILENT_U16BE, PACK_U16BE),
|
||||
/* 24 bit in low 3 bytes of 32 bits */
|
||||
MAKE_FORMAT (S24_32LE, "24-bit signed PCM audio", SINT, G_LITTLE_ENDIAN, 32,
|
||||
24, SILENT_0),
|
||||
MAKE_FORMAT (S24_32BE, "24-bit signed PCM audio", SINT, G_BIG_ENDIAN, 32, 24,
|
||||
SILENT_0),
|
||||
MAKE_FORMAT (U24_32LE, "24-bit unsigned PCM audio", UINT, G_LITTLE_ENDIAN, 32,
|
||||
24, SILENT_U24_32LE),
|
||||
MAKE_FORMAT (U24_32BE, "24-bit unsigned PCM audio", UINT, G_BIG_ENDIAN, 32,
|
||||
24, SILENT_U24_32BE),
|
||||
MAKE_FORMAT (S24_32LE, "24-bit signed PCM audio", SINT, G_LITTLE_ENDIAN,
|
||||
32,
|
||||
24, SILENT_0, PACK_S24_32LE),
|
||||
MAKE_FORMAT (S24_32BE, "24-bit signed PCM audio", SINT, G_BIG_ENDIAN, 32,
|
||||
24,
|
||||
SILENT_0, PACK_S24_32BE),
|
||||
MAKE_FORMAT (U24_32LE, "24-bit unsigned PCM audio", UINT,
|
||||
G_LITTLE_ENDIAN, 32,
|
||||
24, SILENT_U24_32LE, PACK_U24_32LE),
|
||||
MAKE_FORMAT (U24_32BE, "24-bit unsigned PCM audio", UINT, G_BIG_ENDIAN,
|
||||
32,
|
||||
24, SILENT_U24_32BE, PACK_U24_32BE),
|
||||
/* 32 bit */
|
||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||
MAKE_FORMAT (S32LE, "32-bit signed PCM audio", SINT_PACK, G_LITTLE_ENDIAN, 32,
|
||||
MAKE_FORMAT (S32LE, "32-bit signed PCM audio", SINT_PACK,
|
||||
G_LITTLE_ENDIAN, 32,
|
||||
32, SILENT_0, PACK_S32LE),
|
||||
MAKE_FORMAT (S32BE, "32-bit signed PCM audio", SINT, G_BIG_ENDIAN, 32,
|
||||
32,
|
||||
SILENT_0),
|
||||
MAKE_FORMAT (S32BE, "32-bit signed PCM audio", SINT, G_BIG_ENDIAN, 32, 32,
|
||||
SILENT_0),
|
||||
SILENT_0, PACK_S32BE),
|
||||
#else
|
||||
MAKE_FORMAT (S32LE, "32-bit signed PCM audio", SINT, G_LITTLE_ENDIAN, 32, 32,
|
||||
SILENT_0),
|
||||
MAKE_FORMAT (S32BE, "32-bit signed PCM audio", SINT_PACK, G_BIG_ENDIAN, 32,
|
||||
MAKE_FORMAT (S32LE, "32-bit signed PCM audio", SINT, G_LITTLE_ENDIAN, 32,
|
||||
32,
|
||||
SILENT_0),
|
||||
SILENT_0, PACK_S32LE),
|
||||
MAKE_FORMAT (S32BE, "32-bit signed PCM audio", SINT_PACK, G_BIG_ENDIAN,
|
||||
32,
|
||||
32,
|
||||
SILENT_0, PACK_S32BE),
|
||||
#endif
|
||||
MAKE_FORMAT (U32LE, "32-bit unsigned PCM audio", UINT, G_LITTLE_ENDIAN, 32,
|
||||
32, SILENT_U32LE),
|
||||
MAKE_FORMAT (U32BE, "32-bit unsigned PCM audio", UINT, G_BIG_ENDIAN, 32, 32,
|
||||
SILENT_U32BE),
|
||||
MAKE_FORMAT (U32LE, "32-bit unsigned PCM audio", UINT, G_LITTLE_ENDIAN,
|
||||
32,
|
||||
32, SILENT_U32LE, PACK_U32LE),
|
||||
MAKE_FORMAT (U32BE, "32-bit unsigned PCM audio", UINT, G_BIG_ENDIAN, 32,
|
||||
32,
|
||||
SILENT_U32BE, PACK_U32BE),
|
||||
/* 24 bit in 3 bytes */
|
||||
MAKE_FORMAT (S24LE, "24-bit signed PCM audio", SINT, G_LITTLE_ENDIAN, 24, 24,
|
||||
SILENT_0),
|
||||
MAKE_FORMAT (S24BE, "24-bit signed PCM audio", SINT, G_BIG_ENDIAN, 24, 24,
|
||||
SILENT_0),
|
||||
MAKE_FORMAT (U24LE, "24-bit unsigned PCM audio", UINT, G_LITTLE_ENDIAN, 24,
|
||||
24, SILENT_U24LE),
|
||||
MAKE_FORMAT (U24BE, "24-bit unsigned PCM audio", UINT, G_BIG_ENDIAN, 24, 24,
|
||||
SILENT_U24BE),
|
||||
MAKE_FORMAT (S24LE, "24-bit signed PCM audio", SINT, G_LITTLE_ENDIAN, 24,
|
||||
24,
|
||||
SILENT_0, PACK_S24LE),
|
||||
MAKE_FORMAT (S24BE, "24-bit signed PCM audio", SINT, G_BIG_ENDIAN, 24,
|
||||
24,
|
||||
SILENT_0, PACK_S24BE),
|
||||
MAKE_FORMAT (U24LE, "24-bit unsigned PCM audio", UINT, G_LITTLE_ENDIAN,
|
||||
24,
|
||||
24, SILENT_U24LE, PACK_U24LE),
|
||||
MAKE_FORMAT (U24BE, "24-bit unsigned PCM audio", UINT, G_BIG_ENDIAN, 24,
|
||||
24,
|
||||
SILENT_U24BE, PACK_U24BE),
|
||||
/* 20 bit in 3 bytes */
|
||||
MAKE_FORMAT (S20LE, "20-bit signed PCM audio", SINT, G_LITTLE_ENDIAN, 24, 20,
|
||||
SILENT_0),
|
||||
MAKE_FORMAT (S20BE, "20-bit signed PCM audio", SINT, G_BIG_ENDIAN, 24, 20,
|
||||
SILENT_0),
|
||||
MAKE_FORMAT (U20LE, "20-bit unsigned PCM audio", UINT, G_LITTLE_ENDIAN, 24,
|
||||
20, SILENT_U20LE),
|
||||
MAKE_FORMAT (U20BE, "20-bit unsigned PCM audio", UINT, G_BIG_ENDIAN, 24, 20,
|
||||
SILENT_U20BE),
|
||||
MAKE_FORMAT (S20LE, "20-bit signed PCM audio", SINT, G_LITTLE_ENDIAN, 24,
|
||||
20,
|
||||
SILENT_0, PACK_S20LE),
|
||||
MAKE_FORMAT (S20BE, "20-bit signed PCM audio", SINT, G_BIG_ENDIAN, 24,
|
||||
20,
|
||||
SILENT_0, PACK_S20BE),
|
||||
MAKE_FORMAT (U20LE, "20-bit unsigned PCM audio", UINT, G_LITTLE_ENDIAN,
|
||||
24,
|
||||
20, SILENT_U20LE, PACK_U20LE),
|
||||
MAKE_FORMAT (U20BE, "20-bit unsigned PCM audio", UINT, G_BIG_ENDIAN, 24,
|
||||
20,
|
||||
SILENT_U20BE, PACK_U20BE),
|
||||
/* 18 bit in 3 bytes */
|
||||
MAKE_FORMAT (S18LE, "18-bit signed PCM audio", SINT, G_LITTLE_ENDIAN, 24, 18,
|
||||
SILENT_0),
|
||||
MAKE_FORMAT (S18BE, "18-bit signed PCM audio", SINT, G_BIG_ENDIAN, 24, 18,
|
||||
SILENT_0),
|
||||
MAKE_FORMAT (U18LE, "18-bit unsigned PCM audio", UINT, G_LITTLE_ENDIAN, 24,
|
||||
18, SILENT_U18LE),
|
||||
MAKE_FORMAT (U18BE, "18-bit unsigned PCM audio", UINT, G_BIG_ENDIAN, 24, 18,
|
||||
SILENT_U18BE),
|
||||
MAKE_FORMAT (S18LE, "18-bit signed PCM audio", SINT, G_LITTLE_ENDIAN, 24,
|
||||
18,
|
||||
SILENT_0, PACK_S18LE),
|
||||
MAKE_FORMAT (S18BE, "18-bit signed PCM audio", SINT, G_BIG_ENDIAN, 24,
|
||||
18,
|
||||
SILENT_0, PACK_S18BE),
|
||||
MAKE_FORMAT (U18LE, "18-bit unsigned PCM audio", UINT, G_LITTLE_ENDIAN,
|
||||
24,
|
||||
18, SILENT_U18LE, PACK_U18LE),
|
||||
MAKE_FORMAT (U18BE, "18-bit unsigned PCM audio", UINT, G_BIG_ENDIAN, 24,
|
||||
18,
|
||||
SILENT_U18BE, PACK_U18BE),
|
||||
/* float */
|
||||
MAKE_FORMAT (F32LE, "32-bit floating-point audio",
|
||||
GST_AUDIO_FORMAT_FLAG_FLOAT, G_LITTLE_ENDIAN, 32, 32, SILENT_0),
|
||||
GST_AUDIO_FORMAT_FLAG_FLOAT, G_LITTLE_ENDIAN, 32, 32, SILENT_0,
|
||||
PACK_F32LE),
|
||||
MAKE_FORMAT (F32BE, "32-bit floating-point audio",
|
||||
GST_AUDIO_FORMAT_FLAG_FLOAT, G_BIG_ENDIAN, 32, 32, SILENT_0),
|
||||
GST_AUDIO_FORMAT_FLAG_FLOAT, G_BIG_ENDIAN, 32, 32, SILENT_0,
|
||||
PACK_F32BE),
|
||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||
MAKE_FORMAT (F64LE, "64-bit floating-point audio",
|
||||
FLOAT_PACK, G_LITTLE_ENDIAN, 64, 64, SILENT_0),
|
||||
FLOAT_PACK, G_LITTLE_ENDIAN, 64, 64, SILENT_0, PACK_F64LE),
|
||||
MAKE_FORMAT (F64BE, "64-bit floating-point audio",
|
||||
FLOAT, G_BIG_ENDIAN, 64, 64, SILENT_0)
|
||||
FLOAT, G_BIG_ENDIAN, 64, 64, SILENT_0, PACK_F64BE)
|
||||
#else
|
||||
MAKE_FORMAT (F64LE, "64-bit floating-point audio",
|
||||
FLOAT, G_LITTLE_ENDIAN, 64, 64, SILENT_0),
|
||||
FLOAT, G_LITTLE_ENDIAN, 64, 64, SILENT_0, PACK_F64LE),
|
||||
MAKE_FORMAT (F64BE, "64-bit floating-point audio",
|
||||
FLOAT_PACK, G_BIG_ENDIAN, 64, 64, SILENT_0)
|
||||
FLOAT_PACK, G_BIG_ENDIAN, 64, 64, SILENT_0, PACK_F64BE)
|
||||
#endif
|
||||
};
|
||||
};
|
||||
|
||||
G_DEFINE_POINTER_TYPE (GstAudioFormatInfo, gst_audio_format_info);
|
||||
|
||||
|
|
338
gst-libs/gst/audio/gstaudiopack.orc
Normal file
338
gst-libs/gst/audio/gstaudiopack.orc
Normal file
|
@ -0,0 +1,338 @@
|
|||
|
||||
.function orc_unpack_u8
|
||||
.dest 4 d1 gint32
|
||||
.source 1 s1 guint8
|
||||
.const 4 c1 0x80000000
|
||||
.const 4 c2 24
|
||||
.temp 2 t2
|
||||
.temp 4 t3
|
||||
|
||||
convubw t2, s1
|
||||
convuwl t3, t2
|
||||
shll t3, t3, c2
|
||||
xorl d1, t3, c1
|
||||
|
||||
|
||||
.function orc_unpack_s8
|
||||
.dest 4 d1 gint32
|
||||
.source 1 s1 guint8
|
||||
.const 4 c1 24
|
||||
.temp 2 t2
|
||||
.temp 4 t3
|
||||
|
||||
convubw t2, s1
|
||||
convuwl t3, t2
|
||||
shll d1, t3, c1
|
||||
|
||||
|
||||
.function orc_unpack_u16
|
||||
.dest 4 d1 gint32
|
||||
.source 2 s1 guint8
|
||||
.const 4 c2 16
|
||||
.const 4 c1 0x80000000
|
||||
.temp 4 t2
|
||||
|
||||
convuwl t2, s1
|
||||
shll t2, t2, c2
|
||||
xorl d1, t2, c1
|
||||
|
||||
|
||||
.function orc_unpack_s16
|
||||
.dest 4 d1 gint32
|
||||
.source 2 s1 guint8
|
||||
.const 4 c1 16
|
||||
.temp 4 t2
|
||||
|
||||
convuwl t2, s1
|
||||
shll d1, t2, c1
|
||||
|
||||
|
||||
.function orc_unpack_u16_swap
|
||||
.dest 4 d1 gint32
|
||||
.source 2 s1 guint8
|
||||
.const 4 c2 16
|
||||
.const 4 c1 0x80000000
|
||||
.temp 2 t1
|
||||
.temp 4 t2
|
||||
|
||||
swapw t1, s1
|
||||
convuwl t2, t1
|
||||
shll t2, t2, c2
|
||||
xorl d1, t2, c1
|
||||
|
||||
|
||||
.function orc_unpack_s16_swap
|
||||
.dest 4 d1 gint32
|
||||
.source 2 s1 guint8
|
||||
.const 4 c1 16
|
||||
.temp 2 t1
|
||||
.temp 4 t2
|
||||
|
||||
swapw t1, s1
|
||||
convuwl t2, t1
|
||||
shll d1, t2, c1
|
||||
|
||||
.function orc_unpack_u24_32
|
||||
.dest 4 d1 gint32
|
||||
.source 4 s1 guint8
|
||||
.const 4 c2 8
|
||||
.const 4 c1 0x80000000
|
||||
.temp 4 t1
|
||||
|
||||
shll t1, s1, c2
|
||||
xorl d1, t1, c1
|
||||
|
||||
|
||||
.function orc_unpack_s24_32
|
||||
.dest 4 d1 gint32
|
||||
.source 4 s1 guint8
|
||||
.const 4 c1 8
|
||||
|
||||
shll d1, s1, c1
|
||||
|
||||
|
||||
.function orc_unpack_u24_32_swap
|
||||
.dest 4 d1 gint32
|
||||
.source 4 s1 guint8
|
||||
.const 4 c2 8
|
||||
.const 4 c1 0x80000000
|
||||
.temp 4 t1
|
||||
|
||||
swapl t1, s1
|
||||
shll t1, t1, c2
|
||||
xorl d1, t1, c1
|
||||
|
||||
|
||||
.function orc_unpack_s24_32_swap
|
||||
.dest 4 d1 gint32
|
||||
.source 4 s1 guint8
|
||||
.const 4 c1 8
|
||||
.temp 4 t1
|
||||
|
||||
swapl t1, s1
|
||||
shll d1, t1, c1
|
||||
|
||||
|
||||
.function orc_unpack_u32
|
||||
.dest 4 d1 gint32
|
||||
.source 4 s1 guint8
|
||||
.const 4 c1 0x80000000
|
||||
|
||||
xorl d1, s1, c1
|
||||
|
||||
|
||||
.function orc_unpack_u32_swap
|
||||
.dest 4 d1 gint32
|
||||
.source 4 s1 guint8
|
||||
.const 4 c1 0x80000000
|
||||
.temp 4 t1
|
||||
|
||||
swapl t1, s1
|
||||
xorl d1, t1, c1
|
||||
|
||||
.function orc_unpack_s32
|
||||
.dest 4 d1 gint32
|
||||
.source 4 s1 guint8
|
||||
|
||||
copyl d1, s1
|
||||
|
||||
.function orc_unpack_s32_swap
|
||||
.dest 4 d1 gint32
|
||||
.source 4 s1 guint8
|
||||
|
||||
swapl d1, s1
|
||||
|
||||
.function orc_unpack_f32
|
||||
.dest 8 d1 gdouble
|
||||
.source 4 s1 gfloat
|
||||
|
||||
convfd d1, s1
|
||||
|
||||
.function orc_unpack_f32_swap
|
||||
.dest 8 d1 gdouble
|
||||
.source 4 s1 gfloat
|
||||
.temp 4 t1
|
||||
|
||||
swapl t1, s1
|
||||
convfd d1, t1
|
||||
|
||||
.function orc_unpack_f64
|
||||
.dest 8 d1 gdouble
|
||||
.source 8 s1 gdouble
|
||||
|
||||
copyq d1, s1
|
||||
|
||||
.function orc_unpack_f64_swap
|
||||
.dest 8 d1 gdouble
|
||||
.source 8 s1 gdouble
|
||||
|
||||
swapq d1, s1
|
||||
|
||||
.function orc_pack_u8
|
||||
.dest 1 d1 guint8
|
||||
.source 4 s1 gint32
|
||||
.const 4 c2 24
|
||||
.const 4 c1 0x80000000
|
||||
.temp 4 t1
|
||||
.temp 2 t2
|
||||
|
||||
xorl t1, s1, c1
|
||||
shrul t1, t1, c2
|
||||
convlw t2, t1
|
||||
convwb d1, t2
|
||||
|
||||
|
||||
.function orc_pack_s8
|
||||
.dest 1 d1 guint8
|
||||
.source 4 s1 gint32
|
||||
.const 4 c1 24
|
||||
.temp 4 t1
|
||||
.temp 2 t2
|
||||
|
||||
shrsl t1, s1, c1
|
||||
convlw t2, t1
|
||||
convwb d1, t2
|
||||
|
||||
|
||||
.function orc_pack_u16
|
||||
.dest 2 d1 guint8
|
||||
.source 4 s1 gint32
|
||||
.const 4 c2 16
|
||||
.const 4 c1 0x80000000
|
||||
.temp 4 t1
|
||||
|
||||
xorl t1, s1, c1
|
||||
shrul t1, t1, c2
|
||||
convlw d1, t1
|
||||
|
||||
|
||||
.function orc_pack_s16
|
||||
.dest 2 d1 guint8
|
||||
.source 4 s1 gint32
|
||||
.const 4 c1 16
|
||||
.temp 4 t1
|
||||
|
||||
shrsl t1, s1, c1
|
||||
convlw d1, t1
|
||||
|
||||
|
||||
.function orc_pack_u16_swap
|
||||
.dest 2 d1 guint8
|
||||
.source 4 s1 gint32
|
||||
.const 4 c1 0x80000000
|
||||
.const 4 c2 16
|
||||
.temp 4 t1
|
||||
.temp 2 t2
|
||||
|
||||
xorl t1, s1, c1
|
||||
shrul t1, t1, c2
|
||||
convlw t2, t1
|
||||
swapw d1, t2
|
||||
|
||||
|
||||
.function orc_pack_s16_swap
|
||||
.dest 2 d1 guint8
|
||||
.source 4 s1 gint32
|
||||
.const 4 c1 16
|
||||
.temp 4 t1
|
||||
.temp 2 t2
|
||||
|
||||
shrsl t1, s1, c1
|
||||
convlw t2, t1
|
||||
swapw d1, t2
|
||||
|
||||
.function orc_pack_u24_32
|
||||
.dest 4 d1 guint8
|
||||
.source 4 s1 gint32
|
||||
.const 4 c1 0x80000000
|
||||
.const 4 c2 8
|
||||
.temp 4 t1
|
||||
|
||||
xorl t1, s1, c1
|
||||
shrul d1, t1, c2
|
||||
|
||||
|
||||
.function orc_pack_s24_32
|
||||
.dest 4 d1 guint8
|
||||
.source 4 s1 gint32
|
||||
.const 4 c1 8
|
||||
|
||||
shrsl d1, s1, c1
|
||||
|
||||
|
||||
.function orc_pack_u24_32_swap
|
||||
.dest 4 d1 guint8
|
||||
.source 4 s1 gint32
|
||||
.const 4 c1 0x80000000
|
||||
.const 4 c2 8
|
||||
.temp 4 t1
|
||||
|
||||
xorl t1, s1, c1
|
||||
shrul t1, t1, c2
|
||||
swapl d1, t1
|
||||
|
||||
|
||||
.function orc_pack_s24_32_swap
|
||||
.dest 4 d1 guint8
|
||||
.source 4 s1 gint32
|
||||
.const 4 c1 8
|
||||
.temp 4 t1
|
||||
|
||||
shrsl t1, s1, c1
|
||||
swapl d1, t1
|
||||
|
||||
|
||||
.function orc_pack_u32
|
||||
.dest 4 d1 guint8
|
||||
.source 4 s1 gint32
|
||||
.const 4 c1 0x80000000
|
||||
|
||||
xorl d1, s1, c1
|
||||
|
||||
|
||||
.function orc_pack_s32
|
||||
.dest 4 d1 guint8
|
||||
.source 4 s1 gint32
|
||||
|
||||
copyl d1, s1
|
||||
|
||||
|
||||
.function orc_pack_u32_swap
|
||||
.dest 4 d1 guint8
|
||||
.source 4 s1 gint32
|
||||
.const 4 c1 0x80000000
|
||||
|
||||
xorl d1, s1, c1
|
||||
|
||||
|
||||
.function orc_pack_s32_swap
|
||||
.dest 4 d1 guint8
|
||||
.source 4 s1 gint32
|
||||
|
||||
swapl d1, s1
|
||||
|
||||
.function orc_pack_f32
|
||||
.dest 4 d1 gfloat
|
||||
.source 8 s1 gdouble
|
||||
|
||||
convdf d1, s1
|
||||
|
||||
.function orc_pack_f32_swap
|
||||
.dest 4 d1 gfloat
|
||||
.source 8 s1 gdouble
|
||||
.temp 4 t1
|
||||
|
||||
convdf t1, s1
|
||||
swapl d1, t1
|
||||
|
||||
.function orc_pack_f64
|
||||
.dest 8 d1 gdouble
|
||||
.source 8 s1 gdouble
|
||||
|
||||
copyq d1, s1
|
||||
|
||||
.function orc_pack_f64_swap
|
||||
.dest 8 d1 gdouble
|
||||
.source 8 s1 gdouble
|
||||
|
||||
swapq d1, s1
|
Loading…
Reference in a new issue