volume: Implement controlled processing for int16/1-2ch and int8/1,2,4ch with orc

This commit is contained in:
Sebastian Dröge 2010-10-01 12:21:52 +02:00
parent 0bf4abe581
commit c11ee1a100
2 changed files with 105 additions and 11 deletions

View file

@ -769,6 +769,11 @@ volume_process_controlled_int16_clamp (GstVolume * self, gpointer bytes,
guint num_samples = n_bytes / (sizeof (gint16) * channels); guint num_samples = n_bytes / (sizeof (gint16) * channels);
gdouble vol, val; gdouble vol, val;
if (channels == 1) {
orc_process_controlled_int16_1ch (data, volume, num_samples);
} else if (channels == 2) {
orc_process_controlled_int16_2ch (data, volume, num_samples);
} else {
for (i = 0; i < num_samples; i++) { for (i = 0; i < num_samples; i++) {
vol = *volume++; vol = *volume++;
for (j = 0; j < channels; j++) { for (j = 0; j < channels; j++) {
@ -777,6 +782,7 @@ volume_process_controlled_int16_clamp (GstVolume * self, gpointer bytes,
} }
} }
} }
}
static void static void
volume_process_int8 (GstVolume * self, gpointer bytes, guint n_bytes) volume_process_int8 (GstVolume * self, gpointer bytes, guint n_bytes)
@ -837,6 +843,13 @@ volume_process_controlled_int8_clamp (GstVolume * self, gpointer bytes,
guint num_samples = n_bytes / (sizeof (gint8) * channels); guint num_samples = n_bytes / (sizeof (gint8) * channels);
gdouble val, vol; gdouble val, vol;
if (channels == 1) {
orc_process_controlled_int8_1ch (data, volume, num_samples);
} else if (channels == 2) {
orc_process_controlled_int8_2ch (data, volume, num_samples);
} else if (channels == 4) {
orc_process_controlled_int8_4ch (data, volume, num_samples);
} else {
for (i = 0; i < num_samples; i++) { for (i = 0; i < num_samples; i++) {
vol = *volume++; vol = *volume++;
for (j = 0; j < channels; j++) { for (j = 0; j < channels; j++) {
@ -845,6 +858,7 @@ volume_process_controlled_int8_clamp (GstVolume * self, gpointer bytes,
} }
} }
} }
}
/* GstBaseTransform vmethod implementations */ /* GstBaseTransform vmethod implementations */

View file

@ -33,7 +33,6 @@ mulswl t1, d1, p1
shrsl t1, t1, 13 shrsl t1, t1, 13
convssslw d1, t1 convssslw d1, t1
.function orc_process_int8 .function orc_process_int8
.dest 1 d1 gint8 .dest 1 d1 gint8
.param 1 p1 .param 1 p1
@ -91,3 +90,84 @@ mulf d1, d1, t1
convdf t1, s1 convdf t1, s1
mergelq t2, t1, t1 mergelq t2, t1, t1
x2 mulf d1, d1, t2 x2 mulf d1, d1, t2
.function orc_process_controlled_int16_1ch
.dest 2 d1 gint16
.source 8 s1 gdouble
.temp 8 t1
.temp 4 t2
.temp 2 t3
muld t1, s1, 0x40DFFFC000000000L
convdl t2, t1
convssslw t3, t2
mulswl t2, t3, d1
shrsl t2, t2, 16
convlw d1, t2
.function orc_process_controlled_int16_2ch
.dest 4 d1 gint16
.source 8 s1 gdouble
.temp 8 t1
.temp 4 t2
.temp 2 t3
muld t1, s1, 0x40DFFFC000000000L
convdl t2, t1
convssslw t3, t2
mergewl t2, t3, t3
x2 mulswl t1, t2, d1
x2 shrsl t1, t1, 16
x2 convlw d1, t1
.function orc_process_controlled_int8_1ch
.dest 1 d1 gint8
.source 8 s1 gdouble
.temp 8 t1
.temp 4 t2
.temp 2 t3
.temp 1 t4
muld t1, s1, 0x405FC00000000000L
convdl t2, t1
convlw t3, t2
convssswb t4, t3
mulsbw t3, t4, d1
shrsw t3, t3, 8
convwb d1, t3
.function orc_process_controlled_int8_2ch
.dest 2 d1 gint8
.source 8 s1 gdouble
.temp 8 t1
.temp 4 t2
.temp 2 t3
.temp 1 t4
muld t1, s1, 0x405FC00000000000L
convdl t2, t1
convlw t3, t2
convssswb t4, t3
mergebw t3, t4, t4
x2 mulsbw t2, t3, d1
x2 shrsw t2, t2, 8
x2 convwb d1, t2
.function orc_process_controlled_int8_4ch
.dest 4 d1 gint8
.source 8 s1 gdouble
.temp 8 t1
.temp 4 t2
.temp 2 t3
.temp 1 t4
muld t1, s1, 0x405FC00000000000L
convdl t2, t1
convlw t3, t2
convssswb t4, t3
mergebw t3, t4, t4
mergewl t2, t3, t3
x4 mulsbw t1, t2, d1
x4 shrsw t1, t1, 8
x4 convwb d1, t1