comparison vorbis.c @ 3536:545a15c19c91 libavcodec

sse & sse2 implementations of vorbis channel coupling. 9% faster vorbis (on a K8).
author lorenm
date Thu, 03 Aug 2006 03:18:47 +0000
parents a14c98a0ca3d
children f31fda209742
comparison
equal deleted inserted replaced
3535:a14c98a0ca3d 3536:545a15c19c91
927 int header_len[3]; 927 int header_len[3];
928 GetBitContext *gb = &(vc->gb); 928 GetBitContext *gb = &(vc->gb);
929 int i, j, hdr_type; 929 int i, j, hdr_type;
930 930
931 vc->avccontext = avccontext; 931 vc->avccontext = avccontext;
932 dsputil_init(&vc->dsp, avccontext);
932 933
933 if (!headers_len) { 934 if (!headers_len) {
934 av_log(avccontext, AV_LOG_ERROR, "Extradata corrupt.\n"); 935 av_log(avccontext, AV_LOG_ERROR, "Extradata corrupt.\n");
935 return -1; 936 return -1;
936 } 937 }
1441 } 1442 }
1442 } 1443 }
1443 return 0; 1444 return 0;
1444 } 1445 }
1445 1446
1447 void vorbis_inverse_coupling(float *mag, float *ang, int blocksize)
1448 {
1449 int i;
1450 for(i=0; i<blocksize; i++)
1451 {
1452 if (mag[i]>0.0) {
1453 if (ang[i]>0.0) {
1454 ang[i]=mag[i]-ang[i];
1455 } else {
1456 float temp=ang[i];
1457 ang[i]=mag[i];
1458 mag[i]+=temp;
1459 }
1460 } else {
1461 if (ang[i]>0.0) {
1462 ang[i]+=mag[i];
1463 } else {
1464 float temp=ang[i];
1465 ang[i]=mag[i];
1466 mag[i]-=temp;
1467 }
1468 }
1469 }
1470 }
1471
1446 // Decode the audio packet using the functions above 1472 // Decode the audio packet using the functions above
1447 #define BIAS 385 1473 #define BIAS 385
1448 1474
1449 static int vorbis_parse_audio_packet(vorbis_context *vc) { 1475 static int vorbis_parse_audio_packet(vorbis_context *vc) {
1450 GetBitContext *gb=&vc->gb; 1476 GetBitContext *gb=&vc->gb;
1539 for(i=mapping->coupling_steps-1;i>=0;--i) { //warning: i has to be signed 1565 for(i=mapping->coupling_steps-1;i>=0;--i) { //warning: i has to be signed
1540 float *mag, *ang; 1566 float *mag, *ang;
1541 1567
1542 mag=vc->channel_residues+res_chan[mapping->magnitude[i]]*blocksize/2; 1568 mag=vc->channel_residues+res_chan[mapping->magnitude[i]]*blocksize/2;
1543 ang=vc->channel_residues+res_chan[mapping->angle[i]]*blocksize/2; 1569 ang=vc->channel_residues+res_chan[mapping->angle[i]]*blocksize/2;
1544 for(j=0;j<blocksize/2;++j) { 1570 vc->dsp.vorbis_inverse_coupling(mag, ang, blocksize/2);
1545 float temp;
1546 if (mag[j]>0.0) {
1547 if (ang[j]>0.0) {
1548 ang[j]=mag[j]-ang[j];
1549 } else {
1550 temp=ang[j];
1551 ang[j]=mag[j];
1552 mag[j]+=temp;
1553 }
1554 } else {
1555 if (ang[j]>0.0) {
1556 ang[j]+=mag[j];
1557 } else {
1558 temp=ang[j];
1559 ang[j]=mag[j];
1560 mag[j]-=temp;
1561 }
1562 }
1563 }
1564 } 1571 }
1565 1572
1566 // Dotproduct 1573 // Dotproduct
1567 1574
1568 for(j=0, ch_floor_ptr=vc->channel_floors;j<vc->audio_channels;++j,ch_floor_ptr+=blocksize/2) { 1575 for(j=0, ch_floor_ptr=vc->channel_floors;j<vc->audio_channels;++j,ch_floor_ptr+=blocksize/2) {