comparison liba52/downmix.c @ 3740:dcbdad3fc5cd

mix31to2 & mix31toS in SSE
author michael
date Tue, 25 Dec 2001 17:36:54 +0000
parents b6040dbc751a
children 99ac808d97c0
comparison
equal deleted inserted replaced
3739:b6040dbc751a 3740:dcbdad3fc5cd
519 static void mix31to2 (sample_t * samples, sample_t bias) 519 static void mix31to2 (sample_t * samples, sample_t bias)
520 { 520 {
521 int i; 521 int i;
522 sample_t common; 522 sample_t common;
523 523
524 #ifdef HAVE_SSE
525 asm volatile(
526 "movlps %1, %%xmm7 \n\t"
527 "shufps $0x00, %%xmm7, %%xmm7 \n\t"
528 "movl $-1024, %%esi \n\t"
529 "1: \n\t"
530 "movaps 1024(%0, %%esi), %%xmm0 \n\t"
531 "addps 3072(%0, %%esi), %%xmm0 \n\t"
532 "addps %%xmm7, %%xmm0 \n\t" // common
533 "movaps (%0, %%esi), %%xmm1 \n\t"
534 "movaps 2048(%0, %%esi), %%xmm2 \n\t"
535 "addps %%xmm0, %%xmm1 \n\t"
536 "addps %%xmm0, %%xmm2 \n\t"
537 "movaps %%xmm1, (%0, %%esi) \n\t"
538 "movaps %%xmm2, 1024(%0, %%esi) \n\t"
539 "addl $16, %%esi \n\t"
540 " jnz 1b \n\t"
541 :: "r" (samples+256), "m" (bias)
542 : "%esi"
543 );
544 #else
524 for (i = 0; i < 256; i++) { 545 for (i = 0; i < 256; i++) {
525 common = samples[i + 256] + samples[i + 768] + bias; 546 common = samples[i + 256] + samples[i + 768] + bias;
526 samples[i] += common; 547 samples[i] += common;
527 samples[i + 256] = samples[i + 512] + common; 548 samples[i + 256] = samples[i + 512] + common;
528 } 549 }
550 #endif
529 } 551 }
530 552
531 static void mix31toS (sample_t * samples, sample_t bias) 553 static void mix31toS (sample_t * samples, sample_t bias)
532 { 554 {
533 int i; 555 int i;
534 sample_t common, surround; 556 sample_t common, surround;
535 557
558 #ifdef HAVE_SSE
559 asm volatile(
560 "movlps %1, %%xmm7 \n\t"
561 "shufps $0x00, %%xmm7, %%xmm7 \n\t"
562 "movl $-1024, %%esi \n\t"
563 "1: \n\t"
564 "movaps 1024(%0, %%esi), %%xmm0 \n\t"
565 "movaps 3072(%0, %%esi), %%xmm3 \n\t" // surround
566 "addps %%xmm7, %%xmm0 \n\t" // common
567 "movaps (%0, %%esi), %%xmm1 \n\t"
568 "movaps 2048(%0, %%esi), %%xmm2 \n\t"
569 "addps %%xmm0, %%xmm1 \n\t"
570 "addps %%xmm0, %%xmm2 \n\t"
571 "subps %%xmm3, %%xmm1 \n\t"
572 "addps %%xmm3, %%xmm2 \n\t"
573 "movaps %%xmm1, (%0, %%esi) \n\t"
574 "movaps %%xmm2, 1024(%0, %%esi) \n\t"
575 "addl $16, %%esi \n\t"
576 " jnz 1b \n\t"
577 :: "r" (samples+256), "m" (bias)
578 : "%esi"
579 );
580 #else
536 for (i = 0; i < 256; i++) { 581 for (i = 0; i < 256; i++) {
537 common = samples[i + 256] + bias; 582 common = samples[i + 256] + bias;
538 surround = samples[i + 768]; 583 surround = samples[i + 768];
539 samples[i] += common - surround; 584 samples[i] += common - surround;
540 samples[i + 256] = samples[i + 512] + common + surround; 585 samples[i + 256] = samples[i + 512] + common + surround;
541 } 586 }
587 #endif
542 } 588 }
543 589
544 static void mix22toS (sample_t * samples, sample_t bias) 590 static void mix22toS (sample_t * samples, sample_t bias)
545 { 591 {
546 int i; 592 int i;