comparison src/vector.c @ 114:f5040ed4e555

Added new extraction function: xtract_subbands()
author Jamie Bullock <jamie@postlude.co.uk>
date Fri, 15 Feb 2008 15:49:49 +0000
parents 72a9a393d5bd
children 6c5ece9cba3a
comparison
equal deleted inserted replaced
113:72a9a393d5bd 114:f5040ed4e555
571 } 571 }
572 //int xtract_lpcc_s(const float *data, const int N, const void *argv, float *result){ 572 //int xtract_lpcc_s(const float *data, const int N, const void *argv, float *result){
573 // return XTRACT_SUCCESS; 573 // return XTRACT_SUCCESS;
574 //} 574 //}
575 575
576 576 int xtract_subbands(const float *data, const int N, const void *argv, float *result){
577
578 int n, bw, xtract_func, nbands, scale, start, lower, *argi, rv;
579
580 argi = (int *)argv;
581
582 xtract_func = argi[0];
583 nbands = argi[1];
584 scale = argi[2];
585 start = argi[3];
586
587
588 if(scale == XTRACT_LINEAR_SUBBANDS)
589 bw = floorf((N - start) / nbands);
590 else
591 bw = start;
592
593 lower = start;
594
595 for(n = 0; n < nbands; n++){
596
597 /* Bounds sanity check */
598 if(lower + bw >= N)
599 result[n] = 0.f
600 continue;
601
602 rv = xtract[xtract_func](data+lower, bw, NULL, &result[n]);
603
604 if(rv != XTRACT_SUCCESS)
605 return rv;
606
607 switch(scale){
608 case XTRACT_OCTAVE_SUBBANDS:
609 lower += bw;
610 bw = lower;
611 break;
612 case XTRACT_LINEAR_SUBBANDS:
613 lower += bw;
614 break;
615 }
616
617 }
618
619 return rv;
620
621 }
622
623
624