audioconvert: convert from liboil to orc

This commit is contained in:
David Schleef 2010-06-06 23:46:41 -07:00
parent c4ab9c0de8
commit c49806ed16
5 changed files with 2599 additions and 22 deletions

View file

@ -1,17 +1,21 @@
plugin_LTLIBRARIES = libgstaudioconvert.la
ORC_SOURCE=gstaudioconvertorc
include $(top_srcdir)/common/orc.mak
libgstaudioconvert_la_SOURCES = \
gstaudioconvert.c \
audioconvert.c \
gstchannelmix.c \
gstaudioquantize.c \
plugin.c
nodist_libgstaudioconvert_la_SOURCES = $(ORC_NODIST_SOURCES)
libgstaudioconvert_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
libgstaudioconvert_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(ORC_CFLAGS)
libgstaudioconvert_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstaudioconvert_la_LIBADD = \
$(top_builddir)/gst-libs/gst/audio/libgstaudio-@GST_MAJORMINOR@.la \
$(GST_BASE_LIBS) $(GST_LIBS) $(LIBM)
$(GST_BASE_LIBS) $(GST_LIBS) $(ORC_LIBS) $(LIBM)
libgstaudioconvert_la_LIBTOOLFLAGS = --tag=disable-static
noinst_HEADERS = \
@ -29,3 +33,4 @@ noinst_HEADERS = \
#channelmixtest_LDADD = libgstaudioconvert.la \
# $(top_builddir)/gst-libs/gst/audio/libgstaudio-@GST_MAJORMINOR@.la \
# $(GST_LIBS)

View file

@ -30,6 +30,43 @@
#include "gstaudioquantize.h"
#include "audioconvert.h"
#include "gst/floatcast/floatcast.h"
#include "gstaudioconvertorc.h"
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
#define orc_audio_convert_unpack_u16_le orc_audio_convert_unpack_u16
#define orc_audio_convert_unpack_u16_be orc_audio_convert_unpack_u16_swap
#define orc_audio_convert_unpack_s16_le orc_audio_convert_unpack_s16
#define orc_audio_convert_unpack_s16_be orc_audio_convert_unpack_s16_swap
#define orc_audio_convert_unpack_u32_le orc_audio_convert_unpack_u32
#define orc_audio_convert_unpack_u32_be orc_audio_convert_unpack_u32_swap
#define orc_audio_convert_unpack_s32_le orc_audio_convert_unpack_s32
#define orc_audio_convert_unpack_s32_be orc_audio_convert_unpack_s32_swap
#define orc_audio_convert_pack_u16_le orc_audio_convert_pack_u16
#define orc_audio_convert_pack_u16_be orc_audio_convert_pack_u16_swap
#define orc_audio_convert_pack_s16_le orc_audio_convert_pack_s16
#define orc_audio_convert_pack_s16_be orc_audio_convert_pack_s16_swap
#define orc_audio_convert_pack_u32_le orc_audio_convert_pack_u32
#define orc_audio_convert_pack_u32_be orc_audio_convert_pack_u32_swap
#define orc_audio_convert_pack_s32_le orc_audio_convert_pack_s32
#define orc_audio_convert_pack_s32_be orc_audio_convert_pack_s32_swap
#else
#define orc_audio_convert_unpack_u16_be orc_audio_convert_unpack_u16
#define orc_audio_convert_unpack_u16_le orc_audio_convert_unpack_u16_swap
#define orc_audio_convert_unpack_s16_be orc_audio_convert_unpack_s16
#define orc_audio_convert_unpack_s16_le orc_audio_convert_unpack_s16_swap
#define orc_audio_convert_unpack_u32_be orc_audio_convert_unpack_u32
#define orc_audio_convert_unpack_u32_le orc_audio_convert_unpack_u32_swap
#define orc_audio_convert_unpack_s32_be orc_audio_convert_unpack_s32
#define orc_audio_convert_unpack_s32_le orc_audio_convert_unpack_s32_swap
#define orc_audio_convert_pack_u16_be orc_audio_convert_pack_u16
#define orc_audio_convert_pack_u16_le orc_audio_convert_pack_u16_swap
#define orc_audio_convert_pack_s16_be orc_audio_convert_pack_s16
#define orc_audio_convert_pack_s16_le orc_audio_convert_pack_s16_swap
#define orc_audio_convert_pack_u32_be orc_audio_convert_pack_u32
#define orc_audio_convert_pack_u32_le orc_audio_convert_pack_u32_swap
#define orc_audio_convert_pack_s32_be orc_audio_convert_pack_s32
#define orc_audio_convert_pack_s32_le orc_audio_convert_pack_s32_swap
#endif
/* sign bit in the intermediate format */
#define SIGNED (1U<<31)
@ -39,6 +76,8 @@
*/
#define MAKE_UNPACK_FUNC_NAME(name) \
audio_convert_unpack_##name
#define MAKE_ORC_UNPACK_FUNC_NAME(name) \
orc_audio_convert_unpack_##name
/* unpack from integer to signed integer 32 */
#define MAKE_UNPACK_FUNC_II(name, stride, sign, READ_FUNC) \
@ -52,6 +91,15 @@ MAKE_UNPACK_FUNC_NAME (name) (guint8 *src, gint32 *dst, \
} \
}
/* unpack from integer to signed integer 32 with orc */
#define MAKE_UNPACK_FUNC_ORC_II(name, stride, sign, READ_FUNC) \
static void \
MAKE_UNPACK_FUNC_NAME (name) (guint8 *src, gint32 *dst, \
gint scale, gint count) \
{ \
MAKE_ORC_UNPACK_FUNC_NAME (name) (dst, src, scale, count); \
}
/* unpack from float to signed integer 32 */
#define MAKE_UNPACK_FUNC_FI(name, type, READ_FUNC) \
static void \
@ -98,20 +146,22 @@ MAKE_UNPACK_FUNC_NAME (name) (guint8 * src, gdouble * dst, gint scale, \
#define READ32_FROM_LE(p) GST_READ_UINT32_LE (p)
#define READ32_FROM_BE(p) GST_READ_UINT32_BE (p)
MAKE_UNPACK_FUNC_II (u8, 1, SIGNED, READ8);
MAKE_UNPACK_FUNC_II (s8, 1, 0, READ8);
MAKE_UNPACK_FUNC_II (u16_le, 2, SIGNED, READ16_FROM_LE);
MAKE_UNPACK_FUNC_II (s16_le, 2, 0, READ16_FROM_LE);
MAKE_UNPACK_FUNC_II (u16_be, 2, SIGNED, READ16_FROM_BE);
MAKE_UNPACK_FUNC_II (s16_be, 2, 0, READ16_FROM_BE);
MAKE_UNPACK_FUNC_ORC_II (u8, 1, SIGNED, READ8);
MAKE_UNPACK_FUNC_ORC_II (s8, 1, 0, READ8);
MAKE_UNPACK_FUNC_ORC_II (u16_le, 2, SIGNED, READ16_FROM_LE);
MAKE_UNPACK_FUNC_ORC_II (s16_le, 2, 0, READ16_FROM_LE);
MAKE_UNPACK_FUNC_ORC_II (u16_be, 2, SIGNED, READ16_FROM_BE);
MAKE_UNPACK_FUNC_ORC_II (s16_be, 2, 0, READ16_FROM_BE);
MAKE_UNPACK_FUNC_II (u24_le, 3, SIGNED, READ24_FROM_LE);
MAKE_UNPACK_FUNC_II (s24_le, 3, 0, READ24_FROM_LE);
MAKE_UNPACK_FUNC_II (u24_be, 3, SIGNED, READ24_FROM_BE);
MAKE_UNPACK_FUNC_II (s24_be, 3, 0, READ24_FROM_BE);
MAKE_UNPACK_FUNC_II (u32_le, 4, SIGNED, READ32_FROM_LE);
MAKE_UNPACK_FUNC_II (s32_le, 4, 0, READ32_FROM_LE);
MAKE_UNPACK_FUNC_II (u32_be, 4, SIGNED, READ32_FROM_BE);
MAKE_UNPACK_FUNC_II (s32_be, 4, 0, READ32_FROM_BE);
MAKE_UNPACK_FUNC_ORC_II (u32_le, 4, SIGNED, READ32_FROM_LE);
MAKE_UNPACK_FUNC_ORC_II (s32_le, 4, 0, READ32_FROM_LE);
MAKE_UNPACK_FUNC_ORC_II (u32_be, 4, SIGNED, READ32_FROM_BE);
MAKE_UNPACK_FUNC_ORC_II (s32_be, 4, 0, READ32_FROM_BE);
MAKE_UNPACK_FUNC_FI (float_le, gfloat, GFLOAT_FROM_LE);
MAKE_UNPACK_FUNC_FI (float_be, gfloat, GFLOAT_FROM_BE);
MAKE_UNPACK_FUNC_FI (double_le, gdouble, GDOUBLE_FROM_LE);
@ -143,6 +193,8 @@ MAKE_UNPACK_FUNC_IF (s32_be_float, 4, 0, READ32_FROM_BE);
*/
#define MAKE_PACK_FUNC_NAME(name) \
audio_convert_pack_##name
#define MAKE_PACK_FUNC_NAME_ORC(name) \
orc_audio_convert_pack_##name
/*
* These functions convert the signed 32 bit integers to the
@ -156,6 +208,15 @@ audio_convert_pack_##name
* function for the target width.
*/
/* pack from signed integer 32 to integer using Orc */
#define MAKE_PACK_FUNC_ORC_II(name, stride, sign, WRITE_FUNC) \
static void \
MAKE_PACK_FUNC_NAME (name) (gint32 *src, guint8 * dst, \
gint scale, gint count) \
{ \
MAKE_PACK_FUNC_NAME_ORC (name) (dst, src, scale, count); \
}
/* pack from signed integer 32 to integer */
#define MAKE_PACK_FUNC_II(name, stride, sign, WRITE_FUNC) \
static void \
@ -234,20 +295,20 @@ MAKE_PACK_FUNC_NAME (name) (gdouble * src, guint8 * dst, gint scale, \
#define WRITE32_TO_LE(p,v) GST_WRITE_UINT32_LE (p, (guint32)(v))
#define WRITE32_TO_BE(p,v) GST_WRITE_UINT32_BE (p, (guint32)(v))
MAKE_PACK_FUNC_II (u8, 1, SIGNED, WRITE8);
MAKE_PACK_FUNC_II (s8, 1, 0, WRITE8);
MAKE_PACK_FUNC_II (u16_le, 2, SIGNED, WRITE16_TO_LE);
MAKE_PACK_FUNC_II (s16_le, 2, 0, WRITE16_TO_LE);
MAKE_PACK_FUNC_II (u16_be, 2, SIGNED, WRITE16_TO_BE);
MAKE_PACK_FUNC_II (s16_be, 2, 0, WRITE16_TO_BE);
MAKE_PACK_FUNC_ORC_II (u8, 1, SIGNED, WRITE8);
MAKE_PACK_FUNC_ORC_II (s8, 1, 0, WRITE8);
MAKE_PACK_FUNC_ORC_II (u16_le, 2, SIGNED, WRITE16_TO_LE);
MAKE_PACK_FUNC_ORC_II (s16_le, 2, 0, WRITE16_TO_LE);
MAKE_PACK_FUNC_ORC_II (u16_be, 2, SIGNED, WRITE16_TO_BE);
MAKE_PACK_FUNC_ORC_II (s16_be, 2, 0, WRITE16_TO_BE);
MAKE_PACK_FUNC_II (u24_le, 3, SIGNED, WRITE24_TO_LE);
MAKE_PACK_FUNC_II (s24_le, 3, 0, WRITE24_TO_LE);
MAKE_PACK_FUNC_II (u24_be, 3, SIGNED, WRITE24_TO_BE);
MAKE_PACK_FUNC_II (s24_be, 3, 0, WRITE24_TO_BE);
MAKE_PACK_FUNC_II (u32_le, 4, SIGNED, WRITE32_TO_LE);
MAKE_PACK_FUNC_II (s32_le, 4, 0, WRITE32_TO_LE);
MAKE_PACK_FUNC_II (u32_be, 4, SIGNED, WRITE32_TO_BE);
MAKE_PACK_FUNC_II (s32_be, 4, 0, WRITE32_TO_BE);
MAKE_PACK_FUNC_ORC_II (u32_le, 4, SIGNED, WRITE32_TO_LE);
MAKE_PACK_FUNC_ORC_II (s32_le, 4, 0, WRITE32_TO_LE);
MAKE_PACK_FUNC_ORC_II (u32_be, 4, SIGNED, WRITE32_TO_BE);
MAKE_PACK_FUNC_ORC_II (s32_be, 4, 0, WRITE32_TO_BE);
MAKE_PACK_FUNC_IF (float_le, gfloat, GFLOAT_TO_LE);
MAKE_PACK_FUNC_IF (float_be, gfloat, GFLOAT_TO_BE);
MAKE_PACK_FUNC_IF (double_le, gdouble, GDOUBLE_TO_LE);

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,39 @@
/* autogenerated from gstaudioconvertorc.orc */
#ifndef _GSTAUDIOCONVERTORC_H_
#define _GSTAUDIOCONVERTORC_H_
#include <glib.h>
#ifdef __cplusplus
extern "C" {
#endif
void orc_audio_convert_unpack_u8 (gint32 * d1, const guint8 * s1, int p1, int n);
void orc_audio_convert_unpack_s8 (gint32 * d1, const guint8 * s1, int p1, int n);
void orc_audio_convert_unpack_u16 (gint32 * d1, const guint8 * s1, int p1, int n);
void orc_audio_convert_unpack_s16 (gint32 * d1, const guint8 * s1, int p1, int n);
void orc_audio_convert_unpack_u16_swap (gint32 * d1, const guint8 * s1, int p1, int n);
void orc_audio_convert_unpack_s16_swap (gint32 * d1, const guint8 * s1, int p1, int n);
void orc_audio_convert_unpack_u32 (gint32 * d1, const guint8 * s1, int p1, int n);
void orc_audio_convert_unpack_s32 (gint32 * d1, const guint8 * s1, int p1, int n);
void orc_audio_convert_unpack_u32_swap (gint32 * d1, const guint8 * s1, int p1, int n);
void orc_audio_convert_unpack_s32_swap (gint32 * d1, const guint8 * s1, int p1, int n);
void orc_audio_convert_pack_u8 (guint8 * d1, const gint32 * s1, int p1, int n);
void orc_audio_convert_pack_s8 (guint8 * d1, const gint32 * s1, int p1, int n);
void orc_audio_convert_pack_u16 (guint8 * d1, const gint32 * s1, int p1, int n);
void orc_audio_convert_pack_s16 (guint8 * d1, const gint32 * s1, int p1, int n);
void orc_audio_convert_pack_u16_swap (guint8 * d1, const gint32 * s1, int p1, int n);
void orc_audio_convert_pack_s16_swap (guint8 * d1, const gint32 * s1, int p1, int n);
void orc_audio_convert_pack_u32 (guint8 * d1, const gint32 * s1, int p1, int n);
void orc_audio_convert_pack_s32 (guint8 * d1, const gint32 * s1, int p1, int n);
void orc_audio_convert_pack_u32_swap (guint8 * d1, const gint32 * s1, int p1, int n);
void orc_audio_convert_pack_s32_swap (guint8 * d1, const gint32 * s1, int p1, int n);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,234 @@
.function orc_audio_convert_unpack_u8
.dest 4 d1 gint32
.source 1 s1 guint8
.param 4 p1
.const 4 c1 0x80000000
.temp 2 t2
.temp 4 t3
convubw t2, s1
convuwl t3, t2
shll t3, t3, p1
xorl d1, t3, c1
.function orc_audio_convert_unpack_s8
.dest 4 d1 gint32
.source 1 s1 guint8
.param 4 p1
.temp 2 t2
.temp 4 t3
convubw t2, s1
convuwl t3, t2
shll d1, t3, p1
.function orc_audio_convert_unpack_u16
.dest 4 d1 gint32
.source 2 s1 guint8
.param 4 p1
.const 4 c1 0x80000000
.temp 4 t2
convuwl t2, s1
shll t2, t2, p1
xorl d1, t2, c1
.function orc_audio_convert_unpack_s16
.dest 4 d1 gint32
.source 2 s1 guint8
.param 4 p1
.temp 4 t2
convuwl t2, s1
shll d1, t2, p1
.function orc_audio_convert_unpack_u16_swap
.dest 4 d1 gint32
.source 2 s1 guint8
.param 4 p1
.const 4 c1 0x80000000
.temp 2 t1
.temp 4 t2
swapw t1, s1
convuwl t2, t1
shll t2, t2, p1
xorl d1, t2, c1
.function orc_audio_convert_unpack_s16_swap
.dest 4 d1 gint32
.source 2 s1 guint8
.param 4 p1
.temp 2 t1
.temp 4 t2
swapw t1, s1
convuwl t2, t1
shll d1, t2, p1
.function orc_audio_convert_unpack_u32
.dest 4 d1 gint32
.source 4 s1 guint8
.param 4 p1
.const 4 c1 0x80000000
.temp 4 t1
shll t1, s1, p1
xorl d1, t1, c1
.function orc_audio_convert_unpack_s32
.dest 4 d1 gint32
.source 4 s1 guint8
.param 4 p1
shll d1, s1, p1
.function orc_audio_convert_unpack_u32_swap
.dest 4 d1 gint32
.source 4 s1 guint8
.param 4 p1
.const 4 c1 0x80000000
.temp 4 t1
swapl t1, s1
shll t1, t1, p1
xorl d1, t1, c1
.function orc_audio_convert_unpack_s32_swap
.dest 4 d1 gint32
.source 4 s1 guint8
.param 4 p1
.temp 4 t1
swapl t1, s1
shll d1, t1, p1
.function orc_audio_convert_pack_u8
.dest 1 d1 guint8
.source 4 s1 gint32
.param 4 p1
.const 4 c1 0x80000000
.temp 4 t1
.temp 2 t2
xorl t1, s1, c1
shrul t1, t1, p1
convlw t2, t1
convwb d1, t2
.function orc_audio_convert_pack_s8
.dest 1 d1 guint8
.source 4 s1 gint32
.param 4 p1
.temp 4 t1
.temp 2 t2
shrsl t1, s1, p1
convlw t2, t1
convwb d1, t2
.function orc_audio_convert_pack_u16
.dest 2 d1 guint8
.source 4 s1 gint32
.param 4 p1
.const 4 c1 0x80000000
.temp 4 t1
xorl t1, s1, c1
shrul t1, t1, p1
convlw d1, t1
.function orc_audio_convert_pack_s16
.dest 2 d1 guint8
.source 4 s1 gint32
.param 4 p1
.temp 4 t1
shrsl t1, s1, p1
convlw d1, t1
.function orc_audio_convert_pack_u16_swap
.dest 2 d1 guint8
.source 4 s1 gint32
.param 4 p1
.const 4 c1 0x80000000
.temp 4 t1
.temp 2 t2
xorl t1, s1, c1
shrul t1, t1, p1
convlw t2, t1
swapw d1, t2
.function orc_audio_convert_pack_s16_swap
.dest 2 d1 guint8
.source 4 s1 gint32
.param 4 p1
.temp 4 t1
.temp 2 t2
shrsl t1, s1, p1
convlw t2, t1
swapw d1, t2
.function orc_audio_convert_pack_u32
.dest 4 d1 guint8
.source 4 s1 gint32
.param 4 p1
.const 4 c1 0x80000000
.temp 4 t1
xorl t1, s1, c1
shrul d1, t1, p1
.function orc_audio_convert_pack_s32
.dest 4 d1 guint8
.source 4 s1 gint32
.param 4 p1
shrsl d1, s1, p1
.function orc_audio_convert_pack_u32_swap
.dest 4 d1 guint8
.source 4 s1 gint32
.param 4 p1
.const 4 c1 0x80000000
.temp 4 t1
xorl t1, s1, c1
shrul t1, t1, p1
swapl d1, t1
.function orc_audio_convert_pack_s32_swap
.dest 4 d1 guint8
.source 4 s1 gint32
.param 4 p1
.temp 4 t1
shrsl t1, s1, p1
swapl d1, t1