mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-05 13:29:57 -05:00
svolume: fix MMX error
We need to sign extend the lower part of the multiplication before adding it to the higher part. Makes -1 * 0xffff work again.
This commit is contained in:
parent
8a49514f74
commit
056930cbcd
1 changed files with 6 additions and 1 deletions
|
|
@ -62,7 +62,9 @@
|
||||||
" movq "#s", %%mm5 \n\t" \
|
" movq "#s", %%mm5 \n\t" \
|
||||||
" pmulhw "#v", "#s" \n\t" /* .. | 0 | vl*p0 | */ \
|
" pmulhw "#v", "#s" \n\t" /* .. | 0 | vl*p0 | */ \
|
||||||
" paddw %%mm4, "#s" \n\t" /* .. | 0 | vl*p0 | + sign correct */ \
|
" paddw %%mm4, "#s" \n\t" /* .. | 0 | vl*p0 | + sign correct */ \
|
||||||
|
" pslld $16, "#s" \n\t" /* .. | vl*p0 | 0 | */ \
|
||||||
" psrld $16, "#v" \n\t" /* .. | 0 | vh | */ \
|
" psrld $16, "#v" \n\t" /* .. | 0 | vh | */ \
|
||||||
|
" psrad $16, "#s" \n\t" /* .. | vl*p0 | sign extend */ \
|
||||||
" pmaddwd %%mm5, "#v" \n\t" /* .. | p0 * vh | */ \
|
" pmaddwd %%mm5, "#v" \n\t" /* .. | p0 * vh | */ \
|
||||||
" paddd "#s", "#v" \n\t" /* .. | p0 * v0 | */ \
|
" paddd "#s", "#v" \n\t" /* .. | p0 * v0 | */ \
|
||||||
" packssdw "#v", "#v" \n\t" /* .. | p1*v1 | p0*v0 | */
|
" packssdw "#v", "#v" \n\t" /* .. | p1*v1 | p0*v0 | */
|
||||||
|
|
@ -257,11 +259,14 @@ static void run_test (void) {
|
||||||
printf ("checking MMX %zd\n", sizeof (samples));
|
printf ("checking MMX %zd\n", sizeof (samples));
|
||||||
|
|
||||||
pa_random (samples, sizeof (samples));
|
pa_random (samples, sizeof (samples));
|
||||||
|
/* for (i = 0; i < SAMPLES; i++)
|
||||||
|
samples[i] = -1; */
|
||||||
memcpy (samples_ref, samples, sizeof (samples));
|
memcpy (samples_ref, samples, sizeof (samples));
|
||||||
memcpy (samples_orig, samples, sizeof (samples));
|
memcpy (samples_orig, samples, sizeof (samples));
|
||||||
|
|
||||||
for (i = 0; i < CHANNELS; i++)
|
for (i = 0; i < CHANNELS; i++)
|
||||||
volumes[i] = rand() >> 1;
|
volumes[i] = rand() >> 1;
|
||||||
|
/* volumes[i] = 0x0000ffff; */
|
||||||
for (padding = 0; padding < PADDING; padding++, i++)
|
for (padding = 0; padding < PADDING; padding++, i++)
|
||||||
volumes[i] = volumes[padding];
|
volumes[i] = volumes[padding];
|
||||||
|
|
||||||
|
|
@ -269,7 +274,7 @@ static void run_test (void) {
|
||||||
pa_volume_s16ne_mmx (samples, volumes, CHANNELS, sizeof (samples));
|
pa_volume_s16ne_mmx (samples, volumes, CHANNELS, sizeof (samples));
|
||||||
for (i = 0; i < SAMPLES; i++) {
|
for (i = 0; i < SAMPLES; i++) {
|
||||||
if (samples[i] != samples_ref[i]) {
|
if (samples[i] != samples_ref[i]) {
|
||||||
printf ("%d: %04x != %04x (%04x * %04x)\n", i, samples[i], samples_ref[i],
|
printf ("%d: %04x != %04x (%04x * %08x)\n", i, samples[i], samples_ref[i],
|
||||||
samples_orig[i], volumes[i % CHANNELS]);
|
samples_orig[i], volumes[i % CHANNELS]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue