gstreamer/gst/audioconvert/gstaudioconvertorc.orc
2010-08-26 17:03:13 -07:00

299 lines
4.4 KiB
Text

.init gst_audio_convert_orc_init
.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_unpack_float_s32
.source 4 s1 gfloat
.dest 4 d1 guint32
.temp 4 t1
.temp 4 t2
.temp 4 t3
.temp 4 t4
loadl t1, s1
# multiply with 2147483647.0
mulf t1, t1, 0x4F000000
# add 0.5 for rounding
addf t1, t1, 0x3F000000
convfl t2, t1
# if overflow, t3 = ~0
cmpeql t3, t2, -2147483648
# if negative, t4 = ~0
shrsl t4, t1, 31
# if overflow and !negative, t4 = ~0
andnl t4, t4, t3
# 0x80000000 + ~0 = 0x7fffffff
addl d1, t2, t4
.function orc_audio_convert_unpack_float_s32_swap
.source 4 s1 gfloat
.dest 4 d1 guint32
.temp 4 t1
.temp 4 t2
.temp 4 t3
.temp 4 t4
swapl t1, s1
# multiply with 2147483647.0
mulf t1, t1, 0x4F000000
# add 0.5 for rounding
addf t1, t1, 0x3F000000
convfl t2, t1
# if overflow, t3 = ~0
cmpeql t3, t2, -2147483648
# if negative, t4 = ~0
shrsl t4, t1, 31
# if overflow and !negative, t4 = ~0
andnl t4, t4, t3
# 0x80000000 + ~0 = 0x7fffffff
addl d1, t2, t4
.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
.function orc_audio_convert_pack_s32_float
.dest 4 d1 gfloat
.source 4 s1 gint32
.temp 4 t1
convlf t1, s1
# divide by 2147483647.0
divf t1, t1, 0x4F000000
storel d1, t1
.function orc_audio_convert_pack_s32_float_swap
.dest 4 d1 gfloat
.source 4 s1 gint32
.temp 4 t1
convlf t1, s1
# divide by 2147483647.0
divf t1, t1, 0x4F000000
swapl d1, t1